|
OGRE
1.9.0
|
Class representing an image file. More...
#include <OgreImage.h>

Public Types | |
| typedef Ogre::Box | Box |
| enum | Filter { FILTER_NEAREST , FILTER_LINEAR , FILTER_BILINEAR , FILTER_BOX , FILTER_TRIANGLE , FILTER_BICUBIC } |
| typedef Ogre::Rect | Rect |
Public Member Functions | |
| Image () | |
| Standard constructor. | |
| Image (const Image &img) | |
| Copy-constructor - copies all the data from the target image. | |
| virtual | ~Image () |
| Standard destructor. | |
| Image & | combineTwoImagesAsRGBA (const Image &rgb, const Image &alpha, PixelFormat format=PF_BYTE_RGBA) |
| Utility method to combine 2 separate images into this one, with the first image source supplying the RGB channels, and the second image supplying the alpha channel (as luminance or separate alpha). | |
| DataStreamPtr | encode (const String &formatextension) |
| Encode the image and return a stream to the data. | |
| Image & | flipAroundX () |
| Flips (mirrors) the image around the X-axis. | |
| Image & | flipAroundY () |
| Flips (mirrors) the image around the Y-axis. | |
| void | freeMemory () |
| Delete all the memory held by this image, if owned by this image (not dynamic) | |
| uchar | getBPP () const |
| Returns the number of bits per pixel. | |
| ColourValue | getColourAt (size_t x, size_t y, size_t z) const |
| Get colour value from a certain location in the image. | |
| const uchar * | getData () const |
| Returns a const pointer to the internal image buffer. | |
| uchar * | getData (void) |
| Returns a pointer to the internal image buffer. | |
| uint32 | getDepth (void) const |
| Gets the depth of the image. | |
| PixelFormat | getFormat () const |
| Returns the image format. | |
| bool | getHasAlpha () const |
| Returns true if the image has an alpha component. | |
| uint32 | getHeight (void) const |
| Gets the height of the image in pixels. | |
| size_t | getNumFaces (void) const |
| Get the number of faces of the image. | |
| uint8 | getNumMipmaps () const |
| Returns the number of mipmaps contained in the image. | |
| PixelBox | getPixelBox (size_t face=0, size_t mipmap=0) const |
| Get a PixelBox encapsulating the image data of a mipmap. | |
| size_t | getRowSpan (void) const |
| Gets the physical width in bytes of each row of pixels. | |
| size_t | getSize () const |
| Returns the size of the data buffer. | |
| uint32 | getWidth (void) const |
| Gets the width of the image in pixels. | |
| bool | hasFlag (const ImageFlags imgFlag) const |
| Returns true if the image has the appropriate flag set. | |
| Image & | load (const String &filename, const String &groupName) |
| Loads an image file. | |
| Image & | load (DataStreamPtr &stream, const String &type=StringUtil::BLANK) |
| Loads an image file from a stream. | |
| Image & | loadDynamicImage (uchar *data, uint32 width, uint32 height, PixelFormat format) |
| Stores a pointer to raw data in memory. | |
| Image & | loadDynamicImage (uchar *data, uint32 width, uint32 height, uint32 depth, PixelFormat format, bool autoDelete=false, size_t numFaces=1, uint8 numMipMaps=0) |
| Stores a pointer to raw data in memory. | |
| Image & | loadRawData (DataStreamPtr &stream, uint32 width, uint32 height, PixelFormat format) |
| Loads raw data from a stream. | |
| Image & | loadRawData (DataStreamPtr &stream, uint32 width, uint32 height, uint32 depth, PixelFormat format, size_t numFaces=1, size_t numMipMaps=0) |
| Loads raw data from a stream. | |
| Image & | loadTwoImagesAsRGBA (const String &rgbFilename, const String &alphaFilename, const String &groupName, PixelFormat format=PF_BYTE_RGBA) |
| Utility method to combine 2 separate images into this one, with the first image source supplying the RGB channels, and the second image supplying the alpha channel (as luminance or separate alpha). | |
| Image & | loadTwoImagesAsRGBA (DataStreamPtr &rgbStream, DataStreamPtr &alphaStream, PixelFormat format=PF_BYTE_RGBA, const String &rgbType=StringUtil::BLANK, const String &alphaType=StringUtil::BLANK) |
| Utility method to combine 2 separate images into this one, with the first image source supplying the RGB channels, and the second image supplying the alpha channel (as luminance or separate alpha). | |
| void | operator delete (void *ptr) |
| void | operator delete (void *ptr) |
| void | operator delete (void *ptr, const char *, int, const char *) |
| void | operator delete (void *ptr, const char *, int, const char *) |
| void | operator delete (void *ptr, void *) |
| void | operator delete (void *ptr, void *) |
| void | operator delete[] (void *ptr) |
| void | operator delete[] (void *ptr) |
| void | operator delete[] (void *ptr, const char *, int, const char *) |
| void | operator delete[] (void *ptr, const char *, int, const char *) |
| void * | operator new (size_t sz) |
| void * | operator new (size_t sz) |
| void * | operator new (size_t sz, const char *file, int line, const char *func) |
| operator new, with debug line info | |
| void * | operator new (size_t sz, const char *file, int line, const char *func) |
| operator new, with debug line info | |
| void * | operator new (size_t sz, void *ptr) |
| placement operator new | |
| void * | operator new (size_t sz, void *ptr) |
| placement operator new | |
| void * | operator new[] (size_t sz) |
| void * | operator new[] (size_t sz) |
| void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
| array operator new, with debug line info | |
| void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
| array operator new, with debug line info | |
| Image & | operator= (const Image &img) |
| Assignment operator - copies all the data from the target image. | |
| void | resize (ushort width, ushort height, Filter filter=FILTER_BILINEAR) |
| Resize a 2D image, applying the appropriate filter. | |
| void | save (const String &filename) |
| Save the image as a file. | |
| void | setColourAt (ColourValue const &cv, size_t x, size_t y, size_t z) |
| Set colour value at a certain location in the image. | |
Static Public Member Functions | |
| static void | applyGamma (uchar *buffer, Real gamma, size_t size, uchar bpp) |
| Does gamma adjustment. | |
| static size_t | calculateSize (size_t mipmaps, size_t faces, uint32 width, uint32 height, uint32 depth, PixelFormat format) |
| Static function to calculate size in bytes from the number of mipmaps, faces and the dimensions. | |
| static String | getFileExtFromMagic (DataStreamPtr stream) |
| Static function to get an image type string from a stream via magic numbers. | |
| static void | scale (const PixelBox &src, const PixelBox &dst, Filter filter=FILTER_BILINEAR) |
| Scale a 1D, 2D or 3D image volume. | |
Protected Attributes | |
| bool | mAutoDelete |
| A bool to determine if we delete the buffer or the calling app does. | |
| uchar * | mBuffer |
| size_t | mBufSize |
| The size of the image buffer. | |
| uint32 | mDepth |
| The depth of the image. | |
| int | mFlags |
| Image specific flags. | |
| PixelFormat | mFormat |
| The pixel format of the image. | |
| uint32 | mHeight |
| The height of the image in pixels. | |
| uint8 | mNumMipmaps |
| The number of mipmaps the image contains. | |
| uchar | mPixelSize |
| The number of bytes per pixel. | |
| uint32 | mWidth |
| The width of the image in pixels. | |
Class representing an image file.
Definition at line 61 of file OgreImage.h.
| typedef Ogre::Box Ogre::Image::Box |
Definition at line 64 of file OgreImage.h.
| typedef Ogre::Rect Ogre::Image::Rect |
Definition at line 65 of file OgreImage.h.
| enum Ogre::Image::Filter |
| Enumerator | |
|---|---|
| FILTER_NEAREST | |
| FILTER_LINEAR | |
| FILTER_BILINEAR | |
| FILTER_BOX | |
| FILTER_TRIANGLE | |
| FILTER_BICUBIC | |
Definition at line 450 of file OgreImage.h.
| Ogre::Image::Image | ( | ) |
Standard constructor.
Referenced by Image(), combineTwoImagesAsRGBA(), flipAroundX(), flipAroundY(), load(), load(), loadDynamicImage(), loadDynamicImage(), loadRawData(), loadRawData(), loadTwoImagesAsRGBA(), loadTwoImagesAsRGBA(), and operator=().
| Ogre::Image::Image | ( | const Image & | img | ) |
Copy-constructor - copies all the data from the target image.
References Image().
|
virtual |
Standard destructor.
Does gamma adjustment.
|
static |
Static function to calculate size in bytes from the number of mipmaps, faces and the dimensions.
| Image & Ogre::Image::combineTwoImagesAsRGBA | ( | const Image & | rgb, |
| const Image & | alpha, | ||
| PixelFormat | format = PF_BYTE_RGBA ) |
Utility method to combine 2 separate images into this one, with the first image source supplying the RGB channels, and the second image supplying the alpha channel (as luminance or separate alpha).
| rgb | Image supplying the RGB channels (any alpha is ignored) |
| alpha | Image supplying the alpha channel. If a luminance image the single channel is used directly, if an RGB image then the values are converted to greyscale. |
| format | The destination format |
References Image(), and Ogre::PF_BYTE_RGBA.
| DataStreamPtr Ogre::Image::encode | ( | const String & | formatextension | ) |
Encode the image and return a stream to the data.
| formatextension | An extension to identify the image format to encode into, e.g. "jpg" or "png" |
| Image & Ogre::Image::flipAroundX | ( | ) |
Flips (mirrors) the image around the X-axis.
flip axis
|
originalimg|gmilanigiro
00000000000|00000000000
00000000000|00000000000
00000000000|00000000000
00000000000|00000000000
00000000000|00000000000
References Image().
| Image & Ogre::Image::flipAroundY | ( | ) |
Flips (mirrors) the image around the Y-axis.
originalimg
00000000000
00000000000
00000000000
00000000000
00000000000
------------> flip axis
00000000000
00000000000
00000000000
00000000000
00000000000
originalimg
References Image().
| void Ogre::Image::freeMemory | ( | ) |
Delete all the memory held by this image, if owned by this image (not dynamic)
| uchar Ogre::Image::getBPP | ( | ) | const |
Returns the number of bits per pixel.
| ColourValue Ogre::Image::getColourAt | ( | size_t | x, |
| size_t | y, | ||
| size_t | z ) const |
Get colour value from a certain location in the image.
The z coordinate is only valid for cubemaps and volume textures. This uses the first (largest) mipmap.
| const uchar * Ogre::Image::getData | ( | ) | const |
Returns a const pointer to the internal image buffer.
| uchar * Ogre::Image::getData | ( | void | ) |
Returns a pointer to the internal image buffer.
| uint32 Ogre::Image::getDepth | ( | void | ) | const |
Gets the depth of the image.
|
static |
Static function to get an image type string from a stream via magic numbers.
| PixelFormat Ogre::Image::getFormat | ( | ) | const |
Returns the image format.
| bool Ogre::Image::getHasAlpha | ( | ) | const |
Returns true if the image has an alpha component.
| uint32 Ogre::Image::getHeight | ( | void | ) | const |
Gets the height of the image in pixels.
| size_t Ogre::Image::getNumFaces | ( | void | ) | const |
Get the number of faces of the image.
This is usually 6 for a cubemap, and 1 for a normal image.
| uint8 Ogre::Image::getNumMipmaps | ( | ) | const |
Returns the number of mipmaps contained in the image.
| PixelBox Ogre::Image::getPixelBox | ( | size_t | face = 0, |
| size_t | mipmap = 0 ) const |
Get a PixelBox encapsulating the image data of a mipmap.
| size_t Ogre::Image::getRowSpan | ( | void | ) | const |
Gets the physical width in bytes of each row of pixels.
| size_t Ogre::Image::getSize | ( | ) | const |
Returns the size of the data buffer.
| uint32 Ogre::Image::getWidth | ( | void | ) | const |
Gets the width of the image in pixels.
| bool Ogre::Image::hasFlag | ( | const ImageFlags | imgFlag | ) | const |
Returns true if the image has the appropriate flag set.
Loads an image file.
| filename | Name of an image file to load. |
| groupName | Name of the resource group to search for the image |
References Image().
| Image & Ogre::Image::load | ( | DataStreamPtr & | stream, |
| const String & | type = StringUtil::BLANK ) |
Loads an image file from a stream.
| stream | The source data. |
| type | The type of the image. Used to decide what decompression codec to use. Can be left blank if the stream data includes a header to identify the data. |
References Image(), and Ogre::StringUtil::BLANK.
| Image & Ogre::Image::loadDynamicImage | ( | uchar * | data, |
| uint32 | width, | ||
| uint32 | height, | ||
| PixelFormat | format ) |
Stores a pointer to raw data in memory.
The pixel format has to be specified.
| data | The data pointer |
| width | Width of image |
| height | Height of image |
| format | Pixel Format |
Definition at line 205 of file OgreImage.h.
References Image(), and loadDynamicImage().
| Image & Ogre::Image::loadDynamicImage | ( | uchar * | data, |
| uint32 | width, | ||
| uint32 | height, | ||
| uint32 | depth, | ||
| PixelFormat | format, | ||
| bool | autoDelete = false, | ||
| size_t | numFaces = 1, | ||
| uint8 | numMipMaps = 0 ) |
Stores a pointer to raw data in memory.
The pixel format has to be specified.
| data | The data pointer |
| width | Width of image |
| height | Height of image |
| depth | Image Depth (in 3d images, numbers of layers, otherwise 1) |
| format | Pixel Format |
| autoDelete | If memory associated with this buffer is to be destroyed with the Image object. Note: it's important that if you set this option to true, that you allocated the memory using OGRE_ALLOC_T with a category of MEMCATEGORY_GENERAL to ensure the freeing of memory matches up. |
| numFaces | The number of faces the image data has inside (6 for cubemaps, 1 otherwise) |
| numMipMaps | The number of mipmaps the image data has inside |
References Image().
Referenced by loadDynamicImage().
| Image & Ogre::Image::loadRawData | ( | DataStreamPtr & | stream, |
| uint32 | width, | ||
| uint32 | height, | ||
| PixelFormat | format ) |
Loads raw data from a stream.
The pixel format has to be specified.
Definition at line 253 of file OgreImage.h.
References Image(), and loadRawData().
| Image & Ogre::Image::loadRawData | ( | DataStreamPtr & | stream, |
| uint32 | width, | ||
| uint32 | height, | ||
| uint32 | depth, | ||
| PixelFormat | format, | ||
| size_t | numFaces = 1, | ||
| size_t | numMipMaps = 0 ) |
Loads raw data from a stream.
See the function loadDynamicImage for a description of the parameters.
References Image().
Referenced by loadRawData().
| Image & Ogre::Image::loadTwoImagesAsRGBA | ( | const String & | rgbFilename, |
| const String & | alphaFilename, | ||
| const String & | groupName, | ||
| PixelFormat | format = PF_BYTE_RGBA ) |
Utility method to combine 2 separate images into this one, with the first image source supplying the RGB channels, and the second image supplying the alpha channel (as luminance or separate alpha).
| rgbFilename | Filename of image supplying the RGB channels (any alpha is ignored) |
| alphaFilename | Filename of image supplying the alpha channel. If a luminance image the single channel is used directly, if an RGB image then the values are converted to greyscale. |
| groupName | The resource group from which to load the images |
| format | The destination format |
References Image(), and Ogre::PF_BYTE_RGBA.
| Image & Ogre::Image::loadTwoImagesAsRGBA | ( | DataStreamPtr & | rgbStream, |
| DataStreamPtr & | alphaStream, | ||
| PixelFormat | format = PF_BYTE_RGBA, | ||
| const String & | rgbType = StringUtil::BLANK, | ||
| const String & | alphaType = StringUtil::BLANK ) |
Utility method to combine 2 separate images into this one, with the first image source supplying the RGB channels, and the second image supplying the alpha channel (as luminance or separate alpha).
| rgbStream | Stream of image supplying the RGB channels (any alpha is ignored) |
| alphaStream | Stream of image supplying the alpha channel. If a luminance image the single channel is used directly, if an RGB image then the values are converted to greyscale. |
| format | The destination format |
| rgbType | The type of the RGB image. Used to decide what decompression codec to use. Can be left blank if the stream data includes a header to identify the data. |
| alphaType | The type of the alpha image. Used to decide what decompression codec to use. Can be left blank if the stream data includes a header to identify the data. |
References Image(), Ogre::StringUtil::BLANK, and Ogre::PF_BYTE_RGBA.
|
inherited |
Definition at line 96 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 96 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 108 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 108 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 102 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 102 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 113 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 113 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 119 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 119 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 73 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 73 of file OgreMemoryAllocatedObject.h.
|
inherited |
operator new, with debug line info
Definition at line 68 of file OgreMemoryAllocatedObject.h.
|
inherited |
operator new, with debug line info
Definition at line 68 of file OgreMemoryAllocatedObject.h.
|
inherited |
placement operator new
Definition at line 79 of file OgreMemoryAllocatedObject.h.
|
inherited |
placement operator new
Definition at line 79 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 91 of file OgreMemoryAllocatedObject.h.
|
inherited |
Definition at line 91 of file OgreMemoryAllocatedObject.h.
|
inherited |
array operator new, with debug line info
Definition at line 86 of file OgreMemoryAllocatedObject.h.
|
inherited |
array operator new, with debug line info
Definition at line 86 of file OgreMemoryAllocatedObject.h.
Assignment operator - copies all the data from the target image.
References Image().
| void Ogre::Image::resize | ( | ushort | width, |
| ushort | height, | ||
| Filter | filter = FILTER_BILINEAR ) |
Resize a 2D image, applying the appropriate filter.
References FILTER_BILINEAR.
| void Ogre::Image::save | ( | const String & | filename | ) |
Save the image as a file.
|
static |
Scale a 1D, 2D or 3D image volume.
| src | PixelBox containing the source pointer, dimensions and format |
| dst | PixelBox containing the destination pointer, dimensions and format |
| filter | Which filter to use |
References FILTER_BILINEAR.
| void Ogre::Image::setColourAt | ( | ColourValue const & | cv, |
| size_t | x, | ||
| size_t | y, | ||
| size_t | z ) |
Set colour value at a certain location in the image.
The z coordinate is only valid for cubemaps and volume textures. This uses the first (largest) mipmap.
|
protected |
A bool to determine if we delete the buffer or the calling app does.
Definition at line 499 of file OgreImage.h.
|
protected |
Definition at line 496 of file OgreImage.h.
|
protected |
The size of the image buffer.
Definition at line 485 of file OgreImage.h.
|
protected |
The depth of the image.
Definition at line 483 of file OgreImage.h.
|
protected |
Image specific flags.
Definition at line 489 of file OgreImage.h.
|
protected |
The pixel format of the image.
Definition at line 492 of file OgreImage.h.
|
protected |
The height of the image in pixels.
Definition at line 481 of file OgreImage.h.
|
protected |
The number of mipmaps the image contains.
Definition at line 487 of file OgreImage.h.
|
protected |
The number of bytes per pixel.
Definition at line 495 of file OgreImage.h.
|
protected |
The width of the image in pixels.
Definition at line 479 of file OgreImage.h.
1.13.2