-
-
Notifications
You must be signed in to change notification settings - Fork 492
/
Copy pathAnimatedImageSource.cs
97 lines (71 loc) · 2.32 KB
/
AnimatedImageSource.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
// Copyright Fela Ameghino 2015-2025
//
// Distributed under the GNU General Public License v3.0. (See accompanying
// file LICENSE or copy at https://www.gnu.org/licenses/gpl-3.0.txt)
//
using RLottie;
using System;
using System.Collections.Generic;
using Telegram.Native;
using Telegram.Td.Api;
using Windows.Foundation.Metadata;
namespace Telegram.Streams
{
[CreateFromString(MethodName = "Telegram.Streams.AnimatedImageSourceFactory.Create")]
public abstract class AnimatedImageSource : IVideoAnimationSource
{
#region Properties
public bool NeedsRepainting { get; set; }
public IList<ClosedVectorPath> Outline { get; set; }
// Needed for Outline
public int Width { get; set; }
// Needed for Outline
public int Height { get; set; }
public event EventHandler OutlineChanged;
protected void OnOutlineChanged()
{
OutlineChanged?.Invoke(this, EventArgs.Empty);
}
public virtual void RequestOutline()
{
}
#endregion
#region Lottie specific
public IReadOnlyDictionary<string, int> Markers { get; set; }
public IReadOnlyDictionary<int, int> ColorReplacements { get; set; }
public FitzModifier FitzModifier { get; set; }
#endregion
public StickerFormat Format { get; protected set; }
public abstract void SeekCallback(long offset);
public abstract void ReadCallback(long count);
public abstract string FilePath { get; }
public abstract long FileSize { get; }
public abstract long Id { get; }
public abstract long Offset { get; }
public bool IsUnique { get; set; }
public override bool Equals(object obj)
{
if (obj is AnimatedImageSource y && !y.IsUnique && !IsUnique)
{
return y.Id == Id;
}
return base.Equals(obj);
}
public override int GetHashCode()
{
if (IsUnique)
{
return base.GetHashCode();
}
return Id.GetHashCode();
}
}
public static class AnimatedImageSourceFactory
{
public static AnimatedImageSource Create(string value)
{
return new LocalFileSource(value);
}
}
}