TemplateResolver.java
2.83 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.template;
import com.adobe.xfa.content.ImageValue;
import com.adobe.xfa.template.formatting.Color;
import java.util.ArrayList;
import java.util.List;
public final class TemplateResolver {
private final List<RGB> moActiveColorList = new ArrayList<RGB>();
private final List<ImageValue> moImageList = new ArrayList<ImageValue>();
public TemplateResolver() {
RGB oWhite = new RGB(255, 255, 255);
RGB oBlack = new RGB(0, 0, 0);
this.moActiveColorList.add(oWhite);
this.moActiveColorList.add(oBlack);
}
public void addActiveColor(Color oColor) {
this.addActiveColor(oColor.getRed(), oColor.getGreen(), oColor.getBlue());
}
public void addActiveColor(int nRed, int nGreen, int nBlue) {
boolean bFound = false;
int nSize = this.moActiveColorList.size();
for (int i = 0; i < nSize; ++i) {
RGB color = this.moActiveColorList.get(i);
if (color.mnRed != nRed || color.mnGreen != nGreen || color.mnBlue != nBlue) continue;
bFound = true;
break;
}
if (!bFound) {
this.moActiveColorList.add(new RGB(nRed, nGreen, nBlue));
}
}
public void addImage(ImageValue oImage) {
boolean bFound = false;
int nSize = this.moImageList.size();
if (nSize > 0) {
for (int i = 0; i < nSize; ++i) {
if (this.moImageList.get(i) != oImage) continue;
bFound = true;
break;
}
}
if (!bFound) {
this.moImageList.add(oImage);
}
}
public void cleanupImages() {
this.moImageList.clear();
}
public List<RGB> enumActiveColors() {
return this.moActiveColorList;
}
public List<ImageValue> getImages() {
return this.moImageList;
}
public static class RGB {
public final int mnBlue;
public final int mnGreen;
public final int mnRed;
RGB(int red, int green, int blue) {
this.mnRed = red;
this.mnGreen = green;
this.mnBlue = blue;
}
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null) {
return false;
}
if (object.getClass() != this.getClass()) {
return false;
}
RGB other = (RGB)object;
return other.mnRed == this.mnRed && other.mnGreen == this.mnGreen && other.mnBlue == this.mnBlue;
}
public int hashCode() {
int hash = 7;
hash = hash * 31 ^ this.mnBlue;
hash = hash * 31 ^ this.mnGreen;
hash = hash * 31 ^ this.mnRed;
return hash;
}
}
}