VizKit  3.3.7
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
VizKit::VisualImage Class Reference

Bitmap raster image. More...

#include <VisualImage.h>

Inheritance diagram for VizKit::VisualImage:
VizKit::VisualObject

List of all members.

Classes

struct  VisualImageHistogramPixelColors
 Exchange data type for histogram creation. More...

Public Member Functions

 VisualImage ()
 The constructor.
 ~VisualImage ()
 The destructor.
 VisualImage (const VisualImage &other)
 Copy constructor.
VisualImageoperator= (const VisualImage &other)
 Assignment operator.
virtual VisualImageclone (void) const
 Copies the current VisualImage and returns a pointer to a new VisualImage.
bool initWithFile (VisualFile &aFile)
 Initializes the image with a file.
bool initWithARGBPixelData (PixelColor *argbPixels, size_t width, size_t height)
 Initializes the image with a buffer of ARGB pixel data.
bool initWithEncodedData (const char *const bufferData, size_t size)
 Initializes the image with a data pointer to encoded image data.
bool initWithStyledString (VisualStyledString &styledString)
 Initializes the image with a styled string.
bool initWithURL (VisualString &anURL, VisualItemIdentifier &anId)
 Initializes the image with an URL.
bool initWithLoadedEncodedData (void)
 Initializes the image with loaded encoded image data.
bool initWithFramebuffer (const BottomLeftPositionedPixelRect &clipRect)
 Initializes the image with contents of the current screen (framebuffer).
bool writeToPNGFile (VisualFile &aVisualFile) const
 Writes the image as PNG encoded data to a file on disk.
void writeToPNGFileAsync (VisualFile &aVisualFile)
 Writes the image as PNG encoded data to a file on disk asynchronously.
void writeToPNGFileAsyncAndDelete (VisualFile &aVisualFile)
 Writes the image as PNG encoded data to a file on disk asynchronously and deletes the VisualImage afterwards.
void applyConvolutionFilter (const VisualConvolutionFilter &aConvolutionFilter)
 Applies a convolution filter to the image.
size_t getWidth (void) const
 Returns the width of the bitmap image (in pixels).
size_t getHeight (void) const
 Returns the height of the bitmap image (in pixels).
double getLogicalWidth (void) const
 Returns the logical width of the texture.
double getLogicalHeight (void) const
 Returns the logical height of the texture.
void draw (const VertexChain *const aVertexChain, bool debug=false)
 Draws the image.
bool isEmpty (void) const
 Answers the question whether the image is empty or set.
BlendMode getBlendMode (void) const
 Returns the blend mode of the image.
void setBlendMode (BlendMode aBlendMode)
 Sets the blend mode of the image.
void resample (const PixelRect &pixelRect)
 Resamples the pixel data of the texture to the given dimensions of the pixelRect.
VisualTextureContainergetTextureContainer (void) const
 Returns a pointer to the texture container of the image.
virtual void dataLoadDidEnd (const VisualItemIdentifier &identifier)
 Notification that the loading of data ended.
void createHistogram (void)
 Creates a histogram of RGB pixel color values.
VisualHistogram::PixelColorHistogramgetHistogram (void)
 Returns the internal histogram.

Static Public Member Functions

static VisualImagecreateWithFile (VisualFile &aFile)
 Creates an image with a file.
static VisualImagecreateWithARGBPixelData (PixelColor *argbPixels, size_t width, size_t height)
 Creates an image with a buffer of ARGB pixel data.
static VisualImagecreateWithEncodedData (const char *const bufferData, uint32 size)
 Creates an image with a data pointer to encoded image data.
static VisualImagecreateWithStyledString (VisualStyledString &styledString)
 Creates an image with a styled string.
static VisualImagecreateWithURL (VisualString &anURL, VisualItemIdentifier &anId)
 Creates an image with an URL.
static VisualImagecreateWithFramebuffer (const BottomLeftPositionedPixelRect &clipRect)
 Creates an image with contents of the current screen (framebuffer).

Private Member Functions

void copy (const VisualImage &other)
 Copy method for assignment operator and copy constructor.
void getRGBHistogramInputPixels (std::vector< PixelColor > &inputValues) const
 Returns the array of RGB color pixels as required to create a histogram.

Private Attributes

VisualTextureContainervisualTextureContainer
 Pointer to the VisualTextureContainer.
bool isSet
 True if image has been set.
BlendMode blendMode
 The blend mode of the image.
VisualHistogram::PixelColorHistogramhistogram
 Creates a histogram of RGB pixel color values.

Detailed Description

Bitmap raster image.


Constructor & Destructor Documentation

The constructor.

The destructor.

Copy constructor.

Parameters:
otherReference to another VisualImage.

Member Function Documentation

void VisualImage::applyConvolutionFilter ( const VisualConvolutionFilter aConvolutionFilter)

Applies a convolution filter to the image.

Parameters:
aConvolutionFilterThe convolution filter to apply to the image.
VisualImage * VisualImage::clone ( void  ) const [virtual]

Copies the current VisualImage and returns a pointer to a new VisualImage.

Implements VizKit::VisualObject.

void VisualImage::copy ( const VisualImage other) [private]

Copy method for assignment operator and copy constructor.

Parameters:
otherAnother VisualImage.

Creates a histogram of RGB pixel color values.

A histogram contains the salient color values of the image.

Remarks:
The histogram is created asynchronously. On finish, a notification is sent (kImageHistogramCompletedMsg) on which actors can be registered. The image is downsampled and the histogram is calculated with the k-means algorithm.
VisualImage * VisualImage::createWithARGBPixelData ( PixelColor argbPixels,
size_t  width,
size_t  height 
) [static]

Creates an image with a buffer of ARGB pixel data.

Parameters:
argbPixelsPointer to ARGB pixel data.
widthThe width of the pixel data.
heightThe height of the pixel data.
Returns:
Initialized instance of VisualImage. NULL in case of failure.
Remarks:
The caller has to release (delete) the allocated memory. No reference to the pixel data is stored, pixel data can be savely disposed after the call.
VisualImage * VisualImage::createWithEncodedData ( const char *const  bufferData,
uint32  size 
) [static]

Creates an image with a data pointer to encoded image data.

Parameters:
bufferDataA pointer to the data.
sizeThe size of the data pointed to in bytes.
Returns:
Initialized instance of VisualImage. NULL in case of failure.
Remarks:
The caller has to release (delete) the initialized image.

Creates an image with a file.

Parameters:
aFileReference to a file.
Returns:
Initialized instance of VisualImage. NULL in case of failure.
Remarks:
The caller has to release (delete) the allocated memory.

Creates an image with contents of the current screen (framebuffer).

Parameters:
clipRectThe dimensions and position of the clip rect.
Remarks:
The caller has to release (delete) the allocated memory.

Creates an image with a styled string.

Parameters:
styledStringThe styled string to convert into bitmap image.
Returns:
Initialized instance of VisualImage. NULL in case of failure.
Remarks:
The caller has to release (delete) the allocated memory.

Creates an image with an URL.

Parameters:
anURLURL of the image.
anIdIdentifier that can be queried to track the progress of this asynchronous creation.
Returns:
Initialized instance of VisualImage.
Remarks:
The caller has to release (delete) the allocated memory.
void VisualImage::dataLoadDidEnd ( const VisualItemIdentifier identifier) [virtual]

Notification that the loading of data ended.

Parameters:
identifierThe identifier of the data load request.

Reimplemented from VizKit::VisualObject.

void VisualImage::draw ( const VertexChain *const  aVertexChain,
bool  debug = false 
)

Draws the image.

Parameters:
aVertexChainThe chain of vertices with which the image is drawn.
debugIf true, details of the drawing operation can be traced for diagnostical purposes.

Returns the blend mode of the image.

Returns:
The blend mode of the image.
size_t VisualImage::getHeight ( void  ) const

Returns the height of the bitmap image (in pixels).

Returns:
The height of the bitmap image (in pixels).

Returns the internal histogram.

Returns:
The histogram. Can be NULL in case no histogram has been set.
double VisualImage::getLogicalHeight ( void  ) const

Returns the logical height of the texture.

Returns:
The logical height of the texture.
double VisualImage::getLogicalWidth ( void  ) const

Returns the logical width of the texture.

Returns:
The logical width of the texture.
void VisualImage::getRGBHistogramInputPixels ( std::vector< PixelColor > &  inputValues) const [private]

Returns the array of RGB color pixels as required to create a histogram.

Parameters:
[out]inputValuesThe pixels that can be used as input for histogram creation.

Returns a pointer to the texture container of the image.

Returns:
A pointer to the texture container of the image.
size_t VisualImage::getWidth ( void  ) const

Returns the width of the bitmap image (in pixels).

Returns:
The width of the bitmap image (in pixels).
bool VisualImage::initWithARGBPixelData ( PixelColor argbPixels,
size_t  width,
size_t  height 
)

Initializes the image with a buffer of ARGB pixel data.

Parameters:
argbPixelsPointer to ARGB pixel data.
widthThe width of the pixel data.
heightThe height of the pixel data.
Returns:
True on succes, false on failure.
Remarks:
No reference to the pixel data is stored, pixel data can be savely disposed after the call.
bool VisualImage::initWithEncodedData ( const char *const  bufferData,
size_t  size 
)

Initializes the image with a data pointer to encoded image data.

Parameters:
bufferDataA pointer to the data.
sizeThe size of the data pointed to in bytes.
Returns:
True on success, false on failure.

Initializes the image with a file.

Parameters:
aFileReference to a file.
Returns:
True on success, false on failure.

Initializes the image with contents of the current screen (framebuffer).

Parameters:
clipRectThe dimensions and position of the clip rect.
Returns:
True on success, false on failure.

Initializes the image with loaded encoded image data.

Returns:
True on success, false on failure.

Initializes the image with a styled string.

Parameters:
styledStringThe styled string to convert into bitmap image.
Returns:
True on success, false on failure

Initializes the image with an URL.

Parameters:
anURLURL of the image.
anIdIdentifier that can be queried to track the progress of this asynchronous initialization.
Returns:
True on success, false on failure.
bool VisualImage::isEmpty ( void  ) const

Answers the question whether the image is empty or set.

VisualImage & VisualImage::operator= ( const VisualImage other)

Assignment operator.

Parameters:
otherReference to another VisualImage.
void VisualImage::resample ( const PixelRect pixelRect)

Resamples the pixel data of the texture to the given dimensions of the pixelRect.

Parameters:
pixelRectThe resampling dimensions.
void VisualImage::setBlendMode ( BlendMode  aBlendMode)

Sets the blend mode of the image.

Parameters:
aBlendModeThe blend mode of the image.
bool VisualImage::writeToPNGFile ( VisualFile aVisualFile) const

Writes the image as PNG encoded data to a file on disk.

Parameters:
aVisualFileAccess to file the image is to be written into.
Returns:
True on success, false on failure.

Writes the image as PNG encoded data to a file on disk asynchronously.

Parameters:
aVisualFileAccess to file the image is to be written into.

Writes the image as PNG encoded data to a file on disk asynchronously and deletes the VisualImage afterwards.

Parameters:
aVisualFileAccess to file the image is to be written into.

Member Data Documentation

The blend mode of the image.

Creates a histogram of RGB pixel color values.

Parameters:
visualImageHistogramPixelColorsPixel color values and pointer to image. Histogram.

True if image has been set.

False if image is not valid or has not been set yet.

Pointer to the VisualTextureContainer.


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

Generated on Sun May 3 2015 20:26:32 for VizKit by doxygen 1.8.0