64 |
return size() > MAX_CACHE_SIZE; |
return size() > MAX_CACHE_SIZE; |
65 |
} |
} |
66 |
}; |
}; |
67 |
|
|
68 |
public static final int CLEAR = 1; |
public static final int CLEAR = 1; |
69 |
public static final int SRC = 2; |
public static final int SRC = 2; |
70 |
public static final int DST = 9; |
public static final int DST = 9; |
89 |
public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP); |
public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP); |
90 |
public static final AlphaComposite DstAtop = getInstance(DST_ATOP); |
public static final AlphaComposite DstAtop = getInstance(DST_ATOP); |
91 |
public static final AlphaComposite Xor = getInstance(XOR); |
public static final AlphaComposite Xor = getInstance(XOR); |
92 |
|
|
93 |
private final int rule; |
private final int rule; |
94 |
private final float alpha; |
private final float alpha; |
95 |
private AlphaComposite(int rule, float alpha) |
private AlphaComposite(int rule, float alpha) |
97 |
this.rule = rule; |
this.rule = rule; |
98 |
this.alpha = alpha; |
this.alpha = alpha; |
99 |
} |
} |
100 |
|
|
101 |
|
/** |
102 |
|
* Creates an AlphaComposite object with the specified rule. |
103 |
|
* |
104 |
|
* @param rule The compositing rule. |
105 |
|
* |
106 |
|
* @exception IllegalArgumentException If rule is not one of the following: |
107 |
|
* CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT, |
108 |
|
* SRC_ATOP, DST_ATOP, or XOR. |
109 |
|
*/ |
110 |
public static AlphaComposite getInstance(int rule) |
public static AlphaComposite getInstance(int rule) |
111 |
{ |
{ |
112 |
return getInstance(rule, 1); |
return getInstance(rule, 1); |
113 |
} |
} |
114 |
|
|
115 |
|
/** |
116 |
|
* Creates an AlphaComposite object with the specified rule and the constant |
117 |
|
* alpha to multiply with the alpha of the source. The source is multiplied |
118 |
|
* with the specified alpha before being composited with the destination. |
119 |
|
* |
120 |
|
* @param rule The compositing rule. |
121 |
|
* |
122 |
|
* @exception IllegalArgumentException If rule is not one of the following: |
123 |
|
* CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT, |
124 |
|
* SRC_ATOP, DST_ATOP, or XOR. |
125 |
|
*/ |
126 |
public static AlphaComposite getInstance(int rule, float alpha) |
public static AlphaComposite getInstance(int rule, float alpha) |
127 |
{ |
{ |
128 |
if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1)) |
if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1)) |