VCF::AbstractImage Class Reference
AbstractImage represents a base implementation of the Image interface. More...
#include <vcf/GraphicsKit/AbstractImage.h>
Inheritance diagram for VCF::AbstractImage:

Public Member Functions | |
| AbstractImage (const bool &needsMemAlloc=true) | |
| virtual | ~AbstractImage () |
| virtual void | setSize (const uint32 &width, const uint32 &height) |
| virtual uint32 | getWidth () |
| virtual uint32 | getHeight () |
| virtual void | addImageSizeChangedHandler (EventHandler *handler) |
| This macro creates a method for adding a listener to the AbstractImage's ImageSizeChangedHandler events. | |
| virtual void | removeImageSizeChangedHandler (EventHandler *handler) |
| This macro creates a method for removing a listener to the AbstractImage's ImageSizeChangedHandler events. | |
| virtual GraphicsContext * | getImageContext () |
| This retreives a graphics context for drawing on. | |
| virtual Color * | getTransparencyColor () |
| returns the color that is used to blend with the contents of a GraphicsContext when the Image is drawn. | |
| virtual void | setTransparencyColor (Color *transparencyColor) |
| virtual bool | isTransparent () |
| Indicates whether or not the Image is using a transparent color. | |
| virtual void | setIsTransparent (const bool &transparent) |
| virtual void | saveToStream (OutputStream *stream) |
| Write the object to the specified output stream. | |
| virtual void | loadFromStream (InputStream *stream) |
| Read the object from the specified input stream. | |
| virtual Image::ImageType | getType () const |
| returns the type of image that this Image instance represents. | |
| virtual Image::ImageChannelSize | getChannelSize () const |
| returns the number of bits each channel value represents. | |
| virtual Image::ImageChannelType | getChannelType () const |
| returns whether the values for a channel are integer based or floating point based. | |
| virtual Image::PixelLayoutOrder | getPixelLayoutOrder () const |
| returns the pixel layout order. | |
| virtual void * | getData () |
Public Attributes | |
| VCF::Delegate | ImageSizeChanged |
Protected Attributes | |
| unsigned char * | dataBuffer_ |
| int | height_ |
| int | width_ |
| GraphicsContext * | context_ |
| Color | transparencyColor_ |
| bool | isTransparent_ |
| bool | needsMemAlloc_ |
| ImageDescriptor | flags_ |
| Implementer note: flags_ needs to be intialized in the constructor of the platform implementation of the Image class. | |
Detailed Description
AbstractImage represents a base implementation of the Image interface.It implements common functions, such as getWidth, etc, but still requires actually image class to be derived from it. It also provides basic support for ImageSizeChangedHandlers, so derived classes do not have to baother with it. See Image for more information on what the functions do.
- Version:
- 1.0
- Author:
- Jim Crafton
- See also:
- Image
- Event Delegates for this class:
Constructor & Destructor Documentation
|
|
|
|
|
|
Member Function Documentation
|
|
This macro creates a method for adding a listener to the AbstractImage's ImageSizeChangedHandler events.
Implements VCF::Image. |
|
|
returns the number of bits each channel value represents. For example, by default, on Win32 systems, an Image is a full color RGBA image, with each value of a channel taking 8 bits, thus a single of pixel of this type of image takes up 32 bits - 4 channels with each channel component 8 bits in size.
Implements VCF::Image. |
|
|
returns whether the values for a channel are integer based or floating point based.
Implements VCF::Image. |
|
|
Implements VCF::Image. |
|
|
Implements VCF::Image. |
|
|
This retreives a graphics context for drawing on. Any drawing performed on the graphics context will be reflected in the internal pixel data of the image. On some platforms this may be "instantaneous" because the pixel data of the image is directly linked to the GraphicsContext (i.e. Win32), while on other platforms the drawing on the GraphicsContext needs to be "flushed" back to the images pixels. Because of this, you must call beginDrawing() before calling getImageContext(), and call finishedDrawing() when you're done with the GraphicsContext. Concrete implemententations of this class will transfer the image's contents to the GraphicsContext for beginDrawing(), finishedDrawing() will update the image's data due to any changes in the GraphicsContext. To ensure that you call these functions correctly, use the ImageContext class. An example: Image* image = getImage(); //get an image from somewhere //new code block... { ImageContext gc = image; //the ImageContext automatically calls beginDrawing() gc->rectangle( 20, 20, 400, 60 ); gc->strokePath(); } // the ImageContext destructor calls finishedDrawing() for you
Implements VCF::Image. |
|
|
returns the pixel layout order. This explains how the individual color components of each of the color channels are laid out.
Implements VCF::Image. |
|
|
returns the color that is used to blend with the contents of a GraphicsContext when the Image is drawn. Only used when the Image is set to Transparent Implements VCF::Image. |
|
|
returns the type of image that this Image instance represents. The integer value also indicates the number of color channels the Image has. Currently there are only 2 types, full color 4 channel RGBA images, and 1 channel grayscale images.
Implements VCF::Image. |
|
|
Implements VCF::Image. |
|
|
Indicates whether or not the Image is using a transparent color.
Implements VCF::Image. |
|
|
Read the object from the specified input stream.
Implements VCF::Persistable. |
|
|
This macro creates a method for removing a listener to the AbstractImage's ImageSizeChangedHandler events.
Implements VCF::Image. |
|
|
Write the object to the specified output stream.
Implements VCF::Persistable. |
|
|
Implements VCF::Image. |
|
||||||||||||
|
Implements VCF::Image. Reimplemented in VCF::GrayScaleImage, VCF::OSXImage, VCF::Win32Image, and VCF::Win32GrayScaleImage. |
|
|
Implements VCF::Image. |
Member Data Documentation
|
|
|
|
|
|
|
|
Implementer note: flags_ needs to be intialized in the constructor of the platform implementation of the Image class. For Win32 an example might be: ImageBits::Traits::setChannelType( flags_, ImageBits::Traits::getTraitsChannelType() ); ImageBits::Traits::setChannelSize( flags_, ImageBits::Traits::getTraitsChannelSize() ); ImageBits::Traits::setImageType( flags_, ImageBits::Traits::getTraitsImageType() ); ImageBits::Traits::setPixelLayoutOrder( flags_, Image::ploBGRA ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The documentation for this class was generated from the following file:
- vcf/GraphicsKit/AbstractImage.h
