Om
1.0.0
A universal framework for multimedia simulation
|
A class that stores packed pixel data for images with an arbitrary number of dimensions. More...
#include <omImage.h>
Public Member Functions | |
Image () | |
Create an empty image with UNDEFINED pixel format. More... | |
Image (const PixelFormat &newPixelFormat, Size width) | |
Create a 1D image object with the specified pixel format and width. More... | |
Image (const PixelFormat &newPixelFormat, Size width, Size height) | |
Create a 2D image object with the specified pixel format, width and height. More... | |
Image (const PixelFormat &newPixelFormat, Size width, Size height, Size depth) | |
Create a 3D image object with the specified pixel format, width, height and depth. More... | |
Image (const PixelFormat &newPixelFormat, const Size *sizes, Size numDimensions) | |
Create an image object with the specified pixel format and an arbitrary number of dimensions. More... | |
Image (const Image &image) | |
Construct a copy of another image, copying its internal format and pixel data. More... | |
~Image () | |
Destroy an image and release its internal pixel data. More... | |
Image & | operator= (const Image &other) |
Assign the state of another image to this one. More... | |
Size | getDimensionCount () const |
Return the number of dimensions in this image, usually 1, 2, or 3. More... | |
const Size * | getSizes () const |
Return a pointer to an array containing the size along each dimension of this image. More... | |
Size | getSize (Index dimension) const |
Return the size of the image along the specified dimension index. More... | |
Size | getSize1D () const |
Return the size of the image assuming it is a 1D image. More... | |
Size2D | getSize2D () const |
Return the size of the image assuming it is a 2D image. More... | |
Size3D | getSize3D () const |
Return the size of the image assuming it is a 3D image. More... | |
Size | getWidth () const |
Return the width of this image (size along dimension 0). More... | |
Size | getHeight () const |
Return the height of this image (size along dimension 1). More... | |
Size | getDepth () const |
Return the depth of this image (size along dimension 2). More... | |
void | setSize (Size width) |
Reset the size of the image to be 1D with the given width. More... | |
void | setSize (Size width, Size height) |
Reset the size of the image to be 2D with the given width and height. More... | |
void | setSize (Size width, Size height, Size depth) |
Reset the size of the image to be 3D with the given width, height, and depth. More... | |
void | setSize (const Size *sizes, Size numDimensions) |
Reset the size of the image to be an arbitrary number of dimensions. More... | |
Size | getPixelCount () const |
Return the total number of pixels in the image. More... | |
Size | getSizeInBytes () const |
Return the total size in bytes of the image's pixel data. More... | |
const PixelFormat & | getPixelFormat () const |
Return an object that describes the pixel format of this image. More... | |
void | setPixelFormat (const PixelFormat &newPixelFormat) |
Change the pixel format of this image. More... | |
UByte * | getPixelData () |
Return a pointer to the pixel data for this image. More... | |
const UByte * | getPixelData () const |
Return a const pointer to the pixel data for this image. More... | |
Bool | isAllocated () const |
Return whether or not this image has allocated any memory for pixel data. More... | |
Bool | allocate () |
Allocate memory for this image's pixel data and return if the memory was successfully allocated. More... | |
Bool | deallocate () |
Free memory for this image's pixel data and return if the memory was successfully freed. More... | |
Bool | isValid () const |
Return whether or not this image has valid pixel data and format. More... | |
const ImageFormat & | getFormat () const |
Return an object that describes the perferred encoded format of this image. More... | |
void | setFormat (const ImageFormat &newFormat) |
Change the preferred encoded format of this image. More... | |
ImageFormatSettings & | getFormatSettings () |
Return the settings for the preferred encoded format of this image. More... | |
const ImageFormatSettings & | getFormatSettings () const |
Return the settings for the preferred encoded format of this image. More... | |
void | setFormatSettings (const ImageFormatSettings &newFormatSettings) |
Change the settings for the preferred encoded format of this image. More... | |
Bool | hasEncodedData () const |
Return whether or not this image has any encoded data. More... | |
UByte * | getEncodedData () |
Return a pointer to the encoded data for this image. More... | |
const UByte * | getEncodedData () const |
Return a pointer to the encoded data for this image. More... | |
Size | getEncodedDataSize () const |
Return the size in bytes of the encoded data for this image. More... | |
Bool | setEncodedDataSize (Size newEncodedDataSize) |
Set the size of the encoded data for this image. More... | |
Bool | setEncodedData (const UByte *newEncodedData, Size newEncodedDataSize) |
Set the encoded data for this image. More... | |
Bool | setEncodedData (const UByte *newEncodedData, Size newEncodedDataSize, const ImageFormat &format) |
Set the encoded data for this image. More... | |
void | clearEncodedData () |
Deallocate any previous encoded image data. More... | |
Static Public Attributes | |
static const om::resources::ResourceType | RESOURCE_TYPE |
The resource type for an image. More... | |
A class that stores packed pixel data for images with an arbitrary number of dimensions.
om::images::base::Image::Image | ( | ) |
Create an empty image with UNDEFINED pixel format.
om::images::base::Image::Image | ( | const PixelFormat & | newPixelFormat, |
Size | width | ||
) |
Create a 1D image object with the specified pixel format and width.
No pixel data is initially allocated for the image.
om::images::base::Image::Image | ( | const PixelFormat & | newPixelFormat, |
Size | width, | ||
Size | height | ||
) |
Create a 2D image object with the specified pixel format, width and height.
No pixel data is initially allocated for the image.
om::images::base::Image::Image | ( | const PixelFormat & | newPixelFormat, |
Size | width, | ||
Size | height, | ||
Size | depth | ||
) |
Create a 3D image object with the specified pixel format, width, height and depth.
No pixel data is initially allocated for the image.
om::images::base::Image::Image | ( | const PixelFormat & | newPixelFormat, |
const Size * | sizes, | ||
Size | numDimensions | ||
) |
Create an image object with the specified pixel format and an arbitrary number of dimensions.
The user specifies the number of dimensions in the image and a pointer to an array of sizes along each dimension.
No pixel data is initially allocated for the image.
om::images::base::Image::Image | ( | const Image & | image | ) |
Construct a copy of another image, copying its internal format and pixel data.
om::images::base::Image::~Image | ( | ) |
Destroy an image and release its internal pixel data.
Assign the state of another image to this one.
|
inline |
Return the number of dimensions in this image, usually 1, 2, or 3.
A 1D image is an array of pixels, a 2D image is a plane of pixels, a 3D image is a rectangular volume of voxels, etc.
|
inline |
Return a pointer to an array containing the size along each dimension of this image.
Return the size of the image along the specified dimension index.
Indices start from 0 and count to d-1 for a image with d dimensions. If the specified dimension index is out of bounds, 1 is returned.
|
inline |
Return the size of the image assuming it is a 1D image.
|
inline |
Return the size of the image assuming it is a 2D image.
|
inline |
Return the size of the image assuming it is a 3D image.
|
inline |
Return the width of this image (size along dimension 0).
If the dimension is not valid for this image, 1 is returned.
|
inline |
Return the height of this image (size along dimension 1).
If the dimension is not valid for this image, 1 is returned.
|
inline |
Return the depth of this image (size along dimension 2).
If the dimension is not valid for this image, 1 is returned.
void om::images::base::Image::setSize | ( | Size | width | ) |
Reset the size of the image to be 1D with the given width.
This call deallocates any previously allocated image pixel data if the image size changes.
Reset the size of the image to be 2D with the given width and height.
This call deallocates any previously allocated image pixel data if the image size changes.
Reset the size of the image to be 3D with the given width, height, and depth.
This call deallocates any previously allocated image pixel data if the image size changes.
Reset the size of the image to be an arbitrary number of dimensions.
The user specifies the number of dimensions in the image and a pointer to an array of sizes along each dimension.
This call deallocates any previously allocated image pixel data if the image size changes.
Size om::images::base::Image::getPixelCount | ( | ) | const |
Return the total number of pixels in the image.
|
inline |
Return the total size in bytes of the image's pixel data.
|
inline |
Return an object that describes the pixel format of this image.
void om::images::base::Image::setPixelFormat | ( | const PixelFormat & | newPixelFormat | ) |
Change the pixel format of this image.
This call deallocates any previously allocated image pixel data if the pixel format has a different size in bytes. Otherwise, the image pixel data is unchanged but is now reinterpreted using the new pixel format.
|
inline |
Return a pointer to the pixel data for this image.
If the image is not allocated, the method returns a NULL pointer.
|
inline |
Return a const pointer to the pixel data for this image.
If the image is not allocated, the method returns a NULL pointer.
|
inline |
Return whether or not this image has allocated any memory for pixel data.
Bool om::images::base::Image::allocate | ( | ) |
Allocate memory for this image's pixel data and return if the memory was successfully allocated.
The resulting contents of the image are undefined if it was previously not allocated.
Bool om::images::base::Image::deallocate | ( | ) |
Free memory for this image's pixel data and return if the memory was successfully freed.
The image deallocates its internal pixel data but retains its size information and pixel format.
|
inline |
Return whether or not this image has valid pixel data and format.
|
inline |
Return an object that describes the perferred encoded format of this image.
void om::images::base::Image::setFormat | ( | const ImageFormat & | newFormat | ) |
Change the preferred encoded format of this image.
This call deallocates the image's encoded data if it was allocated and the new format is not compatible with the previous encoded data format.
|
inline |
Return the settings for the preferred encoded format of this image.
|
inline |
Return the settings for the preferred encoded format of this image.
|
inline |
Change the settings for the preferred encoded format of this image.
|
inline |
Return whether or not this image has any encoded data.
|
inline |
Return a pointer to the encoded data for this image.
If the returned pointer is NULL, it indicates the start of memory containing the image's encoded data in its format.
|
inline |
Return a pointer to the encoded data for this image.
If the returned pointer is NULL, it indicates the start of memory containing the image's encoded data in its format.
|
inline |
Return the size in bytes of the encoded data for this image.
Set the size of the encoded data for this image.
The image allocates internal space for the specified number of bytes of encoded image data. The contents of the encoded data are undefined.
Bool om::images::base::Image::setEncodedData | ( | const UByte * | newEncodedData, |
Size | newEncodedDataSize | ||
) |
Set the encoded data for this image.
The image copies the image data to internal memory and the current image format is used. The method returns whether or not the operation was successful.
Bool om::images::base::Image::setEncodedData | ( | const UByte * | newEncodedData, |
Size | newEncodedDataSize, | ||
const ImageFormat & | format | ||
) |
Set the encoded data for this image.
The image copies the image data to internal memory and the image format is set to the specified format. The method returns whether or not the operation was successful.
void om::images::base::Image::clearEncodedData | ( | ) |
Deallocate any previous encoded image data.
This method is used to discard a previously encoded version of an image so that will be re-encoded when it is next saved. This method should be called whenever an image's pixel data is edited.
|
static |
The resource type for an image.