Contents Up Previous Next

wxBitmap is-a wxObject

A bitmap is a rectangular array of pixels, possibly in colour. A bitmap can be created in memory, or loaded from an XBM file under X, or BMP file under Windows.

A bitmap can be drawn on a canvas by selecting it into a wxMemoryDC object and using dc-blit. Bitmaps can also be used to create buttons; see button-create-from-bitmap.

wxBitmap bitmap-type
wxBitmap depth
wxBitmap filename
wxBitmap height
wxBitmap width
wxBitmap create


wxBitmap bitmap-type

string bitmap-type

Indicates the type of bitmap file the bitmap is being loaded from.

May be one of:


wxBitmap depth

long depth

The depth of the bitmap (number of bits per pixel). Optionally intialize this if creating an in-memory bitmap; omitting it makes the depth default to the current display depth of the screen.


wxBitmap filename

string filename

If this slot is initialized on creation, the wxBitmap will be created from the given file. The slot bitmap-type must also be initialized, to indicate the type of bitmap file.

Defaults to the empty string.


wxBitmap height

long height

The height of the bitmap. Intialize this if creating an in-memory bitmap.


wxBitmap width

long width

The width of the bitmap. Intialize this if creating an in-memory bitmap.


wxBitmap create

void ( create)

Creates a bitmap in memory, either blank or from an existing bitmap file. The programmer can draw into the bitmap by selecting it into a memory device context, for later drawing on an output device context such as a canvas device context.

The method of bitmap construction depends on the slots that are initialized when the instance is created. Here are some examples:

  ; Load from a BMP file
  (make-instance [my-bitmap] of wxBitmap
    (filename "aiai.bmp") (bitmap-type "wxBITMAP_TYPE_BMP"))
    
  ; Create a 'blank' bitmap
  (make-instance [my-bitmap] of wxBitmap
     (width 100) (height 100))