Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXBitmap Class Reference

A Bitmap is a rectangular array of pixels. More...

#include <FXBitmap.h>

Inheritance diagram for FX::FXBitmap:

FX::FXDrawable FX::FXId FX::FXObject List of all members.

Public Member Functions

 FXBitmap (FXApp *a, const void *pix=NULL, FXuint opts=0, FXint w=1, FXint h=1)
FXuchar * getData () const
FXuint getOptions () const
void setOptions (FXuint opts)
FXbool getPixel (FXint x, FXint y) const
void setPixel (FXint x, FXint y, FXbool color)
virtual void create ()
virtual void detach ()
virtual void destroy ()
virtual void render ()
virtual void release ()
virtual void resize (FXint w, FXint h)
virtual void scale (FXint w, FXint h)
virtual void mirror (FXbool horizontal, FXbool vertical)
virtual void rotate (FXint degrees)
virtual void crop (FXint x, FXint y, FXint w, FXint h, FXbool color=0)
virtual void fill (FXbool color)
virtual void save (FXStream &store) const
virtual void load (FXStream &store)
virtual FXbool savePixels (FXStream &store) const
virtual FXbool loadPixels (FXStream &store)
virtual ~FXBitmap ()

Detailed Description

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 as it lives in the process of the X Server or GDI. 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 at bit 0 on the left.

See also:


Constructor & Destructor Documentation

FX::FXBitmap::FXBitmap FXApp a,
const void *  pix = NULL,
FXuint  opts = 0,
FXint  w = 1,
FXint  h = 1
 

Create a bitmap.

If a client-side pixel buffer has been specified, the bitmap does not own the pixel buffer unless the BITMAP_OWNED flag is set. If the BITMAP_OWNED flag is set but a NULL pixel buffer is passed, 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.

virtual FX::FXBitmap::~FXBitmap  )  [virtual]
 

Cleanup.


Member Function Documentation

FXuchar* FX::FXBitmap::getData  )  const [inline]
 

To get to the pixel data.

FXuint FX::FXBitmap::getOptions  )  const [inline]
 

To get to the option flags.

void FX::FXBitmap::setOptions FXuint  opts  ) 
 

Change options.

FXbool FX::FXBitmap::getPixel FXint  x,
FXint  y
const [inline]
 

Get pixel at x,y.

void FX::FXBitmap::setPixel FXint  x,
FXint  y,
FXbool  color
[inline]
 

Change pixel at x,y.

virtual void FX::FXBitmap::create  )  [virtual]
 

Create the server side pixmap, then call render() to fill it with the pixel data from the client-side buffer.

After the server-side image has been created, the client-side pixel buffer will be deleted unless BITMAP_KEEP has been specified. If the pixel buffer is not owned, i.e. the flag BITMAP_OWNED is not set, the pixel buffer will not be deleted.

Reimplemented from FX::FXId.

virtual void FX::FXBitmap::detach  )  [virtual]
 

Detach the server side pixmap from the Bitmap.

Afterwards, the Bitmap is left as if it never had a server-side resources.

Reimplemented from FX::FXId.

virtual void FX::FXBitmap::destroy  )  [virtual]
 

Destroy the server-side pixmap.

The client-side pixel buffer is not affected.

Reimplemented from FX::FXId.

virtual void FX::FXBitmap::render  )  [virtual]
 

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

virtual void FX::FXBitmap::release  )  [virtual]
 

Release the client-side pixels buffer, free it if it was owned.

If it is not owned, the image just forgets about the buffer.

virtual void FX::FXBitmap::resize FXint  w,
FXint  h
[virtual]
 

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.

Reimplemented from FX::FXDrawable.

virtual void FX::FXBitmap::scale FXint  w,
FXint  h
[virtual]
 

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

virtual void FX::FXBitmap::mirror FXbool  horizontal,
FXbool  vertical
[virtual]
 

Mirror bitmap horizontally and/or vertically.

virtual void FX::FXBitmap::rotate FXint  degrees  )  [virtual]
 

Rotate bitmap by degrees ccw.

virtual void FX::FXBitmap::crop FXint  x,
FXint  y,
FXint  w,
FXint  h,
FXbool  color = 0
[virtual]
 

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.

virtual void FX::FXBitmap::fill FXbool  color  )  [virtual]
 

Fill bitmap with uniform value.

virtual void FX::FXBitmap::save FXStream store  )  const [virtual]
 

Save object to stream.

Reimplemented from FX::FXDrawable.

virtual void FX::FXBitmap::load FXStream store  )  [virtual]
 

Load object from stream.

Reimplemented from FX::FXDrawable.

virtual FXbool FX::FXBitmap::savePixels FXStream store  )  const [virtual]
 

Save pixel data only.

virtual FXbool FX::FXBitmap::loadPixels FXStream store  )  [virtual]
 

Load pixel data only.

Copyright © 1997-2005 Jeroen van der Zijp