Win32Forth


GdiBrush -- Classes for GDI Brushes.


Version 1.0

This GDI class library was written and placed in the Public Domain in 2005 by Dirk Busch

gdiBrush class

:class gdiBrush <super gdiObject

Base class for all brush objects.
This is an internal class of the GDI Class library. Don't use it yourself.

:M SetOrigin:   { xOrg yOrg hdc -- }

Set the brush origin that GDI assigns to the next brush an application selects into the specified device context.
Note: hdc can be the address of a gdiDC class instance or a DC handle.
A brush is a bitmap that the system uses to paint the interiors of filled shapes.
The brush origin is a pair of coordinates specifying the location of one pixel in the bitmap. The default brush origin coordinates are (0,0). For horizontal coordinates, the value 0 corresponds to the leftmost column of pixels; the width corresponds to the rightmost column. For vertical coordinates, the value 0 corresponds to the uppermost row of pixels; the height corresponds to the lowermost row.
The system automatically tracks the origin of all window-managed device contexts and adjusts their brushes as necessary to maintain an alignment of patterns on the surface. The brush origin that is set with this call is relative to the upper-left corner of the client area.
An application should call SetOrigin: after setting the bitmap stretching mode to HALFTONE by using SetStretchBltMode. This must be done to avoid brush misalignment.
Windows NT/ 2000: The system automatically tracks the origin of all window-managed device contexts and adjusts their brushes as necessary to maintain an alignment of patterns on the surface.
Windows 95/98: Automatic tracking of the brush origin is not supported. Applications must use the UnrealizeObject, SetBrushOrgEx, and SelectObject functions to align the brush before using it.

:M GetOrigin:   ( hdc -- xOrg yOrg )

Get the current brush origin for the specified device context.

:M Create:      ( lplb -- f )

The Create function creates a logical brush that has the specified style, color, and pattern. lplb Pointer to a LOGBRUSH structure that contains information about the brush.

;class

End of gdiBrush class

gdiSolidBrush class

:class gdiSolidBrush <super gdiBrush

Solid brush class

:M SetRValue:   ( r -- )

Set the red component of the brush color.

:M SetGValue:   ( g -- )

Set the green component of the brush color.

:M SetBValue:   ( b -- )

Set the blue component of the brush color.

:M SetRGB:      ( r g b -- )

Set the red, green and blue component of the brush color.

:M SetColor:    ( colorref -- )

Set color of the brush.

:M SetSysColor: ( n -- )

Set the color of the brush to a system color.

:M ChooseColor: ( hWnd -- f )

Open a dialog to choose the color of the brush.

:M GetRValue:   ( -- r )

Get the red component of the brush color.

:M GetGValue:   ( -- g )

Get the green component of the brush color.

:M GetBValue:   ( -- b )

Get the blue component of the brush color.

:M GetColor:    ( -- colorref )

Get the color of the brush as a windows COLORREF value.

:M Create:      ( -- f )

Create the brush with the current color.

;class

End of gdiSolidBrush class

gdiHatchBrush class

:class gdiHatchBrush <super gdiSolidBrush

Hatch brush class

:M SetStyle:    ( style -- )

Set the style of the brush. Possible values are:

HS_BDIAGONAL 45-degree downward left-to-right hatch
HS_CROSS Horizontal and vertical crosshatch
HS_DIAGCROSS 45-degree crosshatch
HS_FDIAGONAL 45-degree upward left-to-right hatch
HS_HORIZONTAL Horizontal hatch
HS_VERTICAL Vertical hatch
:M GetStyle:    ( -- style )

Get the style of the brush. Possible return values are:

HS_BDIAGONAL 45-degree downward left-to-right hatch
HS_CROSS Horizontal and vertical crosshatch
HS_DIAGCROSS 45-degree crosshatch
HS_FDIAGONAL 45-degree upward left-to-right hatch
HS_HORIZONTAL Horizontal hatch
HS_VERTICAL Vertical hatch
:M Create:      ( -- f )

Create the brush with the current style and color.

;class

End of gdiHatchBrush class

gdiPatternBrush class

:class gdiPatternBrush <super gdiBrush

Pattern brush class.

:M SetBitmap:   ( Bitmap -- )

Set the Bitmap for the PatternBrush. The Bitmap can be a DIB section bitmap, which is created by the CreateDIBSection function.

:M GetBitmap:   ( -- Bitmap )

Get the Bitmap for the PatternBrush.

:M Create:      ( -- f )

Creates a logical brush with the specified bitmap pattern.

;class

End of gdiPatternBrush class

gdiDIBPatternBrush class

:class gdiDIBPatternBrush <super gdiBrush

DIB Pattern brush class

:M Create:      ( lpPackedDIB iUsage -- f )

The Create function creates a logical brush that has the pattern specified by the device-independent bitmap (DIB).    
lpPackedDIB Pointer to a packed DIB consisting of a BITMAPINFO structure immediately followed by an array of bytes defining the pixels of the bitmap.   
Windows 95: Creating brushes from bitmaps or DIBs larger than 8 by 8 pixels is not supported. If a larger bitmap is specified, only a portion of the bitmap is used.   
Windows NT/ 2000 and Windows 98: Brushes can be created from bitmaps or DIBs larger than 8 by 8 pixels.
iUsage Specifies whether the bmiColors member of the BITMAPINFO structure contains a valid color table and, if so, whether the entries in this color table contain explicit red, green, blue (RGB) values or palette indexes. The iUsage parameter must be one of the following values.

DIB_PAL_COLORS A color table is provided and consists of an array of 16-bit indexes into the logical palette of the device context into which the brush is to be selected.
DIB_RGB_COLORS A color table is provided and contains literal RGB values.
;class

End of gdiDIBPatternBrush class


Document $Id: gdiBrush.htm,v 1.12 2007/05/26 10:24:13 dbu_de Exp $