168 size_t numFaces = 1,
uint8 numMipMaps = 0);
233 size_t numFaces = 1,
size_t numMipMaps = 0);
258 return loadRawData(stream, width, height, 1, format);
Class representing colour.
uint32 mWidth
The width of the image in pixels.
uint32 getHeight(void) const
Gets the height of the image in pixels.
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.
Image & flipAroundY()
Flips (mirrors) the image around the Y-axis.
uint32 mHeight
The height of the image in pixels.
void setColourAt(ColourValue const &cv, size_t x, size_t y, size_t z)
Set colour value at a certain location in the image.
int mFlags
Image specific flags.
uint8 mNumMipmaps
The number of mipmaps the image contains.
uchar getBPP() const
Returns the number of bits per pixel.
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.
size_t mBufSize
The size of the image buffer.
Image(const Image &img)
Copy-constructor - copies all the data from the target image.
size_t getSize() const
Returns the size of the data buffer.
size_t getNumFaces(void) const
Get the number of faces of the image.
Image()
Standard constructor.
Image & load(const String &filename, const String &groupName)
Loads an image file.
Image & flipAroundX()
Flips (mirrors) the image around the X-axis.
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 ...
void save(const String &filename)
Save the image as a file.
uint32 getWidth(void) const
Gets the width of the image in pixels.
void resize(ushort width, ushort height, Filter filter=FILTER_BILINEAR)
Resize a 2D image, applying the appropriate filter.
PixelFormat mFormat
The pixel format of the image.
uint32 mDepth
The depth of the image.
bool mAutoDelete
A bool to determine if we delete the buffer or the calling app does.
ColourValue getColourAt(size_t x, size_t y, size_t z) const
Get colour value from a certain location in the image.
bool hasFlag(const ImageFlags imgFlag) const
Returns true if the image has the appropriate flag set.
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 ...
uchar * getData(void)
Returns a pointer to the internal image buffer.
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 ...
Image & loadDynamicImage(uchar *data, uint32 width, uint32 height, PixelFormat format)
Stores a pointer to raw data in memory.
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.
bool getHasAlpha() const
Returns true if the image has an alpha component.
Image & loadRawData(DataStreamPtr &stream, uint32 width, uint32 height, PixelFormat format)
Loads raw data from a stream.
Image & load(DataStreamPtr &stream, const String &type=StringUtil::BLANK)
Loads an image file from a stream.
uint32 getDepth(void) const
Gets the depth of the image.
PixelFormat getFormat() const
Returns the image format.
static void applyGamma(uchar *buffer, Real gamma, size_t size, uchar bpp)
Does gamma adjustment.
uchar mPixelSize
The number of bytes per pixel.
static String getFileExtFromMagic(DataStreamPtr stream)
Static function to get an image type string from a stream via magic numbers.
const uchar * getData() const
Returns a const pointer to the internal image buffer.
void freeMemory()
Delete all the memory held by this image, if owned by this image (not dynamic)
virtual ~Image()
Standard destructor.
DataStreamPtr encode(const String &formatextension)
Encode the image and return a stream to the data.
static void scale(const PixelBox &src, const PixelBox &dst, Filter filter=FILTER_BILINEAR)
Scale a 1D, 2D or 3D image volume.
uint8 getNumMipmaps() const
Returns the number of mipmaps contained in the image.
size_t getRowSpan(void) const
Gets the physical width in bytes of each row of pixels.
PixelBox getPixelBox(size_t face=0, size_t mipmap=0) const
Get a PixelBox encapsulating the image data of a mipmap.
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
TRect< long > Rect
Structure used to define a rectangle in a 2-D integer space.
vector< constImage * >::type ConstImagePtrList
PixelFormat
The pixel format used for images, textures, and render surfaces.
vector< Image * >::type ImagePtrList
@ PF_BYTE_RGBA
4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
SharedPtr< DataStream > DataStreamPtr
Shared pointer to allow data streams to be passed around without worrying about deallocation.
unsigned char uchar
In order to avoid finger-aches :)
GeneralAllocatedObject ImageAlloc
float Real
Software floating point type.
Structure used to define a box in a 3-D integer space.