Update of /cvsroot/win32forth/win32forth-stc/src/gdi In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv32749/win32forth-stc/src/gdi Modified Files: gdiStruct.f Added Files: gdi.f gdiBitmap.f gdiBrush.f gdiDC.f gdiFont.f gdiMetafile.f gdiMetafileDc.f gdiWindowDc.f Log Message: gah:Added the rest of the gdi functions and some other class files updated primutil.f with extra utilities needed for GUI and bugfixes/extensions to class.f --- NEW FILE: gdiMetafile.f --- \ *D doc\classes\ \ *! gdiMetafile \ *T gdiMetafile -- Metafile class \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch \ *S Glossary cr .( Loading GDI class library - Metafile...) needs gdiBase.f needs gdiDC.f internal external \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ *W <a name="gdiMetafile"></a> :class gdiMetafile <super gdiObject \ *G Metafile class. This class only support's enhanced metafiles (emf) ! rectangle RECT :M ClassInit: ( -- ) ClassInit: super ;M :M Destroy: ( -- ) \ *G Destroy the metafile. hObject ?dup if call DeleteEnhMetaFile ?win-error 0 to hObject then ;M :M SetHandle: ( hMF -- ) \ *G Set the handle of the metafile. Destroy: self to hObject ;M :M Copy: ( -- hCopy ) \ *G Create a copy of the metafile in memory hObject if 0 hObject call CopyEnhMetaFile else null then ;M : FileName ( addr len -- addr1 ) pad place pad +null pad 1+ ; :M Load: ( addr len -- f ) \ *G Load a metafile from a file FileName call GetEnhMetaFile SetHandle: self Valid?: super ;M :M Save: ( addr len -- f ) \ *G Save the metafile in a file hObject if FileName hObject call CopyEnhMetaFile dup if call DeleteEnhMetaFile ?win-error true else false then else 2drop false then ;M :M PlayInRect: ( left top right bottom hDestDC -- ) \ *G Play the metafile in a rectangle GetGdiObjectHandle >r SetRect: RECT AddrOf: RECT hObject r> call PlayEnhMetaFile drop ;M :M CopyToClipboard: ( -- ) \ *G Copy the metafile to the clipboard hObject if null call OpenClipboard ?win-error call EmptyClipboard ?win-error null hObject call CopyEnhMetaFile CF_ENHMETAFILE call SetClipboardData ?win-error call CloseClipboard ?win-error then ;M :M GetFromClipboard: ( -- ) \ *G Get a metafile from the clipboard null call OpenClipboard ?win-error CF_ENHMETAFILE call GetClipboardData call CloseClipboard ?win-error ?dup if null swap call CopyEnhMetaFile SetHandle: self then ;M :M GetFileHeader: ( pemh size -- n ) \ *G The GetFileHeader: method retrieves the record containing the header \ ** for the specified enhanced-format metafile. \n \ ** pemh Pointer to an ENHMETAHEADER structure that receives the header record. \ ** If this parameter is NULL, the function returns the size of the header record. \n \ ** size Specifies the size, in bytes, of the buffer to receive the data. Only this \ ** many bytes will be copied. hObject call GetEnhMetaFileHeader ;M :M GetPaletteEntries: ( cEntries lppe -- n ) \ *G The GetPaletteEntries: methods retrieves optional palette entries from the \ ** specified enhanced metafile. \n \ ** cEntries Specifies the number of entries to be retrieved from the optional \ ** palette. \n \ ** lppe Pointer to an array of PALETTEENTRY structures that receives the palette \ ** colors. The array must contain at least as many structures as there are entries \ ** specified by the cEntries parameter. \ ** If the array pointer is NULL and the enhanced metafile contains an optional palette, \ ** the return value is the number of entries in the enhanced metafile's palette; if \ ** the array pointer is a valid pointer and the enhanced metafile contains an optional \ ** palette, the return value is the number of entries copied; if the metafile does not \ ** contain an optional palette, the return value is zero. Otherwise, the return value \ ** is GDI_ERROR. swap hObject call GetEnhMetaFilePaletteEntries ;M ;class \ *G End of gdiMetafile class module \ *Z --- NEW FILE: gdi.f --- \ gdi.f \ \ Written: Sonntag, Oktober 09 2005 by Dirk Busch \ Changed: Samstag, Oktober 29 2005 by Dirk Busch \ \ Licence: Public Domain \ \ Missing: Clipping support \ Colors (Pallette) support \ Region support \ Printing support cr .( Loading GDI class library...) needs gdi/gdiBase.f needs gdi/gdiPen.f needs gdi/gdiBrush.f needs gdi/gdiFont.f needs gdi/gdiBitmap.f needs gdi/gdiMetafile.f needs gdi/gdiDc.f needs gdi/gdiWindowDc.f needs gdi/gdiMetafileDC.f --- NEW FILE: gdiBitmap.f --- \ *D doc\classes\ \ *! gdiBitmap \ *T gdiBitmap -- GDI Bitmap class. \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch \ *S Glossary cr .( Loading GDI class library - Bitmap...) needs gdiBase.f internal external \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ Bitmap class \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ *W <a name="gdiBitmap"></a> :class gdiBitmap <super gdiObject \ *G Bitmap class gdiSize SIZE :M ClassInit: ( -- ) ClassInit: super ;M :M CreateBitmap: ( Width Height Planes BitsPerPel pBits -- f ) \ *G The CreateBitmap function creates a bitmap with the specified width, height, \ ** and color format (color planes and bits-per-pixel). \n \ ** \n \ ** Width Specifies the bitmap width, in pixels. \n \ ** Height Specifies the bitmap height, in pixels. \n \ ** Planes Specifies the number of color planes used by the device. \n \ ** BitsPerPel Specifies the number of bits required to identify the color of a \ ** single pixel. \n \ ** pBits Pointer to an array of color data used to set the colors in a rectangle \ ** of pixels. Each scan line in the rectangle must be word aligned (scan \ ** lines that are not word aligned must be padded with zeros). If this \ ** parameter is NULL, the contents of the new bitmap is undefined. \n \ ** \n \ ** After a bitmap is created, it can be selected into a device context by calling \ ** the SelectObject function. The CreateBitmap function can be used to create color \ ** bitmaps. However, for performance reasons applications should use CreateBitmap \ ** to create monochrome bitmaps and CreateCompatibleBitmap to create color bitmaps. \ ** When a color bitmap returned from CreateBitmap is selected into a device context, \ ** the system must ensure that the bitmap matches the format of the device context \ ** it is being selected into. Since CreateCompatibleBitmap takes a device context, \ ** it returns a bitmap that has the same format as the specified device context. \ ** Because of this, subsequent calls to SelectObject are faster than with a color \ ** bitmap returned from CreateBitmap. \n \ ** \n \ ** If the bitmap is monochrome, zeros represent the foreground color and ones represent \ ** the background color for the destination device context. \n \ ** \n \ ** If an application sets the nWidth or nHeight parameters to zero, CreateBitmap \ ** returns the handle to a 1-by-1 pixel, monochrome bitmap. \n \ ** \n \ ** When you no longer need the bitmap, call the Destroy: method to delete it. \n \ ** \n \ ** Windows 95/98: The created bitmap cannot exceed 16MB in size 5reverse call CreateBitmap SetHandle: super Valid?: super ;M :M CreateBitmapIndirect: ( pBitmap -- f ) \ *G The CreateBitmapIndirect function creates a bitmap with the specified width, \ ** height, and color format (color planes and bits-per-pixel). \ ** pBitmap Pointer to a BITMAP structure that contains information about the \ ** bitmap. If an application sets the bmWidth or bmHeight members to zero, \ ** CreateBitmapIndirect returns the handle to a 1-by-1 pixel, monochrome bitmap. call CreateBitmapIndirect SetHandle: super Valid?: super ;M :M CreateCompatibleBitmap: ( Width Height hDC -- f ) \ *G The CreateCompatibleBitmap function creates a bitmap compatible with the device \ ** that is associated with the specified device context. \n \ ** \n \ ** The color format of the bitmap created by the CreateCompatibleBitmap function \ ** matches the color format of the device identified by the hdc parameter. This \ ** bitmap can be selected into any memory device context that is compatible with \ ** the original device. \n \ ** \n \ ** Because memory device contexts allow both color and monochrome bitmaps, the format \ ** of the bitmap returned by the CreateCompatibleBitmap function differs when the \ ** specified device context is a memory device context. However, a compatible bitmap \ ** that was created for a nonmemory device context always possesses the same color \ ** format and uses the same color palette as the specified device context. \n \ ** \n \ ** Note: When a memory device context is created, it initially has a 1-by-1 monochrome \ ** bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, \ ** the bitmap that is created is a monochrome bitmap. To create a color bitmap, use the \ ** hDC that was used to create the memory device context, as shown in the following code: \n \ ** \n \ ** HDC memDC = CreateCompatibleDC ( hDC ); \n \ ** HBITMAP memBM = CreateCompatibleBitmap ( hDC ); \n \ ** SelectObject ( memDC, memBM ); \n \ ** \n \ ** If an application sets the nWidth or nHeight parameters to zero, CreateCompatibleBitmap \ ** returns the handle to a 1-by-1 pixel, monochrome bitmap. \n \ ** \n \ ** If a DIB section, which is a bitmap created by the CreateDIBSection function, is selected \ ** into the device context identified by the hdc parameter, CreateCompatibleBitmap creates a \ ** DIB section. \n \ ** \n \ ** When you no longer need the bitmap, call the DeleteObject function to delete it. \n \ ** \n \ ** Windows 95/98: The created bitmap cannot exceed 16MB in size. GetGdiObjectHandle >r swap r> call CreateCompatibleBitmap SetHandle: super Valid?: super ;M :M CreateDIBitmap: ( pbmih fdwInit pbInit pbmi fuUsage hdc -- f ) \ *G The CreateDIBitmap function creates a device-dependent bitmap (DDB) from a DIB and, \ ** optionally, sets the bitmap bits. \n \ ** lpbmih Pointer to a bitmap information header structure, which may be one of those \ ** shown in the following table. \ *L \ *| Operating system | Bitmap information header \ *| Windows NT 3.51 and earlier | BITMAPINFOHEADER | \ *| Windows NT 4.0 and Windows 95 | BITMAPV4HEADER (NOT SUPPORTED !!!) | \ *| Windows 2000 and Windows 98 | BITMAPV5HEADER (NOT SUPPORTED !!!) | \ *P If fdwInit is CBM_INIT, the function uses the bitmap information header structure to \ ** obtain the desired width and height of the bitmap as well as other information. Note \ ** that a positive value for the height indicates a bottom-up DIB while a negative value \ ** for the height indicates a top-down DIB. Calling CreateDIBitmap with fdwInit as CBM_INIT \ ** is equivalent to calling the CreateCompatibleBitmap function to create a DDB in the format \ ** of the device and then calling the SetDIBits function to translate the DIB bits to the DDB. \n \ ** fdwInit Specifies how the system initializes the bitmap bits. The following values is defined. \ ** Value Meaning CBM_INIT If this flag is set, the system uses the data pointed to by the lpbInit \ ** and lpbmi parameters to initialize the bitmap's bits. If this flag is clear, the data pointed \ ** to by those parameters is not used. \n \ ** If fdwInit is zero, the system does not initialize the bitmap's bits. \n \ ** lpbInit Pointer to an array of bytes containing the initial bitmap data. The format of the data \ ** depends on the biBitCount member of the BITMAPINFO structure to which the lpbmi parameter points. \n \ ** lpbmi Pointer to a BITMAPINFO structure that describes the dimensions and color format of the \ ** array pointed to by the lpbInit parameter. \n \ ** fuUsage Specifies whether the bmiColors member of the BITMAPINFO structure was initialized and, \ ** if so, whether bmiColors contains explicit red, green, blue (RGB) values or palette indexes. \ ** The fuUsage parameter must be one of the following values. \ *L \ *| 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 bitmap is to be selected. | \ *| DIB_RGB_COLORS | A color table is provided and contains literal RGB values. | GetGdiObjectHandle >r 5reverse r> call CreateDIBitmap SetHandle: super Valid?: super ;M :M CreateDIBSection: ( pbmi iUsage ppvBits hSection dwOffset hdc -- f ) \ *G The CreateDIBSection function creates a DIB that applications can write to directly. The function \ ** gives you a pointer to the location of the bitmap's bit values. You can supply a handle to a \ ** file-mapping object that the function will use to create the bitmap, or you can let the system \ ** allocate the memory for the bitmap. \n \ ** hdc Handle to a device context. If the value of iUsage is DIB_PAL_COLORS, the function uses \ ** this device context's logical palette to initialize the DIB's colors. \n \ ** pbmi Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, including \ ** the bitmap's dimensions and colors. \n \ ** iUsage Specifies the type of data contained in the bmiColors array member of the BITMAPINFO \ ** structure pointed to by pbmi (either logical palette indexes or literal RGB values). The \ ** following values are defined. \ *L \ *| DIB_PAL_COLORS | The bmiColors member is an array of 16-bit indexes into the logical palette of the device context specified by hdc. | \ *| DIB_RGB_COLORS | The BITMAPINFO structure contains an array of literal RGB values. | \ *P ppvBits Pointer to a variable that receives a pointer to the location of the DIB's bit values. \n \ ** hSection Handle to a file-mapping object that the function will use to create the DIB. This \ ** parameter can be NULL. If hSection is not NULL, it must be a handle to a file-mapping object \ ** created by calling the CreateFileMapping function with the PAGE_READWRITE or PAGE_WRITECOPY flag. \ ** Read-only DIB sections are not supported. Handles created by other means will cause CreateDIBSection \ ** to fail. If hSection is not NULL, the CreateDIBSection function locates the bitmap's bit values at \ ** offset dwOffset in the file-mapping object referred to by hSection. An application can later retrieve \ ** the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection. \ ** If hSection is NULL, the system allocates memory for the DIB. In this case, the CreateDIBSection \ ** function ignores the dwOffset parameter. An application cannot later obtain a handle to this memory. \ ** The dshSection member of the DIBSECTION structure filled in by calling the GetObject function will \ ** be NULL. \n \ ** dwOffset Specifies the offset from the beginning of the file-mapping object referenced by hSection \ ** where storage for the bitmap's bit values is to begin. This value is ignored if hSection is NULL. \ ** The bitmap's bit values are aligned on doubleword boundaries, so dwOffset must be a multiple of the \ ** size of a DWORD. GetGdiObjectHandle >r 5reverse r> call CreateDIBSection SetHandle: super Valid?: super ;M :M SetBitmapDimension: ( width height -- oldwidth oldheight ) \ *G The SetBitmapDimension function assigns preferred dimensions to a bitmap. These dimensions can be \ ** used by applications; however, they are not used by the system. \n \ ** Width Specifies the width, in 0.1-millimeter units, of the bitmap. \n \ ** Height Specifies the height, in 0.1-millimeter units, of the bitmap. \n \ ** An application can retrieve the dimensions assigned to a bitmap with the SetBitmapDimensionEx function \ ** by calling the GetBitmapDimension function. \n \ ** The bitmap identified by hBitmap cannot be a DIB section, which is a bitmap created by the \ ** CreateDIBSection function. If the bitmap is a DIB section, the SetBitmapDimension function fails. Addr: SIZE 3reverse hObject call SetBitmapDimensionEx ?win-error GetX: SIZE GetY: SIZE ;M :M GetBitmapDimension: ( -- width height ) \ *G The GetBitmapDimension function retrieves the dimensions of a bitmap. The retrieved dimensions must \ ** have been set by the SetBitmapDimension function. \ ** The function returns the height and width of the bitmap, in .01-mm units. Addr: SIZE hObject call GetBitmapDimensionEx ?win-error GetX: SIZE GetY: SIZE ;M :M SetDIBits: ;M \ *G not implemented, yet. :M GetDIBits: ;M \ *G not implemented, yet. :M LoadBitmap: ;M \ *G not implemented, yet. :M MaskBlt: ;M \ *G not implemented, yet. :M PlgBlt: ;M \ *G not implemented, yet. ;class \ *G End of Bitmap class module \ *Z --- NEW FILE: gdiFont.f --- \ *D doc\classes\ \ *! gdiFont \ *T gdiFont -- Class for GDI Fonts. \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch \ *S Glossary cr .( Loading GDI class library - Font...) needs gdiBase.f internal external \ ---------------------------------------------------------------------- \ ---------------------------------------------------------------------- \ *W <a name="gdiFont"></a> :Class gdiFont <Super GdiObject \ *G GDI Font class Record: LOGFONT int lfHeight \ width in pixels, device specific int lfWidth \ height in pixels, device specific int lfEscapement int lfOrientation \ in 10ths of a degree int lfWeight byte lfItalic \ TRUE/FALSE byte lfUnderline \ TRUE/FALSE byte lfStrikeOut \ TRUE/FALSE byte lfCharSet byte lfOutPrecision byte lfClipPrecision byte lfQuality byte lfPitchAndFamily LF_FACESIZE bytes lfFaceName \ the font name ;RecordSize: sizeof(LOGFONT) Record: &CHOOSEFONT int lStructSize int hwndOwner int hDC int lpLogFont int iPointSize int Flags int rgbColors int lCustData int lpfnHook int lpTemplateName int hInstance int lpszStyle short nFontType short ___MISSING_ALIGNMENT__ int nSizeMin int nSizeMax ;RecordSize: sizeof(CHOOSEFONT) :M ClassInit: ( -- ) ClassInit: super \ init LOGFONT record 14 to lfHeight 9 to lfWidth 0 to lfEscapement 0 to lfOrientation \ in 10th degrees FW_DONTCARE to lfWeight FALSE to lfItalic FALSE to lfUnderline FALSE to lfStrikeOut ANSI_CHARSET to lfCharSet OUT_TT_PRECIS to lfOutPrecision CLIP_DEFAULT_PRECIS to lfClipPrecision PROOF_QUALITY to lfQuality FIXED_PITCH 0x04 or FF_SWISS or to lfPitchAndFamily \ font family lfFaceName LF_FACESIZE erase \ clear font name s" Courier New" lfFaceName swap move \ move in default name \ init &CHOOSEFONT record sizeof(CHOOSEFONT) to lStructSize LOGFONT to lpLogFont [ CF_SCREENFONTS CF_INITTOLOGFONTSTRUCT or ] literal to Flags null to hwndOwner null to hDC 0 to iPointSize 0 to rgbColors 0 to lCustData null to lpfnHook null to lpTemplateName null to hInstance 0 to lpszStyle 0 to nFontType 0 to nSizeMin 0 to nSizeMax ;M :M SetHeight: ( n1 -- ) \ *G Set the height, in logical units, of the font's character cell or character. The character \ ** height value (also known as the em height) is the character cell height value minus the \ ** internal-leading value. The font mapper interprets the value specified in lfHeight in the \ ** following manner. \ *L \ *| > 0 | The font mapper transforms this value into device units and matches it against the cell height of the available fonts. | \ *| 0 | The font mapper uses a default height value when it searches for a match. | \ *| < 0 | The font mapper transforms this value into device units and matches its absolute value against the character height of the available fonts. | \ *P For all height comparisons, the font mapper looks for the largest font that does not exceed \ ** the requested size. This mapping occurs when the font is used for the first time. to lfHeight ;M :M SetWidth: ( n1 -- ) \ *G Specifies the average width, in logical units, of characters in the font. If lfWidth is zero, \ ** the aspect ratio of the device is matched against the digitization aspect ratio of the available \ ** fonts to find the closest match, determined by the absolute value of the difference. to lfWidth ;M :M SetEscapement: ( n1 -- ) \ *G Set the angle, in tenths of degrees, between the escapement vector and the x-axis of the device. \ ** The escapement vector is parallel to the base line of a row of text. \n \ ** Windows NT/ 2000: When the graphics mode is set to GM_ADVANCED, you can specify the escapement \ ** angle of the string independently of the orientation angle of the string's characters. \n \ ** When the graphics mode is set to GM_COMPATIBLE, lfEscapement specifies both the escapement and \ ** orientation. You should set lfEscapement and lfOrientation to the same value. \n \ ** Windows 95: The lfEscapement member specifies both the escapement and orientation. You should set \ ** lfEscapement and lfOrientation to the same value. to lfEscapement ;M :M SetOrientation: ( n1 -- ) \ *G Set the angle, in tenths of degrees, between each character's base line and the x-axis of the device. to lfOrientation ;M \ 10th/degree increments :M SetWeight: ( n1 -- ) \ *G Specifies the weight of the font in the range 0 through 1000. For example, 400 is normal and 700 is bold. \ ** If this value is zero, a default weight is used. The following values are defined for convenience. \ *L \ *| FW_DONTCARE | 0 | \ *| FW_THIN | 100 | \ *| FW_EXTRALIGHT | 200 | \ *| FW_ULTRALIGHT | 200 | \ *| FW_LIGHT | 300 | \ *| FW_NORMAL | 400 | \ *| FW_REGULAR | 400 | \ *| FW_MEDIUM | 500 | \ *| FW_SEMIBOLD | 600 | \ *| FW_DEMIBOLD | 600 | \ *| FW_BOLD | 700 | \ *| FW_EXTRABOLD | 800 | \ *| FW_ULTRABOLD | 800 | \ *| FW_HEAVY | 900 | \ *| FW_BLACK | 900 | to lfWeight ;M :M SetItalic: ( f1 -- ) \ *G Specifies an italic font if set to TRUE. to lfItalic ;M :M SetUnderline: ( f1 -- ) \ *G Specifies an underlined font if set to TRUE. to lfUnderline ;M :M SetStrikeOut: ( f1 -- ) \ *G Specifies a strikeout font if set to TRUE. to lfStrikeOut ;M :M SetCharSet: ( n1 -- ) \ *G Specifies the character set. The following values are predefined. \ *L \ *| ANSI_CHARSET | \ *| BALTIC_CHARSET | \ *| CHINESEBIG5_CHARSET | \ *| DEFAULT_CHARSET | \ *| EASTEUROPE_CHARSET | \ *| GB2312_CHARSET | \ *| GREEK_CHARSET | \ *| HANGUL_CHARSET | \ *| MAC_CHARSET | \ *| OEM_CHARSET | \ *| RUSSIAN_CHARSET | \ *| SHIFTJIS_CHARSET | \ *| SYMBOL_CHARSET | \ *| TURKISH_CHARSET | \ *P Windows NT/ 2000 or Middle-Eastern Windows 3.1 or later: \ *L \ *| HEBREW_CHARSET | \ *| ARABIC_CHARSET | \ *P Windows NT/ 2000 or Thai Windows 3.1 or later: \ *L \ *| THAI_CHARSET | \ *P The OEM_CHARSET value specifies a character set that is operating-system dependent. \ ** Windows 95/98: You can use the DEFAULT_CHARSET value to allow the name and size of a font \ ** to fully describe the logical font. If the specified font name does not exist, a font from \ ** any character set can be substituted for the specified font, so you should use DEFAULT_CHARSET \ ** sparingly to avoid unexpected results. \n \ ** Windows NT/ 2000: DEFAULT_CHARSET is set to a value based on the current system locale. For \ ** example, when the system locale is English (United States), it is set as ANSI_CHARSET. \n \ ** Fonts with other character sets may exist in the operating system. If an application uses a \ ** font with an unknown character set, it should not attempt to translate or interpret strings \ ** that are rendered with that font. \n \ ** This parameter is important in the font mapping process. To ensure consistent results, specify \ ** a specific character set. If you specify a typeface name in the lfFaceName member, make sure \ ** that the lfCharSet value matches the character set of the typeface specified in lfFaceName. to lfCharSet ;M :M SetOutPrecision: ( n1 -- ) \ *G Specifies the output precision. The output precision defines how closely the output must match \ ** the requested font's height, width, character orientation, escapement, pitch, and font type. It can \ ** be one of the following values. \ *L \ *| OUT_CHARACTER_PRECIS Not used. \ *| OUT_DEFAULT_PRECIS | Specifies the default font mapper behavior. | \ *| OUT_DEVICE_PRECIS | Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name. | \ *| OUT_OUTLINE_PRECIS | Windows NT/ 2000: This value instructs the font mapper to choose from TrueType and other outline-based fonts. | \ *| OUT_RASTER_PRECIS | Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name. | \ *| OUT_TT_ONLY_PRECIS | Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system, the font mapper returns to default behavior. | \ *| OUT_TT_PRECIS | Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name. | \ *P Applications can use the OUT_DEVICE_PRECIS, OUT_RASTER_PRECIS, and OUT_TT_PRECIS values to control \ ** how the font mapper chooses a font when the operating system contains more than one font with a \ ** specified name. For example, if an operating system contains a font named Symbol in raster and TrueType \ ** form, specifying OUT_TT_PRECIS forces the font mapper to choose the TrueType version. Specifying \ ** OUT_TT_ONLY_PRECIS forces the font mapper to choose a TrueType font, even if it must substitute a TrueType \ ** font of another name. to lfOutPrecision ;M :M SetClipPrecision: ( n1 -- ) \ *G Specifies the clipping precision. The clipping precision defines how to clip characters that are partially \ ** outside the clipping region. It can be one or more of the following values. \ *L \ *| CLIP_DEFAULT_PRECIS | Specifies default clipping behavior. | \ *| CLIP_CHARACTER_PRECIS | Not used. | \ *| CLIP_EMBEDDED | You must specify this flag to use an embedded read-only font. | \ *| CLIP_LH_ANGLES | When this value is used, the rotation for all fonts depends on whether the orientation of the coordinate system is left-handed or right-handed. \ *P For more information about the orientation of coordinate systems, see the description of the nOrientation parameter | to lfClipPrecision ;M :M SetQuality: ( n1 -- ) \ *G Specifies the output quality. The output quality defines how carefully the graphics device interface (GDI) must \ ** attempt to match the logical-font attributes to those of an actual physical font. It can be one of the following \ ** values. \ *L \ *| ANTIALIASED_QUALITY | Font is always antialiased if the font supports it and the size of the font is not too small or too large. | \ *| DEFAULT_QUALITY | Appearance of the font does not matter. | \ *| DRAFT_QUALITY | Appearance of the font is less important than when PROOF_QUALITY is used. For GDI raster fonts, scaling is enabled, which means that more font sizes are available, but the quality may be lower. < \ *| NONANTIALIASED_QUALITY | Font is never antialiased. | \ *| PROOF_QUALITY | Character quality of the font is more important than exact matching of the logical-font attributes. | \ *P If neither ANTIALIASED_QUALITY nor NONANTIALIASED_QUALITY is selected, the font is antialiased only if the user chooses \ ** smooth screen fonts in Control Panel. to lfQuality ;M :M SetPitchAndFamily: ( n1 -- ) \ *G Specifies the pitch and family of the font. The two low-order bits specify the pitch of the font and can \ ** be one of the following values. \ *L \ *| DEFAULT_PITCH | \ *| FIXED_PITCH | \ *| VARIABLE_PITCH | \ *P Bits 4 through 7 of the member specify the font family and can be one of the following values. \ *L \ *| FF_DECORATIVE \ *| FF_DONTCARE \ *| FF_MODERN \ *| FF_ROMAN \ *| FF_SCRIPT \ *| FF_SWISS \ *P The proper value can be obtained by using the Boolean OR operator to join one pitch constant with one \ ** family constant. \ *P Font families describe the look of a font in a general way. They are intended for specifying fonts \ ** when the exact typeface desired is not available. The values for font families are as follows. \ *L \ *| FF_DECORATIVE | Novelty fonts. Old English is an example. | \ *| FF_DONTCARE | Don't care or don't know. | \ *| FF_MODERN | Fonts with constant stroke width (monospace), with or without serifs. Monospace fonts are usually modern. Pica, Elite, and CourierNew® are examples. | \ *| FF_ROMAN | Fonts with variable stroke width (proportional) and with serifs. MS® Serif is an example. | \ *| FF_SCRIPT | Fonts designed to look like handwriting. Script and Cursive are examples. | \ *| FF_SWISS | Fonts with variable stroke width (proportional) and without serifs. MS® Sans Serif is an example. | to lfPitchAndFamily ;M :M SetFaceName: ( a1 n1 -- ) \ *G Specifies the typeface name of the font. The length of this string must not exceed 32 characters, including \ ** the null terminator. The EnumFontFamilies function can be used to enumerate the typeface names of all \ ** currently available fonts. If lfFaceName is an empty string, GDI uses the first font that matches the other \ ** specified attributes. lfFaceName LF_FACESIZE erase LF_FACESIZE 1- min lfFaceName swap move ;M :M GetHeight: ( -- n1 ) \ *G Fet the height, in logical units, of the font's character cell or character lfHeight ;M :M GetWidth: ( -- n1 ) \ *G Get the average width, in logical units, of characters in the font lfWidth ;M :M GetEscapement: ( -- n1 ) \ *G Get the angle, in tenths of degrees, between the escapement vector and the x-axis of \ ** the device. The escapement vector is parallel to the base line of a row of text. lfEscapement ;M :M GetOrientation: ( -- n1 ) \ *G Get the angle, in tenths of degrees, between each character's base line and the x-axis of the device. lfOrientation ;M :M GetWeight: ( -- n1 ) \ *G Get the weight of the font lfWeight ;M :M GetItalic: ( -- f1 ) \ *G TRUE if it's an italic font. lfItalic ;M :M GetUnderline: ( -- f1 ) \ *G TRUE if it's a underlined font. lfUnderline ;M :M GetStrikeOut: ( -- f1 ) \ *G TRUE if it's a strikeout font. lfStrikeOut ;M :M GetCharSet: ( -- n1 ) \ *G Get the character set. lfCharSet ;M :M GetOutPrecision: ( -- n1 ) \ *G Get the output precision. lfOutPrecision ;M :M GetClipPrecision: ( -- n1 ) \ *G Get the clipping precision lfClipPrecision ;M :M GetQuality: ( -- n1 ) \ *G Get the output quality. lfQuality ;M :M GetPitchAndFamily: ( -- n1 ) \ *G Get the pitch and family of the font. lfPitchAndFamily ;M :M GetFaceName: ( -- a1 n1 ) \ *G Get the typeface name of the font. lfFaceName LF_FACESIZE 2dup 0 scan nip - ;M :M GetLogfont: ( -- n1 ) \ *G Get the address of the LOGFONT structure LOGFONT ;M :M Create: ( -- f ) \ *G Create a new font. If the current font handle is valid, the font will be destroyed. LOGFONT Call CreateFontIndirect SetHandle: super Valid?: super ;M : Choose ( hWnd -- f ) to hwndOwner &CHOOSEFONT call ChooseFont if Create: self else false then ; :M Choose: ( hWnd -- f ) \ *G Open a dialog to choose a Screen font. If the dialog is closed with OK, the font \ ** will be created. NULL to hDC [ CF_SCREENFONTS CF_INITTOLOGFONTSTRUCT or ] literal to Flags Choose ;M :M ChoosePrinter: ( hWnd hDC -- f ) \ *G Open a dialog to choose a Printer font for the PrinterDC hDC. If the dialog is closed \ ** with OK, the fontwill be created. GetGdiObjectHandle to hDC [ CF_PRINTERFONTS CF_INITTOLOGFONTSTRUCT or ] literal to Flags Choose ;M ;Class \ *G End of gdiFont class module \ *Z --- NEW FILE: gdiDC.f --- \ *D doc\classes\ \ *! gdiDC \ *T gdiDC -- Base device context class \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch \ *S Glossary \ Missing: - WorldTransform support cr .( Loading GDI class library - Device context...) needs gdiBase.f internal external 8 value CHAR-WIDTH \ Width of each character in pixels 14 value CHAR-HEIGHT \ Height of each character in pixels [...1245 lines suppressed...] \ ** PatBlt \n \ ** AngleArc \n \ ** SetMiterLimit \n \ ** GetMiterLimit \n \ ---------------------------------------------------------------------- \ ---------------------------------------------------------------------- :M ClassInit: ( -- ) ClassInit: super 8 to tabwidth DefaultTabs: self ;M ;class \ *G End of gdiDC class module \ *Z --- NEW FILE: gdiWindowDc.f --- \ *D doc\classes\ \ *! gdiWindowDc \ *T gdiWindowDc -- Window device context class \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch \ *S Glossary cr .( Loading GDI class library - Window device context...) needs gdiDC.f internal external \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ :class gdiWindowDC <super gdiDC \ *G Window device context class int hWnd \ handle of the window in which this device context is used :M ClassInit: ( -- ) ClassInit: super 0 to hWnd ;M :M Release: ( -- ) \ *G The Release: method releases a device context (DC), freeing it \ ** for use by other applications. The effect of the ReleaseDC function depends \ ** on the type of DC. It frees only common and window DCs. It has no effect on \ ** class or private DCs. hWnd ?dup if hObject swap call ReleaseDC ?win-error 0 to hWnd then ;M :M Destroy: ( -- ) Release: self Destroy: super ;M : SetWindow ( hWnd -- f ) Release: self dup to hWnd call IsWindow ; : SetHandle ( hDC -- f ) to hObject Valid?: super ; :M GetDC: ( hWnd -- f ) \ *G The GetDC method retrieves a handle to a display device context \ ** for the client area of a specified window. SetWindow if hWnd call GetDC else NULL then SetHandle ;M :M GetDCEx: ( hrgnClip flags hWnd -- f ) \ *G The GetDCEx method retrieves a handle to a display device context \ ** for the client area of a specified window or for the entire screen. \ ** You can use the returned handle in subsequent GDI functions to draw in the DC. \ *P This function is an extension to the GetDC function, which gives an application \ ** more control over how and whether clipping occurs in the client area. \ *P \i hrgnClip \d Specifies a clipping region that may be combined with the visible region \ ** of the DC. If the value of flags is DCX_INTERSECTRGN or DCX_EXCLUDERGN, then the \ ** operating system assumes ownership of the region and will automatically delete it \ ** when it is no longer needed. In this case, applications should not use the region \ ** not even delete it after a successful call to GetDCEx. \ *P \i flags \d Specifies how the DC is created. This parameter can be one or more of the \ ** following values. \ *P \b DCX_WINDOW \d Returns a DC that corresponds to the window rectangle rather \ ** than the client rectangle. \ *P \b DCX_CACHE \d Returns a DC from the cache, rather than the OWNDC or CLASSDC \ ** window. Essentially overrides CS_OWNDC and CS_CLASSDC. \ *P \b DCX_PARENTCLIP \d Uses the visible region of the parent window. The parent's \ ** WS_CLIPCHILDREN and CS_PARENTDC style bits are ignored. The \ ** origin is set to the upper-left corner of the window identified \ ** by hWnd. \ *P \b DCX_CLIPSIBLINGS \d Excludes the visible regions of all sibling windows above the \ ** window identified by hWnd. \ *P \b DCX_CLIPCHILDREN \d Excludes the visible regions of all child windows below the \ ** window identified by hWnd. \ *P \b DCX_NORESETATTRS \d Does not reset the attributes of this DC to the default attributes \ ** when this DC is released. \ *P \b DCX_LOCKWINDOWUPDATE \d Allows drawing even if there is a LockWindowUpdate call in effect \ ** that would otherwise exclude this window. Used for drawing during \ ** tracking. \ *P \b DCX_EXCLUDERGN \d The clipping region identified by hrgnClip is excluded from the \ ** visible region of the returned DC. \ *P \b DCX_INTERSECTRGN \d The clipping region identified by hrgnClip is intersected with the \ ** visible region of the returned DC. \ *P \b DCX_VALIDATE \d When specified with DCX_INTERSECTUPDATE, causes the DC to be \ ** completely validated. Using this function with both DCX_INTERSECTUPDATE \ ** and DCX_VALIDATE is identical to using the BeginPaint function. SetWindow if swap hWnd call GetDCEx else NULL then SetHandle ;M :M GetWindowDC: ( hWnd -- f ) \ *G The GetWindowDC method retrieves the device context (DC) for the entire \ ** window, including title bar, menus, and scroll bars. A window device \ ** context permits painting anywhere in a window, because the origin of \ ** the device context is the upper-left corner of the window instead of \ ** the client area. SetWindow if hWnd call GetWindowDC else NULL then SetHandle ;M :M GetDCOrg: ( -- x y ) \ *G The GetDCOrgEx function retrieves the final translation origin for a specified device \ ** context (DC). The final translation origin specifies an offset that the system uses to \ ** translate device coordinates into client coordinates (for coordinates in an application's \ ** window). Addr: POINT hObject call GetDCOrgEx ?win-error GetX: POINT GetY: POINT ;M ;class \ *G End of gdiWindowDC class module \ *Z Index: gdiStruct.f =================================================================== RCS file: /cvsroot/win32forth/win32forth-stc/src/gdi/gdiStruct.f,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gdiStruct.f 28 Apr 2007 10:18:57 -0000 1.1 --- gdiStruct.f 30 Apr 2007 07:49:27 -0000 1.2 *************** *** 8,11 **** --- 8,13 ---- cr .( Loading GDI class library - Structs...) + needs class + Library COMDLG32.DLL --- NEW FILE: gdiMetafileDc.f --- \ *D doc\classes\ \ *! gdiMetafileDC \ *T gdiMetafileDC -- Metafile device context class \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch \ *S Glossary cr .( Loading GDI class library - Metafile device context...) needs gdiDC.f needs gdiMetafile.f internal external \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ :class gdiMetafileDC <super gdiDC \ *G Metafile device context class RECTANGLE MetaRect gdiMetafile Metafile :M SetRect: ( left top right bottom -- ) \ *G Specify the dimensions (in .01-millimeter units) of the picture to be \ ** stored in the enhanced metafile. SetRect: MetaRect ;M :M ClassInit: ( -- ) ClassInit: super 0 0 10000 10000 SetRect: self ;M :M CalcMetaRect: { left top right bottom hDC \ iWidthMM iHeightMM iWidthPels iHeightPels -- } \ *G Calc the dimensions (in .01-millimeter units) of the picture to be \ ** stored in the enhanced metafile. hDC GetGdiObjectHandle to hDC \ Determine the picture frame dimensions. \ iWidthMM is the display width in millimeters. \ iHeightMM is the display height in millimeters. \ iWidthPels is the display width in pixels. \ iHeightPels is the display height in pixels HORZSIZE hDC call GetDeviceCaps to iWidthMM HORZRES hDC call GetDeviceCaps to iWidthPels VERTSIZE hDC call GetDeviceCaps to iHeightMM VERTRES hDC call GetDeviceCaps to iHeightPels \ Convert client coordinates to .01-mm units. \ Use iWidthMM, iWidthPels, iHeightMM, and iHeightPels to \ determine the number of .01-millimeter units per pixel in \ the x- and y-directions. left iWidthMM * 100 * iWidthPels / top iHeightMM * 100 * iHeightPels / right iWidthMM * 100 * iWidthPels / bottom iHeightMM * 100 * iHeightPels / SetRect: MetaRect ;M :M StartRecording: ( hRefDC -- f ) \ *G Start recording of a Metafile GetGdiObjectHandle >r 0 \ lpDescription Addrof: MetaRect \ bounding rectangle 0 \ lpstrFileName r> \ hRefDC call CreateEnhMetaFile dup SetHandle: self 0<> ;M :M StopRecording: ( -- f ) \ *G Stop recording of a Metafile hObject ?dup if call CloseEnhMetaFile dup SetHandle: Metafile 0<> 0 SetHandle: self else false then ;M :M Load: ( addr len -- f ) \ *G Load a metafile from a file StopRecording: self drop Load: Metafile ;M :M Save: ( addr len -- f ) \ *G Save the metafile in a file StopRecording: self drop Save: Metafile ;M :M Destroy: ( -- ) \ *G Destroy the metafile. StopRecording: self drop Destroy: Metafile ;M :M Draw: ( left top right bottom hDestDC -- ) \ *G Play the metafile in a rectangle PlayInRect: Metafile ;M :M GetMetafile: ( -- MetafileObject ) \ *G Return the address of the metafile object used by this class Metafile ;M ;class \ *G End of gdiMetafileDC class module \ *Z --- NEW FILE: gdiBrush.f --- \ *D doc\classes\ \ *! gdiBrush \ *T GdiBrush -- Classes for GDI Brushes. \ *Q Version 1.0 \ ** This GDI class library was written and placed in the Public Domain \ ** in 2005 by Dirk Busch cr .( Loading GDI class library - Brush...) needs gdiBase.f internal external \ ---------------------------------------------------------------------- \ ---------------------------------------------------------------------- internal \ *W <a name="gdiBrush"></a> \ *S gdiBrush class :class gdiBrush <super gdiObject \ *G Base class for all brush objects. \n \ ** This is an internal class of the GDI Class library. Don't use it yourself. gdiPoint origin :M ClassInit: ( -- ) ClassInit: super ;M :M SetOrigin: { xOrg yOrg hdc -- } \ *G Set the brush origin that GDI assigns to the next brush an application selects \ ** into the specified device context. \n \ ** Note: hdc can be the address of a gdiDC class instance or a DC handle. \n \ ** A brush is a bitmap that the system uses to paint the interiors of filled shapes. \n \ ** 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. \n \ ** 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. \n \ ** An application should call SetOrigin: after setting the bitmap stretching mode to \ ** HALFTONE by using SetStretchBltMode. This must be done to avoid brush misalignment. \n \ ** 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. \n \ ** 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. \n NULL yOrg xOrg hdc GetGdiObjectHandle call SetBrushOrgEx ?win-error ;M :M GetOrigin: ( hdc -- xOrg yOrg ) \ *G Get the current brush origin for the specified device context. Addr: origin call GetBrushOrgEx 0= if -1 -1 \ error else GetX: origin GetY: origin then ;M :M Create: ( lplb -- f ) \ *G 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. call CreateBrushIndirect SetHandle: super Valid?: super ;M ;class \ *G End of gdiBrush class external \ ---------------------------------------------------------------------- \ ---------------------------------------------------------------------- \ *W <a name="gdiSolidBrush"></a> \ *S gdiSolidBrush class :class gdiSolidBrush <super gdiBrush \ *G Solid brush class \ Color of the brush. gdiCOLORREF Color :M ClassInit: ( -- ) ClassInit: super ;M :M SetRValue: ( r -- ) \ *G Set the red component of the brush color. SetRValue: Color ;M :M SetGValue: ( g -- ) \ *G Set the green component of the brush color. SetGValue: Color ;M :M SetBValue: ( b -- ) \ *G Set the blue component of the brush color. SetBValue: Color ;M :M SetRGB: ( r g b -- ) \ *G Set the red, green and blue component of the brush color. SetRGB: Color ;M :M SetColor: ( colorref -- ) \ *G Set color of the brush. SetColor: Color ;M :M SetSysColor: ( n -- ) \ *G Set the color of the brush to a system color. SetSysColor: Color ;M :M ChooseColor: ( hWnd -- f ) \ *G Open a dialog to choose the color of the brush. Choose: Color ;M :M GetRValue: ( -- r ) \ *G Get the red component of the brush color. GetRValue: Color ;M :M GetGValue: ( -- g ) \ *G Get the green component of the brush color. GetGValue: Color ;M :M GetBValue: ( -- b ) \ *G Get the blue component of the brush color. GetBValue: Color ;M :M GetColor: ( -- colorref ) \ *G Get the color of the brush as a windows COLORREF value. GetColor: Color ;M :M Create: ( -- f ) \ *G Create the brush with the current color. GetColor: color call CreateSolidBrush SetHandle: super Valid?: super ;M ;class \ *G End of gdiSolidBrush class \ ---------------------------------------------------------------------- \ ---------------------------------------------------------------------- \ *W <a name="gdiHatchBrush"></a> \ *S gdiHatchBrush class :class gdiHatchBrush <super gdiSolidBrush \ *G Hatch brush class \ 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 int Style :M ClassInit: ( -- ) ClassInit: super HS_BDIAGONAL to style ;M :M SetStyle: ( style -- ) \ *G Set the style of the brush. Possible values are: \ *L \ *| 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 | to style ;M :M GetStyle: ( -- style ) \ *G Get the style of the brush. Possible return values are: \ *L \ *| 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 | style ;M :M Create: ( -- f ) \ *G Create the brush with the current style and color. GetColor: color Style call CreateHatchBrush SetHandle: super Valid?: super ;M ;class \ *G End of gdiHatchBrush class \ ---------------------------------------------------------------------- \ ---------------------------------------------------------------------- \ *W <a name="gdiPatternBrush"></a> \ *S gdiPatternBrush class :class gdiPatternBrush <super gdiBrush \ *G Pattern brush class. \n \ Bitmap of the brush. int Bitmap :M ClassInit: ( -- ) ClassInit: super 0 to Bitmap ;M :M SetBitmap: ( Bitmap -- ) \ *G Set the Bitmap for the PatternBrush. The Bitmap can be a DIB section bitmap, \ ** which is created by the CreateDIBSection function. to Bitmap ;M :M GetBitmap: ( -- Bitmap ) \ *G Get the Bitmap for the PatternBrush. Bitmap ;M :M Create: ( -- f ) \ *G Creates a logical brush with the specified bitmap pattern. Bitmap ?dup if call CreatePatternBrush SetHandle: super then Valid?: super ;M ;class \ *G End of gdiPatternBrush class \ ---------------------------------------------------------------------- \ DIBPattern brush class \ ---------------------------------------------------------------------- \ *W <a name="gdiDIBPatternBrush"></a> \ *S gdiDIBPatternBrush class :class gdiDIBPatternBrush <super gdiBrush \ *G DIB Pattern brush class :M ClassInit: ( -- ) ClassInit: super ;M :M Create: ( lpPackedDIB iUsage -- f ) \ *G The Create function creates a logical brush that has the pattern specified \ ** by the device-independent bitmap (DIB). \n \ ** lpPackedDIB Pointer to a packed DIB consisting of a BITMAPINFO structure immediately \ ** followed by an array of bytes defining the pixels of the bitmap. \n \ ** 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. \n \ ** Windows NT/ 2000 and Windows 98: Brushes can be created from bitmaps or DIBs \ ** larger than 8 by 8 pixels. \n \ ** 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. \ *L \ *| 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. | call CreateDIBPatternBrushPt SetHandle: super Valid?: super ;M ;class \ *G End of gdiDIBPatternBrush class module \ *Z |