public class RasterOp
The RasterOp class encapsulates a Win32 raster operation. A raster operation refers to a series of boolean operations that you can apply to bitmaps, brushes, and pens. Suppose, for example, that you have two identical images, one of which is black and white, and the other of which is in color. Suppose that you want to write the monochrome image to the colored one, but do not want the white pixels in the source image to overwrite their counterparts in the destination. Raster operations enable you to use boolean logic to express such wishes. You generally build a raster operation using a combination of a series of simple operations and boolean logic. The following raster operations represent the primitives on which you can build. BLACK The resulting pixel(s) will be black. BRUSH The resulting pixel(s) will be the color of the current brush. PEN The resulting pixel(s) will be the color of the current pen. SOURCE The resulting pixel(s) will be the color of the source bitmap image. TARGET The resulting pixel(s) will be the color of the target bitmap image. WHITE The resulting pixel(s) will be white. You can combine one or more simple raster operations using boolean logic to create more complex operations. For example, to draw a line that is always the inverse of the screen color, you would pass the return value of RasterOp.TARGET.invert() as a parameter to a drawing operation defined in the Graphics class. Much more complex effects can be created using boolean AND, OR, and XOR operators.
Fields
Name | Description |
---|---|
BLACK | The resulting pixels will be black. |
BRUSH | The resulting pixels will be the color of the current brush. |
PEN | The resulting pixels will be the color of the current pen. |
SOURCE | The resulting pixels will be the color of the source image pixels. |
TARGET | The resulting pixels will be the color of the target image pixels. |
WHITE | The resulting pixels will be white. |
Methods
Name | Description |
---|---|
andWith(RasterOp op) | Performs a binary AND operation that combines this RasterOp with another. |
getRop() | Retrieves the ternary ROP code for this raster operation. |
getRop2() | Retrieves the binary ROP2 code for this raster operation. |
invert() | Retrieves an RasterOp object that represents an inversion of this one. |
orWith(RasterOp op) | Performs a binary OR operation that combines this RasterOp with another. |
xorWith(RasterOp op) | Performs a binary XOR operation that combines this RasterOp with another. |
Returns a RasterOp object that represents the result of the binary AND operation.
Performs a binary AND operation that combines this RasterOp with another.
Returns the ternary ROP code for this raster operation.
Retrieves the ternary ROP code for this raster operation.
Returns the binary ROP2 code for this raster operation.
Retrieves the binary ROP2 code for this raster operation.
Returns the inverted raster operation.
Retrieves an RasterOp object that represents an inversion of this one.
Returns a RasterOp object that represents the result of the binary OR operation.
Performs a binary OR operation that combines this RasterOp with another.
Returns a RasterOp object that represents the result of the binary XOR operation.
Performs a binary XOR operation that combines this RasterOp with another.