-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrameImage.cs
More file actions
82 lines (71 loc) · 1.43 KB
/
FrameImage.cs
File metadata and controls
82 lines (71 loc) · 1.43 KB
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
using System;
public class FrameImage
{
public int frameWidth;
public int frameHeight;
public int nFrame;
public Image imgFrame;
public int Id = -1;
public int numWidth;
public int numHeight;
public FrameImage(int ID)
{
Id = ID;
Image image = Effect_End.getImage(ID);
if (image != null)
{
imgFrame = image;
frameWidth = Effect_End.arrInfoEff[ID][0];
frameHeight = Effect_End.arrInfoEff[ID][1] / Effect_End.arrInfoEff[ID][2];
nFrame = Effect_End.arrInfoEff[ID][2];
}
}
public FrameImage(Image img, int width, int height)
{
if (img != null)
{
imgFrame = img;
frameWidth = width;
frameHeight = height;
nFrame = img.getHeight() / height;
if (nFrame < 1)
{
nFrame = 1;
}
}
}
public FrameImage(Image img, int numW, int numH, int numNull)
{
if (img != null)
{
imgFrame = img;
numWidth = numW;
numHeight = numH;
frameWidth = imgFrame.getWidth() / numW;
frameHeight = imgFrame.getHeight() / numH;
nFrame = numW * numH - numNull;
}
}
public void drawFrame(int idx, int x, int y, int trans, int anchor, mGraphics g)
{
try
{
if (imgFrame != null)
{
if (idx > nFrame)
{
idx = nFrame;
}
int num = idx * frameHeight;
if (num > frameHeight * (nFrame - 1) || num < 0)
{
num = frameHeight * (nFrame - 1);
}
g.drawRegion(imgFrame, 0, num, frameWidth, frameHeight, trans, x, y, anchor);
}
}
catch (Exception)
{
}
}
}