Return to Index
created by gbSnippets
'A PowerBASIC programmer has several options when it comes to loading,
'creating, editing, and saving bitmap files and bitmap resources.
'1. GRAPHIC Statements
' The PowerBASIC GRAPHIC RENDER and GRAPHIC BITMAP LOAD statements can
' load a bitmap from a file or to a visible control or a memory bitmap,
' The PowerBASIC GRAPHIC RENDER, GRAPHIC IMAGELIST, and GRAPHIC BITMAP LOAD
' statements can load a bitmap resource to a visible control (RENDER), a
' memory bitmaps (BITMAP LOAD), or an imagelist (IMAGELIST). Of course,
' once in an imagelist or memory bitmap, the image can then be displayed
' in visible controls.
' There are various GRAPHIC statements which allow direct manipulation of
' images while in on of the graphic targets. These PowerBASIC GRAPHIC
' statements provide many (but not all) of the capabilities available for
' working with bitmaps using the GDI API.
' The GRAPHIC GET/SET BITS statements provides access to the individual
' pixel data in a bitmap, making it possible to manipulate the color
' data in code.
' The GRAPHIC SAVE statement will save the content of a graphic target
' to a file (*.bmp).
'2. API Statements
' The LoadImage() API can load an image from a file or from a resource, creating
' a handle to a memory bitmap. The memory bitmap can then be selected into a
' device context of a visible window, thus displaying the bitmap. The bitmap
' may be edited using the various GDI API, which operate on a device context.
' However, the LoadImage() API creates a DDB image, for which there is no
' save-to-file API. Nor does the DDB image provide direct access to pixel data.
' But once the DDB is selected into an API, its pixel data can be retrieved
' as a DIB Section using GetDIBits. A DIB Section provides access to pixel
' data for editing in code and can be saved as a *.bmp file.
' Alternately, Bitblt can be used to copy the bitmap from the device context to
' a graphic control device context, from which it can be saved with GRAPHIC SAVE.
' DCs generated by API are compatible with the DC provided by Graphic Get DC
'3. GET/PUT Statements
' Knowing the details of the bitmap file format allows a bitmap to be
' read/written by using simple GET/PUT statements. The data structure
' consists of two headers who members can be assigned values in code,
' plus an array of pixel data which may also be manipulated in code.
'Beyond these basic approaches, there several other options available to
'a PowerBASIC programmer. These are not covered in the 'BMP Tutor' snippets.
'7. Freeware Graphic Libraries (i.e., FreeImage)
'8. Commercial Graphic Libraries
created by gbSnippets