Class: Fox::FXBitmap

FXDrawable show all
Defined in:


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


Keep pixel data in client


Pixel data is owned by image


Using shared memory image


Using shared memory pixmap

Instance Attribute Summary

Attributes inherited from FXDrawable

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Instance Method Summary collapse

Methods inherited from FXId

#create, #created?, #destroy, #detach, #runOnUiThread

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(app, pixels = nil, opts = 0, width = 1, height = 1) ⇒ FXBitmap

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 #render to use shared memory to communicate with the server.

# File 'rdoc-sources/FXBitmap.rb', line 33

def initialize(app, pixels=nil, opts=0, width=1, height=1) # :yields: theBitmap

Instance Method Details

#crop(x, y, w, h, color = false) ⇒ Object

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.

# File 'rdoc-sources/FXBitmap.rb', line 110

def crop(x, y, w, h, color=false); end


# File 'rdoc-sources/FXBitmap.rb', line 21

alias data getData

#fill(color) ⇒ Object

Fill bitmap with uniform value

# File 'rdoc-sources/FXBitmap.rb', line 113

def fill(color); end


Return the pixel data.

# File 'rdoc-sources/FXBitmap.rb', line 53

def getData(); end

#getPixel(x, y) ⇒ Object

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

# File 'rdoc-sources/FXBitmap.rb', line 87

def getPixel(x, y) ; end

#loadPixels(stream) ⇒ Object

Load pixel data from a stream

# File 'rdoc-sources/FXBitmap.rb', line 84

def loadPixels(stream); end

#mirror(horizontal, vertical) ⇒ Object

Mirror the bitmap horizontally and/or vertically

# File 'rdoc-sources/FXBitmap.rb', line 99

def mirror(horizontal, vertical); end


Return the option flags.

# File 'rdoc-sources/FXBitmap.rb', line 56

def options; end

#options=(opts) ⇒ Object

Set the options.

# File 'rdoc-sources/FXBitmap.rb', line 59

def options=(opts); end


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.

# File 'rdoc-sources/FXBitmap.rb', line 71

def release(); end


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

# File 'rdoc-sources/FXBitmap.rb', line 65

def render() ; end

#resize(w, h) ⇒ Object

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.

# File 'rdoc-sources/FXBitmap.rb', line 78

def resize(w, h); end


Retrieve pixels from the server-side bitmap.

# File 'rdoc-sources/FXBitmap.rb', line 62

def restore; end

#rotate(degrees) ⇒ Object

Rotate bitmap by degrees degrees (counter-clockwise)

# File 'rdoc-sources/FXBitmap.rb', line 102

def rotate(degrees); end

#savePixels(stream) ⇒ Object

Save pixel data only

# File 'rdoc-sources/FXBitmap.rb', line 81

def savePixels(stream); end

#scale(w, h) ⇒ Object

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

# File 'rdoc-sources/FXBitmap.rb', line 96

def scale(w, h); end

#setData(pix, opts, w, h) ⇒ Object

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.

# File 'rdoc-sources/FXBitmap.rb', line 42

def setData(pix, opts=0); end

#setPixel(x, y, color) ⇒ Object

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

# File 'rdoc-sources/FXBitmap.rb', line 90

def setPixel(x, y, color) ; end