Win32Forth


gdiObject -- Base class for GDI objects


Version 1.0

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

gdiObject is the base class for all GDI objects.  This class contains a single ivar, hObject, that is the (MS Windows) handle for the GDI object. Since GdiObject is a generic class it should not be used to create any instances. There will be the following subclasses of gdiObject:

There are some other (old) classes in Win32Forth that are dealing with the GDI:

ColorObject Class for color objects
ExtColorObject Class for extended color objects
HatchColorObject Class for hatch color objects
Font Class for fonts
WinDC Device context class for windows
WinPrinter Device context class for printing

All old classes are rewritten to use the GDI class library.

Glossary

:class gdiObject <super object

gdiObject is the base class for all GDI Object classes.

:M ZeroHandle:  ( -- )

Clear the handle of the object.
If the current handle of the object is valid it will not be destroyed.

:M GetType:     ( -- n )

Get the type of the object.  
Possible return values are:

OBJ_BITMAP Bitmap
OBJ_BRUSH Brush
OBJ_COLORSPACE Color space
OBJ_DC Device context
OBJ_ENHMETADC Enhanced metafile DC
OBJ_ENHMETAFILE Enhanced metafile
OBJ_EXTPEN Extended pen
OBJ_FONT Font
OBJ_MEMDC Memory DC
OBJ_METAFILE Metafile
OBJ_METADC Metafile DC
OBJ_PAL Palette
OBJ_PEN Pen
OBJ_REGION Region
:M GetObject:   ( cbBuffer lpvObject -- n )

Get information for the object.      
If the function succeeds, and lpvObject is a valid pointer, the return value is the number of bytes stored into the buffer.
If the function succeeds, and lpvObject is NULL, the return value is the number of bytes required to hold the information the function would store into the buffer. If the function fails, the return value is zero.

:M Destroy:     ( -- )

Destroy the object.

:M GetHandle:   ( -- hObject )

Get the handle of the object.

:M SetHandle:   ( hObject -- )

Set the handle of the object.      
If the current handle of the object is valid it will be destroyed.

:M Valid?:      ( -- f )

Check if this object is valid.

;class

End of gdiBase class

Helper words outside the gdiBase class

: ?IsGdiObject  ( a1 -- f )                     \ w32f

Check if a1 is the address of a GdiObject.

: GetGdiObjectHandle  { GdiObject -- handle }   \ w32f

Check if GdiObject is the address of a valid GdiObject. If so return the handle of the object.

: .gdi-objects  ( -- )                          \ w32f sys

Display GDI objects whitch are currently defined.

: (?GdiCheck)   ( a1 -- a1 )                    \ w32f sys internal

Verify if a1 is the address of a GdiObject. If a1 isn't the address of a GdiObject the application will be aborted.

: ?GdiCheck     ( a1 -- a1 )                    \ w32f

Verify if a1 is the address of a GdiObject.

If a1 isn't the address of a GdiObject and the error checking is enabled the application will be aborted.

NOTE:  ?GdiCheck  does nothing in turnkey applications, it's for debugging only.


Document $Id: gdiBase.htm,v 1.14 2007/05/26 10:24:12 dbu_de Exp $