public class Brush extends GdiObject
Modifier and Type | Class and Description |
---|---|
static class |
Brush.BrushStyle
BrushStyle class represents the enumeration of brush styles.
|
static class |
Brush.HatchStyle
HatchStyle class represents the enumeration of hatch styles.
|
static class |
Brush.StockBrush
Enumeration of stock brushes.
|
GdiObject.ImageLoadParameters, GdiObject.ImageType, GdiObject.Type
GDI_ERROR, HGDI_ERROR
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
Constructor and Description |
---|
Brush()
Creates an empty brush.
|
Brush(Brush.BrushStyle style)
Constructs a new brush with the passed style.
|
Brush(long handle)
Constructs a brush with a given handle.
|
Modifier and Type | Method and Description |
---|---|
static Brush |
createBrushIndirect(LogBrush lb)
Creates a logical brush that has the specified style, color, and pattern.
|
static Brush |
createHatchBrush(Brush.HatchStyle style,
ColorRef colorRef)
Creates a logical brush that has the specified hatch pattern and color.
|
static Brush |
createPatternBrush(Bitmap bitmap)
Creates a logical brush with the specified bitmap pattern.
|
static Brush |
createSolidBrush(ColorRef colorRef)
Creates a logical brush that has the specified solid color.
|
static Point |
getBrushOrigin(DC hDC)
Retrieves the current brush origin for the specified device context.
|
static Brush |
getStockObject(Brush.StockBrush object)
This method retrieves one of the predefined stock brushes.
|
static Brush |
getSysColorBrush(int index)
Retrieves a handle of a logical brush that corresponds to the specified
color index.
|
static Point |
setBrushOrigin(DC hDC,
int xOrg,
int yOrg)
Sets the brush origin that GDI assigns to the next brush which an
application selects into the specified device context.
|
deleteObject, getObject, getObjectType
clone, closeHandle, equals, waitFor, waitFor
asFunction, asFunction, asTypedPointer, castTo, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
public Brush()
public Brush(long handle)
handle
- a handle for already existing brush object.public Brush(Brush.BrushStyle style)
style
- brush style.public static Brush getStockObject(Brush.StockBrush object)
object
- the type of stock brush.null
if the method fails.public static Brush createBrushIndirect(LogBrush lb)
lb
- definition of a new brush.null
if
otherwise.public static Brush createHatchBrush(Brush.HatchStyle style, ColorRef colorRef)
style
- hatch style of the brush.colorRef
- the color of a new brush.null
if the method fails.public static Brush createPatternBrush(Bitmap bitmap)
bitmap
- the background for a newly created brush.null
if the method fails.public static Brush createSolidBrush(ColorRef colorRef)
getSysColorBrush(int)
instead, because it returns a cached system object
instead of allocating a new one.colorRef
- the color for a brush.null
class if the method fails.public static Point getBrushOrigin(DC hDC)
hDC
- current device context.null
if the method fails.public static Brush getSysColorBrush(int index)
index
- a color index.null
.public static Point setBrushOrigin(DC hDC, int xOrg, int yOrg)
hDC
- current device context.xOrg
- the x-coordinate of the new brush origin in device units. If
this value is greater than the brush width, the system reduces its value
using the modulus operator (xOrg
mod brush width).yOrg
- the y-coordinate of the new brush origin in device units. If
this value is greater than the brush height, the system reduces it by
using the modulus operator (yOrg
mod brush height).null
if the method
fails.