Sets the composite mode using the specified opacity (alpha), in the range 0.0-1.0, where 0.0 is fully transparent and 1.0 is fully opaque.
(double opacity)
| 69 | /** Sets the composite mode using the specified opacity (alpha), in the |
| 70 | range 0.0-1.0, where 0.0 is fully transparent and 1.0 is fully opaque. */ |
| 71 | public void setOpacity(double opacity) { |
| 72 | if (opacity<0.0) opacity = 0.0; |
| 73 | if (opacity>1.0) opacity = 1.0; |
| 74 | this.opacity = opacity; |
| 75 | if (opacity!=1.0) |
| 76 | composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float)opacity); |
| 77 | else |
| 78 | composite = null; |
| 79 | } |
| 80 | |
| 81 | /** Returns a serialized version of the image. */ |
| 82 | public byte[] getSerializedImage() { |
no test coverage detected