GFXAttr.java
4.82 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.gfx;
import com.adobe.xfa.gfx.GFXColour;
import com.adobe.xfa.gfx.GFXGraphicContext;
public class GFXAttr {
public static final int STYLE_UNKNOWN = 0;
public static final int STYLE_NONE = 1;
public static final int STYLE_SOLID = 2;
public static final int STYLE_HORZ = 3;
public static final int STYLE_VERT = 4;
public static final int STYLE_CROSS = 5;
public static final int STYLE_DIAG_LEFT = 6;
public static final int STYLE_DIAG_RIGHT = 7;
public static final int STYLE_DIAG_CROSS = 8;
public static final int STYLE_DOT = 9;
public static final int STYLE_DASH = 10;
public static final int STYLE_DOT_DASH = 11;
public static final int STYLE_DOT_DOT_DASH = 12;
public static final int DEFAULT_SHADESCALE = 100;
private int mnStyle;
private int mnShadeScale;
private int mnShade;
private GFXColour mpoColour;
private GFXColour mpoColourBg;
private GFXGraphicContext mpoContext;
public GFXAttr() {
this.initialize();
}
public GFXAttr(GFXAttr oSource) {
this.initialize();
this.copyFrom(oSource);
}
public GFXAttr(int nNewStyle, int lNewShade, GFXColour oNewColour, GFXColour oNewColourBg) {
this.mnStyle = nNewStyle;
this.mnShadeScale = 100;
this.shade(lNewShade);
this.colour(oNewColour);
this.colourBg(oNewColourBg);
}
public GFXColour colour() {
return this.mpoColour;
}
public void colour(GFXColour oNewColour) {
int fg = GFXColour.getStandardColourIndex(oNewColour);
this.mpoColour = fg == 5 ? oNewColour : GFXColour.getStandardColour(fg);
}
public GFXColour colourBg() {
return this.mpoColourBg;
}
public void colourBg(GFXColour oNewColourBg) {
int bg = GFXColour.getStandardColourIndex(oNewColourBg);
this.mpoColourBg = bg == 5 ? oNewColourBg : GFXColour.getStandardColour(bg);
}
public int shade() {
return this.mnShade;
}
public void shade(int lNewShade) {
this.mnShade = lNewShade < 0 ? 0 : (lNewShade > this.mnShadeScale ? this.mnShadeScale : lNewShade);
}
public int shadeScale() {
return this.mnShadeScale;
}
public void shadeScale(int lNewScale) {
double dOldShadeScale = this.mnShadeScale;
double dShade = this.mnShade;
if (lNewScale > 0) {
this.mnShadeScale = lNewScale;
double dFactor = dShade / dOldShadeScale;
this.mnShade = (int)Math.round(dFactor * (double)this.mnShadeScale);
}
}
public GFXColour shadeColour() {
double dShade = (double)this.mnShade / (double)this.mnShadeScale;
return GFXColour.weightedAverage(this.colourBg(), this.colour(), dShade);
}
public static int defaultShadeScale() {
return 100;
}
public int style() {
return this.mnStyle;
}
public void style(int nNewStyle) {
this.mnStyle = nNewStyle;
}
public GFXGraphicContext graphicContext() {
return this.mpoContext;
}
public void graphicContext(GFXGraphicContext poGraphicContext) {
this.mpoContext = poGraphicContext;
}
public boolean equivalent(GFXAttr oCompare) {
return this.mnStyle == oCompare.mnStyle && this.mnShadeScale == oCompare.mnShadeScale && this.mnShade == oCompare.mnShade && GFXGraphicContext.match(this.mpoContext, oCompare.mpoContext) && this.mpoColour.equals(oCompare.mpoColour) && this.mpoColourBg.equals(oCompare.mpoColourBg);
}
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null) {
return false;
}
if (object.getClass() != this.getClass()) {
return false;
}
return this.equivalent((GFXAttr)object);
}
public int hashCode() {
int hash = 73;
hash = hash * 31 ^ this.mnStyle;
hash = hash * 31 ^ this.mnShadeScale;
hash = hash * 31 ^ this.mnShade;
hash = hash * 31 ^ this.mpoColour.hashCode();
hash = hash * 31 ^ this.mpoColourBg.hashCode();
hash = hash * 31 ^ this.mpoContext.hashCode();
return hash;
}
public void copyFrom(GFXAttr oSource) {
if (this != oSource) {
this.mnStyle = oSource.mnStyle;
this.mnShadeScale = oSource.mnShadeScale;
this.mnShade = oSource.mnShade;
this.mpoColour = oSource.mpoColour;
this.mpoColourBg = oSource.mpoColourBg;
this.mpoContext = oSource.mpoContext;
}
}
private void initialize() {
this.mnStyle = 2;
this.mnShadeScale = 100;
this.mnShade = 100;
this.mpoColour = GFXColour.BLACK;
this.mpoColourBg = GFXColour.WHITE;
this.mpoContext = null;
}
}