Class Fox::FXBitmap
In: rdoc-sources/FXBitmap.rb
Parent: FXDrawable

A bitmap is a rectangular array of pixels. It supports two representations of these pixels: a client-side pixel buffer, and a server-side pixmap which is stored in an organization directly compatible with the screen, for fast drawing onto the device. The server-side representation is not directly accessible from the current process at it lives in the process of the X server or GDI (on Microsoft Windows). The client-side pixel array is of size height x (width+7)/8 bytes; in other words, 8 pixels packed into a single byte, starting with bit zero on the left.

Image rendering hints

BITMAP_KEEP:Keep pixel data in client
BITMAP_OWNED:Pixel data is owned by image
BITMAP_SHMI:Using shared memory image
BITMAP_SHMP:Using shared memory pixmap

Methods

crop   fill   getData   getPixel   loadPixels   mirror   new   options   options=   release   render   resize   restore   rotate   savePixels   scale   setData   setData   setPixel  

External Aliases

getData -> data

Public Class methods

Return an initialized FXBitmap instance. If a client-side pixel buffer (the pixels argument) has been specified, the bitmap does not own that pixel buffer unless the BITMAP_OWNED flag is set. If the BITMAP_OWNED flag is set, but a nil value for pixels is passed in, a pixel buffer will be automatically created and will be owned by the bitmap. The flags BITMAP_SHMI and BITMAP_SHMP may be specified for large bitmaps to instruct FXBitmap#render to use shared memory to communicate with the server.

Public Instance methods

Crop bitmap to given rectangle; this calls resize to adjust the client and server side representations. The new bitmap may be smaller or larger than the old one; blank areas are filled with color. There must be at least one pixel of overlap between the old and the new bitmap.

Fill bitmap with uniform value

Return the pixel data.

Get pixel state (either true or false) at (x, y)

Load pixel data from a stream

Mirror the bitmap horizontally and/or vertically

Return the option flags.

Release the client-side pixels buffer and free it if it was owned. If it is not owned, the image just forgets about the buffer.

Render the server-side representation of the bitmap from the client-side pixels.

Resize both client-side and server-side representations (if any) to the given width and height. The new representations typically contain garbage after this operation and need to be re-filled.

Retrieve pixels from the server-side bitmap.

Rotate bitmap by degrees degrees (counter-clockwise)

Save pixel data only

Rescale pixels image to the specified width and height; this calls resize to adjust the client and server side representations.

Populate the bitmap with new pixel data of the same size; it will assume ownership of the pixel data if the BITMAP_OWNED option is passed in the opts. The server-side representation of the image, if it exists, is not updated; to update ther server-side representation, call render.

Populate the bitmap with new pixel data of a new size; it will assume ownership of the pixel data if the BITMAP_OWNED option is passed in the opts. The size of the server- side representation of the image, if it exists, is adjusted but the contents are not updated; to update the server-side representation, call render.

Change pixel at (x, y), where color is either true or false.

[Validate]