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

FX::FXImage Class Reference

An Image is a rectangular array of pixels. More...

#include <FXImage.h>

Inheritance diagram for FX::FXImage:

FX::FXDrawable FX::FXId FX::FXObject FX::FXBMPImage FX::FXGIFImage FX::FXICOImage FX::FXIcon FX::FXJPGImage FX::FXPCXImage FX::FXPNGImage FX::FXPPMImage FX::FXRGBImage FX::FXTGAImage FX::FXTIFImage FX::FXXBMImage FX::FXXPMImage List of all members.

Public Member Functions

 FXImage (FXApp *a, const FXColor *pix=NULL, FXuint opts=0, FXint w=1, FXint h=1)
FXColor * getData () const
FXuint getOptions () const
void setOptions (FXuint opts)
FXColor getPixel (FXint x, FXint y) const
void setPixel (FXint x, FXint y, FXColor color)
FXbool hasAlpha () const
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, FXint quality=0)
virtual void mirror (FXbool horizontal, FXbool vertical)
virtual void rotate (FXint degrees)
virtual void crop (FXint x, FXint y, FXint w, FXint h)
virtual void fill (FXColor color)
virtual void fade (FXColor color, FXint factor=255)
virtual void xshear (FXint shear, FXColor clr=0)
virtual void yshear (FXint shear, FXColor clr=0)
virtual void hgradient (FXColor left, FXColor right)
virtual void vgradient (FXColor top, FXColor bottom)
virtual void gradient (FXColor topleft, FXColor topright, FXColor bottomleft, FXColor bottomright)
virtual void blend (FXColor color)
virtual void save (FXStream &store) const
virtual void load (FXStream &store)
virtual FXbool savePixels (FXStream &store) const
virtual FXbool loadPixels (FXStream &store)
virtual ~FXImage ()

Detailed Description

An Image is a rectangular array of pixels.

It supports two representations of these pixels: a client-side pixel buffer which is stored as an array of FXColor, 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.

See also:


Constructor & Destructor Documentation

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

Create an image.

If a client-side pixel buffer has been specified, the image does not own the pixel buffer unless the IMAGE_OWNED flag is set. If the IMAGE_OWNED flag is set but a NULL pixel buffer is passed, a pixel buffer will be automatically created and will be owned by the image. The flags IMAGE_SHMI and IMAGE_SHMP may be specified for large images to instruct render() to use shared memory to communicate with the server.

virtual FX::FXImage::~FXImage  )  [virtual]
 

Destructor.


Member Function Documentation

FXColor* FX::FXImage::getData  )  const [inline]
 

To get to the pixel data.

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

To get to the option flags.

void FX::FXImage::setOptions FXuint  opts  ) 
 

Change options.

FXColor FX::FXImage::getPixel FXint  x,
FXint  y
const [inline]
 

Get pixel at x,y.

void FX::FXImage::setPixel FXint  x,
FXint  y,
FXColor  color
[inline]
 

Change pixel at x,y.

FXbool FX::FXImage::hasAlpha  )  const
 

Scan the image and return FALSE if fully opaque.

virtual void FX::FXImage::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 IMAGE_KEEP has been specified. If the pixel buffer is not owned, i.e. the flag IMAGE_OWNED is not set, the pixel buffer will not be deleted.

Reimplemented from FX::FXId.

Reimplemented in FX::FXIcon.

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

Detach the server side pixmap from the Image.

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

Reimplemented from FX::FXId.

Reimplemented in FX::FXIcon.

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

Destroy the server-side pixmap.

The client-side pixel buffer is not affected.

Reimplemented from FX::FXId.

Reimplemented in FX::FXIcon.

virtual void FX::FXImage::restore  )  [virtual]
 

Retrieves pixels from the server-side image.

For example, to make screen snapshots, or to retrieve an image after it has been drawin into by various means.

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

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

Normally, IMAGE_DITHER is used which causes the server-side representation to be rendered using a 16x16 ordered dither if necessary; however if IMAGE_NEAREST is used a faster (but uglier-looking), nearest neighbor algorithm is used.

Reimplemented in FX::FXIcon.

virtual void FX::FXImage::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::FXImage::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.

Reimplemented in FX::FXIcon.

virtual void FX::FXImage::scale FXint  w,
FXint  h,
FXint  quality = 0
[virtual]
 

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

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

Mirror image horizontally and/or vertically.

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

Rotate image by degrees ccw; this calls resize() to adjust the client and server side representations if necessary.

virtual void FX::FXImage::crop FXint  x,
FXint  y,
FXint  w,
FXint  h
[virtual]
 

Crop image to given rectangle; this calls resize() to adjust the client and server side representations.

virtual void FX::FXImage::fill FXColor  color  )  [virtual]
 

Fill image with uniform color.

virtual void FX::FXImage::fade FXColor  color,
FXint  factor = 255
[virtual]
 

Fade image to uniform color.

virtual void FX::FXImage::xshear FXint  shear,
FXColor  clr = 0
[virtual]
 

Shear image horizontally; the number of pixels is equal to the shear parameter times 256.

The area outside the image is filled with transparent black, unless another color is specified.

virtual void FX::FXImage::yshear FXint  shear,
FXColor  clr = 0
[virtual]
 

Shear image vertically; the number of pixels is equal to the shear parameter times 256.

The area outside the image is filled with transparent black, unless another color is specified.

virtual void FX::FXImage::hgradient FXColor  left,
FXColor  right
[virtual]
 

Fill horizontal gradient.

virtual void FX::FXImage::vgradient FXColor  top,
FXColor  bottom
[virtual]
 

Fill vertical gradient.

virtual void FX::FXImage::gradient FXColor  topleft,
FXColor  topright,
FXColor  bottomleft,
FXColor  bottomright
[virtual]
 

Fill with gradient.

virtual void FX::FXImage::blend FXColor  color  )  [virtual]
 

Blend image over uniform color.

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

Save object to stream.

Reimplemented from FX::FXDrawable.

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

Load object from stream.

Reimplemented from FX::FXDrawable.

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

Save pixel data only.

Reimplemented in FX::FXBMPIcon, FX::FXBMPImage, FX::FXGIFIcon, FX::FXGIFImage, FX::FXICOIcon, FX::FXICOImage, FX::FXJPGIcon, FX::FXJPGImage, FX::FXPCXIcon, FX::FXPCXImage, FX::FXPNGIcon, FX::FXPNGImage, FX::FXPPMIcon, FX::FXPPMImage, FX::FXRGBIcon, FX::FXRGBImage, FX::FXTGAIcon, FX::FXTGAImage, FX::FXTIFIcon, FX::FXTIFImage, FX::FXXBMIcon, FX::FXXBMImage, FX::FXXPMIcon, and FX::FXXPMImage.

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

Load pixel data only.

Reimplemented in FX::FXBMPIcon, FX::FXBMPImage, FX::FXGIFIcon, FX::FXGIFImage, FX::FXICOIcon, FX::FXICOImage, FX::FXJPGIcon, FX::FXJPGImage, FX::FXPCXIcon, FX::FXPCXImage, FX::FXPNGIcon, FX::FXPNGImage, FX::FXPPMIcon, FX::FXPPMImage, FX::FXRGBIcon, FX::FXRGBImage, FX::FXTGAIcon, FX::FXTGAImage, FX::FXTIFIcon, FX::FXTIFImage, FX::FXXBMIcon, FX::FXXBMImage, FX::FXXPMIcon, and FX::FXXPMImage.

Copyright © 1997-2004 Jeroen van der Zijp