FX::FXBitmap Class Reference

#include <FXBitmap.h>

Inheritance diagram for FX::FXBitmap:

Inheritance graph
[legend]

List of all members.


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.

Public Member Functions

 FXBitmap (FXApp *a, const void *pix=NULL, FXuint opts=0, FXint w=1, FXint h=1)
void setOptions (FXuint opts)
FXuint getOptions () const
virtual void setData (FXuchar *pix, FXuint opts=0)
virtual void setData (FXuchar *pix, FXuint opts, FXint w, FXint h)
FXuchar * getData () const
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 restore ()
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 bool savePixels (FXStream &store) const
virtual bool loadPixels (FXStream &store)
virtual ~FXBitmap ()
FXint getWidth () const
FXint getHeight () const
FXVisualgetVisual () const
void setVisual (FXVisual *vis)
FXAppgetApp () const
FXEventLoopgetEventLoop () const
FXID id () const
void setUserData (void *ptr)
void * getUserData () const
virtual long onDefault (FXObject *, FXSelector, void *)
const FXchar * getClassName () const
bool isMemberOf (const FXMetaClass *metaclass) const
virtual long tryHandle (FXObject *sender, FXSelector sel, void *ptr)
QTransString tr (const char *text, const char *hint=0)
virtual void * getPythonObject () const
virtual void decouplePythonObject () const

Protected Attributes

FXuchar * data
FXint bytewidth
FXuint options
FXVisualvisual
FXint width
FXint height
FXID xid

Friends

class FXDC
class FXDCWindow

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

void FX::FXBitmap::setOptions ( FXuint  opts  ) 

Change options.

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

To get to the option flags.

virtual void FX::FXBitmap::setData ( FXuchar *  pix,
FXuint  opts = 0 
) [virtual]

Populate the bitmap with new pixel data of the same size; it will assume ownership of the pixel data if image BITMAP_OWNED option is passed. The server-side representation of the image, if it exists, is not updated. This can be done by calling render().

virtual void FX::FXBitmap::setData ( FXuchar *  pix,
FXuint  opts,
FXint  w,
FXint  h 
) [virtual]

Populate the bitmap with new pixel data of a new size; it will assume ownership of the pixel data if image BITMAP_OWNED option is passed. The size of the server- side representation of the image, if it exists, is adjusted but the contents are not updated yet. This can be done by calling render().

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

To get to the pixel data.

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::restore (  )  [virtual]

Retrieves pixels from the server-side bitmap.

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 bool FX::FXBitmap::savePixels ( FXStream store  )  const [virtual]

Save pixel data only.

virtual bool FX::FXBitmap::loadPixels ( FXStream store  )  [virtual]

Load pixel data only.

FXint FX::FXDrawable::getWidth (  )  const [inline, inherited]

Width of drawable.

FXint FX::FXDrawable::getHeight (  )  const [inline, inherited]

Height of drawable.

FXVisual* FX::FXDrawable::getVisual (  )  const [inline, inherited]

Get the visual.

void FX::FXDrawable::setVisual ( FXVisual vis  )  [inherited]

Change visual.

FXApp* FX::FXId::getApp (  )  const [inline, inherited]

Get application.

FXEventLoop* FX::FXId::getEventLoop (  )  const [inline, inherited]

Get event loop which owns this.

FXID FX::FXId::id (  )  const [inline, inherited]

Get XID handle.

void FX::FXId::setUserData ( void *  ptr  )  [inline, inherited]

Set user data pointer.

void* FX::FXId::getUserData (  )  const [inline, inherited]

Get user data pointer.

virtual long FX::FXObject::onDefault ( FXObject ,
FXSelector  ,
void *   
) [virtual, inherited]

Called for unhandled messages.

Reimplemented in FX::FXDelegator, FX::FXGLViewer, FX::FXMDIChild, and FX::FXMDIClient.

const FXchar* FX::FXObject::getClassName (  )  const [inherited]

Get class name of some object.

bool FX::FXObject::isMemberOf ( const FXMetaClass metaclass  )  const [inherited]

Check if object is member of metaclass.

virtual long FX::FXObject::tryHandle ( FXObject sender,
FXSelector  sel,
void *  ptr 
) [virtual, inherited]

Try handle message safely.

QTransString FX::FXObject::tr ( const char *  text,
const char *  hint = 0 
) [inherited]

Returns a human translated version of the text to the locale language (warning: uses a virtual method call, so can't use before construction)

virtual void* FX::FXObject::getPythonObject (  )  const [inline, virtual, inherited]

Returns the python object representing this instance (if created in python).

virtual void FX::FXObject::decouplePythonObject (  )  const [inline, virtual, inherited]

Causes decoupling of python object from this object (deletes self).


The documentation for this class was generated from the following file:

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 21:56:51 2008 for TnFOX by doxygen v1.5.6