|
ADTF Display Toolbox
|
Image and bitmap handling. More...
#include <image.h>
Public Member Functions | |
| cImage () | |
| Default constructor. | |
| cImage (const cImage &oImage) | |
| Copy constructor. | |
| cImage (const IImage &oImage) | |
| Copy constructor. | |
| virtual | ~cImage () |
| Destructor. | |
| tVoid | Destroy () |
| Destroy the instance. | |
| tResult | Create (tInt nWidth, tInt nHeight, tInt nBitsPerPixel, tInt nBytesPerLine=0, const tUInt8 *pBitmap=nullptr, tInt nPixelFormat=0) |
| Creates a new image. | |
| tResult | Create (const tBitmapFormat *psFormat, const tColor *pPalette=nullptr, const tUInt8 *pBitmap=nullptr) |
| Creates a new image from a bitmap format description. | |
| tResult | Attach (tUInt8 *pBitmap, tInt nWidth, tInt nHeight, tInt nBitsPerPixel, tInt nBytesPerLine=0) |
| Attaches an image reference. | |
| tResult | Attach (tUInt8 *pBitmap, const tBitmapFormat *psFormat, const tColor *pPalette=nullptr) |
| Attaches an image reference. | |
| tResult | Load (const tChar *strFile, tUInt32 nFlags=0) |
| Loads an image from a file. | |
| tResult | Save (const tChar *strFile) |
| Saves the image to a file. | |
| tResult | Release () |
| Frees all allocated resources. | |
| tResult | SetPixelFormat (tInt nPixelFormat) |
| Sets the pixel format used. | |
| tInt | GetPixelFormat () const |
| Returns the pixel format. | |
| char const * | GetPixelFormatStr () const |
| Retrieves the image's pixel format as string. | |
| tInt | GetWidth () const |
| Returns the width of the image. | |
| tInt | GetHeight () const |
| Returns the height of the image. | |
| tInt | GetBitsPerPixel () const |
| Returns the bits per pixel of the image. | |
| tInt | GetBytesPerLine () const |
| Returns the bytes per line of the image. | |
| tInt | GetSize () const |
| Returns the size of the image in bytes. | |
| tFloat64 | GetRatio () const |
| Returns the aspect ratio of the image. | |
| const tBitmapFormat * | GetFormat () const override |
| Returns the current bitmap format of the image. | |
| tResult | SetPalette (tInt nPaletteSize, const tColor *pPalette) |
| Sets a color palette. | |
| tColor * | GetPalette () const |
| Returns the color palette. | |
| tInt | GetPaletteSize () const |
| Returns the color palette size. | |
| tColor | GetPaletteEntry (tInt nIdx) const |
| Returns a color palette entry. | |
| tResult | SetPaletteEntry (tInt nIdx, const tColor &sColor) |
| Sets an entry of the color palette. | |
| tUInt8 * | GetBitmap () const |
| Returns a pointer to the raw data. | |
| tUInt8 * | GetBitmapLine (tInt y) const |
| Returns a pointer to raw data of a line. | |
| tWin32BitmapInfo * | GetBitmapInfo () override |
| Generates a Win32 image descriptor. | |
| tInt | GetBitmapInfoSize () |
| Returns the size of the Win32 image descriptor. | |
| operator IImage * () | |
| instance of IImage | |
| tResult | Flip () |
| Flips the image upside down. | |
| tResult | Mirror () |
| Mirrors the image. | |
| tResult | Resize (tInt nWidth, tInt nHeight) |
| Resizes the image to the new height nHeight and width nWidth. | |
| tResult | ChangeDepth (tInt nBitsPerPixel, tInt nBytesPerLine=0, tUInt32 ui32Mask=0x0) |
| Changes the color depth. | |
| tResult | Convert (tInt nWidth, tInt nHeight, tInt nBitsPerPixel, tInt nBytesPerLine=0, tUInt32 ui32Mask=0x0) |
| Converts the image to new dimensions and color depth. | |
| tResult | Convert (const tBitmapFormat *psFormat, tUInt32 ui32Mask=0x0) |
| Converts the image to a new image format. | |
| tResult | Convert (tInt oPixelFormat) |
| Converts the image to a new image format. | |
| tResult | ChangePixelFormat (tInt nFormat, tUInt32 ui32Flags=0) |
| Changes the pixel format used. | |
| tResult | FlipRGB () |
| Flips RGB to BGR and the other way around. | |
| tResult | FlipAlpha () |
| Flips the alpha part from left to right and back:ARGB <-> RGBA and ABGR <-> BGRA. | |
| tResult | MakeAlphaChannel (const tColor &sColorKey, tBool bClearTransparent=tFalse) |
| Creates an alpha channel. | |
| tResult | Blit (const cImage &oDestImage, tInt nFlags=0) |
| Copies bitmap data from one image to another. | |
| tResult | SetBits (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat) |
| Sets the image's bitmap data. | |
| tResult | GetBits (tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags=0) |
| Retrieves the image's bitmap data. | |
| tBool | Compare (const disptb::graphicslib::dengar::cImage &oImage) |
| Compares the bitmaps of two images. | |
| tInt | CountDifferences (const disptb::graphicslib::dengar::cImage &oImage) |
| Compares the bitmaps of two images and counts the amount of different pixels. | |
| disptb::graphicslib::dengar::cImage & | operator= (const disptb::graphicslib::dengar::cImage &oImage) |
| Set the current image to the image oImage. | |
Static Public Member Functions | |
| static tInt | FlipRGBFormat (tInt nPixelFormat) |
| Returns the format with flipped RGB. | |
| static tInt | FlipToBGRFormat (tInt nPixelFormat) |
| Returns the pixel format flipped to BGR. | |
| static tInt | FlipToRGBFormat (tInt nPixelFormat) |
| Returns the pixel format flipped to RGB. | |
| static tResult | Blit (const disptb::graphicslib::dengar::cImage &oSrcImage, const disptb::graphicslib::dengar::cImage &oDestImage, tInt nFlags=0) |
| Copies bitmap data from one image to another. | |
| static tResult | Blit (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat, tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags=0) |
| Copies bitmap data from one image to another. | |
| static tResult | StretchBlit (const disptb::graphicslib::dengar::cImage &oSrcImage, const disptb::graphicslib::dengar::cImage &oDestImage, tInt nFlags=0) |
| Copies bitmap data from one image (with height H1 and width W1) to another image, stretching the scr image to the width and height of the dest image (with height H2 and width W2). | |
| static tResult | StretchBlit (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat, tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags=0) |
| Copies bitmap data from one image (with height H1 and width W1) to another image, stretching the scr image to the width and height of the dest image (with height H2 and width W2). | |
| static tResult | Convert (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat, tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags, tUInt32 ui32Mask) |
| Converts an image to another format. | |
| static tResult | AlphaBlend (disptb::graphicslib::dengar::cImage *pSourceImage, disptb::graphicslib::dengar::cImage *pDestImage, disptb::graphicslib::dengar::cImage *pMaskImage) |
| Alpha blends an image to a destination image. | |
| static tResult | BilinearStretchBlit (disptb::graphicslib::dengar::cImage &oSrc, disptb::graphicslib::dengar::cImage &oDest) |
| Copies an image to another using the bilinear algorithm. | |
| static tResult | SetTransparency (disptb::graphicslib::dengar::cImage *pImage, disptb::graphicslib::dengar::cColor oColor) |
| Helper method for setting transparency in bitmaps. | |
| static tUInt8 | RedValue (tUInt32 nColor) |
| Returns the red component of a color. | |
| static tUInt8 | GreenValue (tUInt32 nColor) |
| Returns the green component of a color. | |
| static tUInt8 | BlueValue (tUInt32 nColor) |
| Returns the blue component of a color. | |
| static tFloat64 | Brightness (tFloat64 fRed, tFloat64 fGreen, tFloat64 fBlue) |
| Calculates the bringhtness value of a color. | |
| static tInt | BrightnessValue (tInt nRed, tInt nGreen, tInt nBlue) |
| Calculates the bringhtness value of a color without scaling it down. | |
| static tUInt8 | Brightness (tInt nRed, tInt nGreen, tInt nBlue) |
| Calculates the bringhtness value of a color. | |
| static tUInt8 | Brightness (tColor nColor) |
| Calculates the bringhtness value of a color. | |
| static tUInt8 | Brightness (tUInt32 nColor) |
| Calculates the bringhtness value of a color. | |
| static tInt | CalcAlignedMemSize (tInt nBytes, tInt nAlignment) |
| Calculate the size of a given number of bytes to match a given alignment. | |
| static tInt | GuessPixelFormat (const tBitmapFormat *pFormat) |
| Tries to guess the PixelFormat based on the other parameters of a bitmap format. | |
| static tInt | GetBitsPerPixelFromFormat (tInt nFormat) |
| Retrieve image resolution from image format. | |
| static tInt | GetDefaultFormatFromBpp (tInt nBpp) |
| Retrieve image format based on image resolution. | |
| static tChar const * | GetPixelFormatIdentifier (const tInt nImage) |
| Returns the image format as string (enum to string) | |
| static int32_t | GetNextPowerOfTwo (int32_t const a) |
| static int32_t | CalcBitsPerPixelFromPixelFormat (int32_t const oPixelFormat) |
| static bool | NeedAlphaBlend (int32_t const oPixelFormat) |
Static Public Attributes | |
| static tInt | m_nDefaultMemoryAlignment = 16 |
| the default memory alignment used, currently 16 | |
| static tInt | m_nDefaultLineAlignment = 4 |
| the default line alignment, currently power of 2 | |
Protected Member Functions | |
| tResult | Initialize () |
| Initialize the image. | |
| tResult | Alloc (const tBitmapFormat *psFormat) |
| Allocates the image's bitmap buffer. | |
| tResult | Free () |
| Frees the image's bitmap buffer. | |
| tResult | AllocImpl (tInt nSize, tHandle *hMemory, tVoid **pBuffer) |
| Internal implementation of the allocation function. | |
| tResult | FreeImpl (tHandle hMemory) |
| Internal implementation of the free function. | |
| tResult | AllocPalette (tInt nPaletteSize) |
| Allocate space for a palette. | |
| tResult | FreePalette () |
| Frees space from palette. | |
| tResult | AllocBitmapInfo () |
| Allocate space for bitmap info. | |
| tResult | FreeBitmapInfo () |
| Free space from bitmap info. | |
| void | Yuv2Rgb (tUInt8 y, tUInt8 u, tUInt8 v, tUInt8 *pPixel) |
| tUInt8 | YFromRGB (tUInt8 *pPixel) |
| tUInt8 | UFromRGB (tUInt8 *pPixel) |
| tUInt8 | VFromRGB (tUInt8 *pPixel) |
Static Protected Member Functions | |
| static tResult | Blit_impl (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat, tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags) |
| Internal blitting operation. | |
| static tResult | StretchBlit_impl (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat, tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags, tUInt32 ui32Mask=0x0) |
| Internal blitting operation. | |
| static tResult | Convert_impl (const tUInt8 *pSrcBitmapData, const tBitmapFormat *psSrcBitmapFormat, tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags, tUInt32 ui32Mask) |
| will convert the bitmap from one format to another one. | |
| static tUInt8 | BlendPixel (tUInt8 c1, tUInt8 c2, tUInt8 c3, tUInt8 c4, tInt alpha_y, tInt alpha_x) |
| static tUInt32 | BlendRGB32 (tUInt32 c1, tUInt32 c2, tUInt32 c3, tUInt32 c4, tInt alpha_y, tInt alpha_x) |
| static tUInt16 | AdjustMasks (tUInt16 iSMask, tUInt16 iDMask, tInt &iPos) |
Protected Attributes | |
| tBool | m_bReference |
| flag indicating the m_pBitmap pointer is used as a reference | |
| tBitmapFormat | m_sFormat |
| current format of bitmap | |
| tWin32BitmapInfo * | m_psBitmapInfo |
| current bitmap info, windows style | |
| tInt | m_nBitmapInfoSize |
| size of windows bitmap info | |
| tColor * | m_pPalette |
| array of colors making up the palette | |
| tUInt8 * | m_pBitmap |
| actual pixel data, may be reference to data of other pic | |
| tHandle | m_hBitmapMemory |
| Handle for bitmap memory. | |
| tInt | m_nGreyPaletteSize |
| size of palette | |
Additional Inherited Members | |
Public Types inherited from IImage | |
| enum | tPixelFormat { PF_UNKNOWN = 0 , PF_8BIT = 10 , PF_GREYSCALE_8 = 11 , PF_RGB_8 = 12 , PF_16BIT = 20 , PF_GREYSCALE_10 = 21 , PF_GREYSCALE_12 = 22 , PF_GREYSCALE_14 = 23 , PF_GREYSCALE_16 = 24 , PF_RGB_444 = 25 , PF_RGB_555 = 26 , PF_RGB_565 = 27 , PF_RGBA_4444 = 28 , PF_ABGR_4444 = 29 , PF_RIII_10 = 30 , PF_RIII_12 = 31 , PF_RIII_14 = 32 , PF_RIII_16 = 33 , PF_BGR_555 = 34 , PF_BGR_565 = 35 , PF_24BIT = 40 , PF_GREYSCALE_18 = 41 , PF_GREYSCALE_20 = 42 , PF_GREYSCALE_22 = 43 , PF_GREYSCALE_24 = 44 , PF_RGB_888 = 45 , PF_BGR_888 = 46 , PF_32BIT = 50 , PF_ARGB_8888 = 51 , PF_ABGR_8888 = 52 , PF_RGBA_8888 = 53 , PF_BGRA_8888 = 54 , PF_GREYSCALE_32 = 55 , PF_GREYSCALE_FLOAT32 = 56 , PF_YUV420P_888 = 60 , PF_xRGB_8888 = 70 , PF_xBGR_8888 = 71 , PF_RGBx_8888 = 72 , PF_BGRx_8888 = 73 , PF_ARGB_1555 = 74 , PF_RGBA_5551 = 75 , PF_ABGR_1555 = 76 , PF_BGRA_5551 = 77 , PF_CUSTOM = 1000 } |
| The enum ePixelFormat specifies some common pixel formats, that is, descriptions of a byte to color mapping. More... | |
| enum | tLoadFlags { LF_SWAP_RGB = 0x0001 , LF_FLIP_VERTICAL = 0x0002 } |
| The enum tLoadFlags specifies options available for image transformation. More... | |
| enum | tBlitFlags { BLIT_VerticalFlip = 0x01 , BLIT_DontStretch = 0x02 } |
| This enumeration is used for the Blit function. More... | |
Image and bitmap handling.
The cImage class encapsulates basic image handling methods.
|
inline |
Default constructor.
Definition at line 130 of file image.h.
References Initialize().
Referenced by cImage(), Blit(), ChangePixelFormat(), Convert(), Save(), and StretchBlit_impl().
Copy constructor.
| oImage | [in] the other instance of IImage. |
Definition at line 147 of file image.h.
References Create(), IImage::GetBitmap(), IImage::GetBitsPerPixel(), IImage::GetBytesPerLine(), IImage::GetHeight(), IImage::GetPixelFormat(), IImage::GetWidth(), and Initialize().
|
inlinevirtual |
|
inlinestaticprotected |
|
inlineprotected |
Allocates the image's bitmap buffer.
| psFormat | [in] Specifies the image format. |
Definition at line 2881 of file image.h.
References AllocImpl(), CalcAlignedMemSize(), Free(), m_bReference, m_hBitmapMemory, m_nDefaultLineAlignment, m_pBitmap, m_sFormat, and tBitmapFormat::nSize.
Referenced by Create().
|
inlineprotected |
Allocate space for bitmap info.
Definition at line 3035 of file image.h.
References FreeBitmapInfo(), m_nBitmapInfoSize, m_nGreyPaletteSize, m_pPalette, m_psBitmapInfo, m_sFormat, tWin32BitmapInfoHeader::nBitCount, tWin32BitmapInfoHeader::nClrImportant, tWin32BitmapInfoHeader::nClrUsed, tWin32BitmapInfoHeader::nCompression, tWin32BitmapInfoHeader::nHeight, tWin32BitmapInfoHeader::nPlanes, tWin32BitmapInfoHeader::nSize, tWin32BitmapInfoHeader::nSizeImage, tWin32BitmapInfoHeader::nWidth, tWin32BitmapInfoHeader::nXPelsPerMeter, and tWin32BitmapInfoHeader::nYPelsPerMeter.
Referenced by GetBitmapInfo(), and GetBitmapInfoSize().
|
inlineprotected |
Internal implementation of the allocation function.
| nSize | [in] Size of allocation. |
| hMemory | [in] Memory handle. |
| pBuffer | [in] Destination buffer. |
Definition at line 2950 of file image.h.
References m_nDefaultMemoryAlignment.
Referenced by Alloc(), and ChangePixelFormat().
|
inlineprotected |
Allocate space for a palette.
| nPaletteSize | [in] Size of palette. |
Definition at line 2990 of file image.h.
References FreePalette(), m_pPalette, and m_sFormat.
Referenced by SetPalette().
|
inlinestatic |
Alpha blends an image to a destination image.
| pSourceImage | [in] The source image. |
| pDestImage | [in] The destination image. |
| pMaskImage | [in] The image that contains the alpha mask to use. |
| ERR_NOT_SUPPORTED | if pSourceImage or pDestImage are not PF_RGB_888, PF_BGR_888, PF_RGBA or PF_BGRA |
| ERR_NOERROR | if all went well |
Definition at line 1857 of file image.h.
References GetBitmap(), GetBytesPerLine(), GetHeight(), GetPixelFormat(), GetWidth(), IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_888, and IImage::PF_RGBA_8888.
|
inline |
Attaches an image reference.
The Attach method initializes the image format block, but doesn't allocate actual bitmap data. Instead, it references the bitmap data it was passed. It does, However, copy the bitmap format.
| pBitmap | [in] The external bitmap. |
| psFormat | [in] The format description of the bitmap. |
| pPalette | [in] An optional color palette array. |
| ERR_NOERRO | if all went well |
| ERR_FAILED | if a palette is provided, but bits per pixel is not 8 |
| ERR_MEMORY | if memory allocation for the palette failed |
| ERR_NOERROR | if all went well |
Definition at line 315 of file image.h.
References GetDefaultFormatFromBpp(), m_bReference, m_pBitmap, m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nPaletteSize, IImage::PF_GREYSCALE_8, Release(), and SetPalette().
|
inline |
Attaches an image reference.
The Attach method initializes the image format block, but doesn't allocate actual bitmap data.
| pBitmap | [in] The external bitmap. |
| nWidth | [in] The width of the bitmap. |
| nHeight | [in] The height of the bitmap. |
| nBitsPerPixel | [in] The pits per pixel of the bitmap. |
| nBytesPerLine | [in] The bytes per line (to account for padding bytes). Calculated for aligned memory if 0. |
| ERR_POINTER | if pBitmap is NULL. |
| ERR_NOERROR | if all went well |
Definition at line 276 of file image.h.
References Attach(), GetDefaultFormatFromBpp(), tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nPaletteSize, tBitmapFormat::nPixelFormat, tBitmapFormat::nSize, tBitmapFormat::nWidth, and Release().
Referenced by Attach().
|
inlinestatic |
Copies an image to another using the bilinear algorithm.
| oSrc | [in] The source image. |
| oDest | [in] The destination image. |
| ERR_POINTER | if either source or destination have no bitmap data or format data |
| ERR_NOERROR | if all went well |
| ERR_ERR_NOT_SUPPORTED | if the pixelformat is not either PF_RGB_888 or PF_RGBA_8888 |
| ERR_NOT_IMPL | if source and destination have a different format |
Definition at line 1942 of file image.h.
References GetBitmap(), GetFormat(), GetPixelFormat(), tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nWidth, IImage::PF_RGB_888, and IImage::PF_RGBA_8888.
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inline |
Copies bitmap data from one image to another.
The Blit method copies bitmap data from one image to another.
| oDestImage | [in] Specifies the destination image. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_NOT_SUPPORTED | if the blit needed a nont supported conversion |
| ERR_POINTER | if any of the input pointer was NULL |
Definition at line 1641 of file image.h.
References cImage(), Blit(), GetBitmap(), and GetFormat().
Referenced by Blit(), Blit(), GetBits(), and StretchBlit_impl().
|
inlinestatic |
Copies bitmap data from one image to another.
The Blit method copies bitmap data from one image to another.
| oSrcImage | [in] Specifies the source image. |
| oDestImage | [in] Specifies the destination image. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_NOT_SUPPORTED | if the blit needed a nont supported conversion |
| ERR_POINTER | if any of the input pointer was NULL |
Definition at line 1708 of file image.h.
References Blit(), GetBitmap(), and GetFormat().
|
inlinestatic |
Copies bitmap data from one image to another.
The Blit method copies bitmap data from one image to another.
| pSrcBitmapData | [in] Specifies the source bitmap data. |
| psSrcBitmapFormat | [in] Specifies the source bitmap format. |
| pDestBitmapData | [in] Specifies the destination bitmap buffer. |
| psDestBitmapFormat | [in] Specifies the destination bitmap format. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_NOT_SUPPORTED | if the blit needed a nont supported conversion |
| ERR_POINTER | if any of the input pointer was NULL |
Definition at line 1731 of file image.h.
References Blit_impl().
|
inlinestaticprotected |
Internal blitting operation.
| pSrcBitmapData | [in] Source bitmap data. |
| psSrcBitmapFormat | [in] Source bitmap format. |
| pDestBitmapData | [in] Destination bitmap data. |
| psDestBitmapFormat | [in] Destination bitmap format. |
| nFlags | [in] Blitting flags. |
Definition at line 3114 of file image.h.
References IImage::BLIT_VerticalFlip, Convert_impl(), tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, and tBitmapFormat::nPixelFormat.
Referenced by Blit().
|
inlinestatic |
Returns the blue component of a color.
| nColor | [in] The color. |
Definition at line 2159 of file image.h.
Referenced by Brightness().
|
inlinestatic |
Calculates the bringhtness value of a color.
| nColor | [in] The color. |
Definition at line 2213 of file image.h.
References BrightnessValue().
|
inlinestatic |
Calculates the bringhtness value of a color.
| fRed | [in] The red component (0.0-1.0). |
| fGreen | [in] The green component (0.0-1.0). |
| fBlue | [in] The blue component (0.0-1.0). |
Definition at line 2173 of file image.h.
Referenced by Convert_impl().
|
inlinestatic |
Calculates the bringhtness value of a color.
| nRed | [in] The red component. |
| nGreen | [in] The green component. |
| nBlue | [in] The blue component. |
Definition at line 2201 of file image.h.
References BrightnessValue().
|
inlinestatic |
Calculates the bringhtness value of a color.
| nColor | [in] The color as RGBA. |
Definition at line 2227 of file image.h.
References BlueValue(), BrightnessValue(), GreenValue(), and RedValue().
|
inlinestatic |
Calculates the bringhtness value of a color without scaling it down.
| nRed | [in] The red component. |
| nGreen | [in] The green component. |
| nBlue | [in] The blue component. |
Definition at line 2187 of file image.h.
Referenced by Brightness(), Brightness(), Brightness(), and Convert_impl().
|
inlinestatic |
Calculate the size of a given number of bytes to match a given alignment.
| nBytes | number of bytes to align |
| nAlignment | bytes to align with. |
Definition at line 2577 of file image.h.
Referenced by Alloc(), ChangePixelFormat(), Convert(), Create(), Load(), and StretchBlit_impl().
|
inlinestatic |
|
inline |
Changes the color depth.
| nBitsPerPixel | [in] The bits per pixel. |
| nBytesPerLine | [in] The bytes per line. |
| ui32Mask | [in] Only bits of color values in this bitmask will be considered. |
| ERR_NOERROR | if all went well |
| ERR_MEMORY | if memory reallocation failed |
| ERR_POINTER | if no image has been created, attached or loaded yet |
|
inline |
Changes the pixel format used.
This is a shortcut for convert, changing only the pixel format Can also convert between PF_RGB_888 <-> PF_YUV420P_888 PF_RGBA_8888 <-> PF_ARGB_8888 and PF_BGRA_8888 <-> PF_ABGR_8888. Supports also all conversions of the staic cImage::convert method
| nFormat | [in] The new pixel format tPixelFormat. |
| ui32Flags | unused |
| ERR_NOT_SUPPORTED | if conversion is not supported. |
| ERR_NOERROR | if all went well |
Definition at line 1306 of file image.h.
References cImage(), AllocImpl(), CalcAlignedMemSize(), Convert_impl(), Create(), FreeImpl(), GetBitmap(), GetBitsPerPixel(), GetDefaultFormatFromBpp(), GetFormat(), GetSize(), m_bReference, m_hBitmapMemory, m_nDefaultLineAlignment, m_pBitmap, m_sFormat, IImage::PF_16BIT, IImage::PF_24BIT, IImage::PF_32BIT, IImage::PF_8BIT, IImage::PF_RGB_888, IImage::PF_UNKNOWN, IImage::PF_YUV420P_888, and SetPixelFormat().
Referenced by MakeAlphaChannel(), and Save().
|
inline |
Compares the bitmaps of two images.
The format of both images must be the same.
| oImage | The image for comparison |
Definition at line 2481 of file image.h.
References GetBitmap(), m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nHeight, tBitmapFormat::nPixelFormat, and tBitmapFormat::nWidth.
|
inline |
Converts the image to a new image format.
| psFormat | [in] The new format. |
| ui32Mask | [in] Only bits of color values in this bitmask will be considered. This is used for 8bpp<->16bpp conversion of not listed pixel formats ONLY |
| ERR_POINTER | if psFormat is NULL |
| ERR_INVAILD_ARGUMENT | if nWidth or nHeight <= 0 |
| ERR_MEMORY | if memory reallocation failed |
| ERR_POINTER | if no image has been created, attached or loaded yet |
| ERR_NOERROR | if all went well |
Definition at line 1210 of file image.h.
References cImage(), CalcAlignedMemSize(), Convert_impl(), Create(), GetBitmap(), GetFormat(), GetSize(), m_nDefaultLineAlignment, m_pBitmap, m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nPixelFormat, tBitmapFormat::nSize, tBitmapFormat::nWidth, Release(), StretchBlit(), and StretchBlit_impl().
|
inlinestatic |
Converts an image to another format.
List of possible conversions: PF_GREYSCALE_8 -> PF_RGB_888, PF_BGR_888 PF_RGBA_8888, PF_BGRA_8888 PF_RGB_555, PF_RGB_565
PF_RGB_555/PF_RGB_565 -> PF_GREYSCALE_8 PF_BGR_888, PF_RGB_888 PF_RGBA_8888, PF_BGRA_888 PF_ARGB_8888, PF_ABGR_888
PF_RGB_888/PF_BGR -> PF_GREYSCALE_8 PF_RGB_555, PF_RGB_565 PF_BGR_888/PF_RGB_888 PF_ARGB_8888,PF_RGBA_8888,PF_BGRA_8888,PF_ABGR_8888
PF_RGBA_8888,PF_BGRA_8888 -> GREYSCALE_8
PF_ARGB_8888,PF_RGBA_8888,PF_BGRA_8888,PF_ABGR_8888 -> PF_RGB_555, PF_RGB_565 PF_ARGB_8888 / PF_ABGR_888 -> PF_RGB_888 / PF_BGR_888
| pSrcBitmapData | [in] Specifies the source bitmap data. |
| psSrcBitmapFormat | [in] Specifies the source bitmap format. |
| pDestBitmapData | [in] Specifies the destination bitmap buffer. |
| psDestBitmapFormat | [in] Specifies the destination bitmap format. |
| ui32Mask | [in] Only bits of color values in this bitmask will be considered. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_NOT_SUPPORTED | if conversio is not supported. |
Definition at line 1822 of file image.h.
References Convert_impl(), tBitmapFormat::nHeight, tBitmapFormat::nWidth, and StretchBlit_impl().
|
inline |
Converts the image to new dimensions and color depth.
| nWidth | [in] The new width. |
| nHeight | [in] The new height. |
| nBitsPerPixel | [in] The new color depth. |
| nBytesPerLine | [in] The new bytes per line value. |
| ui32Mask | [in] Only bits of color values in this bitmask will be considered. |
| ERR_INVAILD_ARGUMENT | if nWidth or nHeight <= 0 |
| ERR_MEMORY | if memory reallocation failed |
| ERR_POINTER | if no image has been created, attached or loaded yet |
| ERR_NOERROR | if all went well |
Definition at line 1185 of file image.h.
References Convert(), tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, and tBitmapFormat::nWidth.
Referenced by ChangeDepth(), Convert(), Convert(), FlipRGB(), Load(), Resize(), Save(), and SetTransparency().
|
inline |
Converts the image to a new image format.
| oPixelFormat | [in] The new pixel format. |
| ERR_INVALID_ARG | if given format is incompatible. |
| ERR_UNKNOWN_FORMAT | if format is too special. |
| ERR_NOERROR | if all went well |
Definition at line 1282 of file image.h.
References Convert(), m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nPaletteSize, tBitmapFormat::nPixelFormat, and tBitmapFormat::nSize.
|
inlinestaticprotected |
will convert the bitmap from one format to another one.
| [in] | nFlags | additional flags, allowed values
|
| [in] | pSrcBitmapData | pointer to the source bitmap Data |
| [in] | psSrcBitmapFormat | pointer to the bitmap format description |
| [in] | pDestBitmapData | pointer to the destination bitmap |
| [in] | psDestBitmapFormat | pointer to the destination bitmap format description |
| [in] | ui32Mask | mask for bit conversions |
Definition at line 3309 of file image.h.
References IImage::BLIT_VerticalFlip, Brightness(), BrightnessValue(), tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nPaletteSize, tBitmapFormat::nPixelFormat, tBitmapFormat::nWidth, IImage::PF_ABGR_4444, IImage::PF_ABGR_8888, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_CUSTOM, IImage::PF_GREYSCALE_16, IImage::PF_GREYSCALE_8, IImage::PF_RGB_444, IImage::PF_RGB_555, IImage::PF_RGB_565, IImage::PF_RGB_888, IImage::PF_RGBA_4444, IImage::PF_RGBA_8888, IImage::PF_UNKNOWN, and IImage::PF_YUV420P_888.
Referenced by Blit_impl(), ChangePixelFormat(), Convert(), Convert(), and StretchBlit_impl().
|
inline |
Compares the bitmaps of two images and counts the amount of different pixels.
The format of both images must be the same.
| oImage | The image for comparison |
Definition at line 2522 of file image.h.
References GetBitmap(), m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nHeight, tBitmapFormat::nPixelFormat, and tBitmapFormat::nWidth.
|
inline |
Creates a new image from a bitmap format description.
Please note that ALL fields of the format Description have to be correctly filled since none but the pixel format will be automatically calculated for you. This is especially important for the size of the bitmap. Even if width, height and bytes per line have been filled in, you still need to fill in the size or no buffer will be allocated.
| psFormat | [in] The format description. |
| pPalette | [in] An optional color palette array. |
| pBitmap | [in] A bitmap that the image data should be initialized with. |
| ERR_POINTER | if psFormat is NULL |
| ERR_MEMORY | if memory allocation for the data buffer failed |
| ERR_NOERROR | if all went well |
Definition at line 230 of file image.h.
References Alloc(), GetDefaultFormatFromBpp(), m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nPaletteSize, IImage::PF_GREYSCALE_8, IImage::PF_UNKNOWN, Release(), SetBits(), and SetPalette().
|
inline |
Creates a new image.
| nWidth | [in] The width of the image in pixels. |
| nHeight | [in] The height of the image in pixels. |
| nBitsPerPixel | [in] The bits per pixel |
| nBytesPerLine | [in] The bytes per line (optional). leave this to zero for automatic calculation[recommended!] If a value is passed for this parameter it will be used as is, no padding bytes will be added. |
| pBitmap | [in] A bitmap that the image data should be initialized with. |
| nPixelFormat | [in] The pixelformat to use, see tPixelFormat |
| ERR_MEMORY | if memory allocation for the data buffer failed, else ERR_NOERROR |
| ERR_NOERROR | if all went well |
Definition at line 186 of file image.h.
References CalcAlignedMemSize(), Create(), GetDefaultFormatFromBpp(), m_nDefaultLineAlignment, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nPaletteSize, tBitmapFormat::nPixelFormat, tBitmapFormat::nSize, tBitmapFormat::nWidth, and Release().
Referenced by cImage(), ChangePixelFormat(), Convert(), cGLTexture::Create(), Create(), Load(), operator=(), Save(), SetBits(), and StretchBlit_impl().
|
inlinevirtual |
|
inline |
|
inline |
Flips the alpha part from left to right and back:ARGB <-> RGBA and ABGR <-> BGRA.
| ERR_UNEXPECTED | if the BitsPerLine are zero |
| ERR_NOT_SUPPORTED | if Format is not PF_ABGR_8888, PF_BGRA_8888, PF_ARGB_8888 or PF_ARGB_8888 |
Definition at line 1494 of file image.h.
References GetBitmap(), GetBytesPerLine(), m_sFormat, IImage::PF_ABGR_8888, IImage::PF_ARGB_8888, IImage::PF_BGRA_8888, and IImage::PF_RGBA_8888.
|
inline |
Flips RGB to BGR and the other way around.
| ERR_NOT_SUPPORTED | if the format is not one of the following PF_RGB_444 <-> PF_BGR_444 PF_RGB_555 <-> PF_BGR_555 PF_RGB_565 <-> PF_BGR_565 PF_RGB_888 <-> PF_BGR_888 PF_RGBA_8888 <-> PF_BGRA_8888 PF_ARGB_8888 <-> PF_ABGR_8888 |
| ERR_NOERROR | if all went well |
Definition at line 1468 of file image.h.
References Convert(), m_pBitmap, m_sFormat, tBitmapFormat::nPixelFormat, IImage::PF_ABGR_8888, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_888, and IImage::PF_RGBA_8888.
|
inlinestatic |
Returns the format with flipped RGB.
Example: PF_RGB_888 gets flipped to PF_BGR_888
| nPixelFormat | [in] The new pixel format, see tPixelFormat. |
Definition at line 635 of file image.h.
References IImage::PF_ABGR_4444, IImage::PF_ABGR_8888, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_555, IImage::PF_RGB_565, IImage::PF_RGB_888, IImage::PF_RGBA_4444, IImage::PF_RGBA_8888, and IImage::PF_UNKNOWN.
|
inlinestatic |
Returns the pixel format flipped to BGR.
Example 1: PF_RGB_555 gets flipped to PF_BGR_888 Example 2: PF_RGBA_8888 gets flipped to PF_BGRA_8888
| nPixelFormat | [in] The new pixel format, see tPixelFormat. |
Definition at line 664 of file image.h.
References IImage::PF_ABGR_4444, IImage::PF_ABGR_8888, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_555, IImage::PF_RGB_565, IImage::PF_RGB_888, IImage::PF_RGBA_4444, IImage::PF_RGBA_8888, and IImage::PF_UNKNOWN.
|
inlinestatic |
Returns the pixel format flipped to RGB.
Example 1: PF_BGR_555 gets flipped to PF_RGB_555 Example 2: PF_BGRA_8888 gets flipped to PF_RGBA_8888
| nPixelFormat | [in] The new pixel format, see tPixelFormat. |
Definition at line 687 of file image.h.
References IImage::PF_ABGR_4444, IImage::PF_ABGR_8888, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_555, IImage::PF_RGB_565, IImage::PF_RGB_888, IImage::PF_RGBA_4444, IImage::PF_RGBA_8888, and IImage::PF_UNKNOWN.
|
inlineprotected |
Frees the image's bitmap buffer.
Definition at line 2916 of file image.h.
References FreeBitmapInfo(), FreeImpl(), FreePalette(), m_bReference, m_hBitmapMemory, m_pBitmap, and m_sFormat.
|
inlineprotected |
Free space from bitmap info.
Definition at line 3089 of file image.h.
References m_nBitmapInfoSize, and m_psBitmapInfo.
Referenced by AllocBitmapInfo(), and Free().
|
inlineprotected |
Internal implementation of the free function.
| hMemory | [in] Memory handle. |
Definition at line 2976 of file image.h.
Referenced by ChangePixelFormat(), and Free().
|
inlineprotected |
Frees space from palette.
Definition at line 3016 of file image.h.
References m_nGreyPaletteSize, m_pPalette, and m_sFormat.
Referenced by AllocPalette(), Free(), and SetPalette().
|
inlinevirtual |
Returns a pointer to the raw data.
Implements IImage.
Definition at line 897 of file image.h.
References m_pBitmap.
Referenced by AlphaBlend(), BilinearStretchBlit(), Blit(), Blit(), ChangePixelFormat(), Compare(), Convert(), CountDifferences(), cGLTexture::Create(), FlipAlpha(), GetBits(), MakeAlphaChannel(), operator=(), Save(), SetTransparency(), StretchBlit(), and StretchBlit_impl().
|
inlineoverridevirtual |
Generates a Win32 image descriptor.
The GetBitmapInfo method generates a Win32 image descriptor structure.
Implements IImage.
Definition at line 923 of file image.h.
References AllocBitmapInfo(), and m_psBitmapInfo.
Referenced by Save(), and SetTransparency().
|
inline |
Returns the size of the Win32 image descriptor.
Definition at line 941 of file image.h.
References AllocBitmapInfo(), and m_nBitmapInfoSize.
|
inlinevirtual |
Returns a pointer to raw data of a line.
Get the specified line of the bitmap. Use this function rather than calculating the line yourself, since the actual linewidth might vary due to stuffing bytes!
| y | [in] The line number, starting at 0. |
Implements IImage.
|
inlinevirtual |
Retrieves the image's bitmap data.
The GetBits method retrieves the image's bitmap data.
| pDestBitmapData | [in] Specifies the destination bitmap data. |
| psDestBitmapFormat | [in] Specifies the destination bitmap format. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_POINTER | if oSrcBitmapData or pSrcBitmapFormat is NULL |
Implements IImage.
Definition at line 1688 of file image.h.
References Blit(), GetBitmap(), and GetFormat().
|
inlinevirtual |
Returns the bits per pixel of the image.
Implements IImage.
Definition at line 727 of file image.h.
References m_sFormat.
Referenced by ChangePixelFormat().
|
inlinestatic |
|
inlinevirtual |
Returns the bytes per line of the image.
Since the actual linewidth may be bigger than the with of the image * bytesperpixel, use this function to retrieve the actual line width including stuffing bytes
Implements IImage.
Definition at line 739 of file image.h.
References m_sFormat.
Referenced by AlphaBlend(), FlipAlpha(), MakeAlphaChannel(), and SetTransparency().
|
inlinestatic |
Retrieve image format based on image resolution.
| nBpp | [in] Image resolution. |
Definition at line 2647 of file image.h.
References IImage::PF_GREYSCALE_8, IImage::PF_RGB_555, IImage::PF_RGB_888, IImage::PF_RGBA_8888, and IImage::PF_UNKNOWN.
Referenced by Attach(), Attach(), ChangePixelFormat(), Create(), Create(), and Save().
|
inlineoverridevirtual |
Returns the current bitmap format of the image.
Implements IImage.
Definition at line 776 of file image.h.
References m_sFormat.
Referenced by BilinearStretchBlit(), Blit(), Blit(), ChangePixelFormat(), Convert(), GetBits(), SetBits(), SetTransparency(), StretchBlit(), and StretchBlit_impl().
|
inlinevirtual |
Returns the height of the image.
Implements IImage.
Definition at line 717 of file image.h.
References m_sFormat.
Referenced by AlphaBlend(), MakeAlphaChannel(), Resize(), and SetTransparency().
|
inlinestatic |
|
inlinevirtual |
Returns the color palette.
Implements IImage.
Definition at line 838 of file image.h.
References m_pPalette.
|
inlinevirtual |
Returns a color palette entry.
| nIdx | [in] The index of the entry, starting at 0. |
Implements IImage.
Definition at line 860 of file image.h.
References m_pPalette, and m_sFormat.
|
inlinevirtual |
|
inlinevirtual |
Returns the pixel format.
Implements IImage.
Definition at line 611 of file image.h.
References m_sFormat.
Referenced by AlphaBlend(), BilinearStretchBlit(), GetPixelFormatStr(), MakeAlphaChannel(), and SetTransparency().
|
inlinestatic |
Returns the image format as string (enum to string)
| nImage | [in] Image format. |
Definition at line 2666 of file image.h.
References IImage::PF_16BIT, IImage::PF_24BIT, IImage::PF_32BIT, IImage::PF_8BIT, IImage::PF_ABGR_1555, IImage::PF_ABGR_4444, IImage::PF_ABGR_8888, IImage::PF_ARGB_1555, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_5551, IImage::PF_BGRA_8888, IImage::PF_BGRx_8888, IImage::PF_CUSTOM, IImage::PF_GREYSCALE_10, IImage::PF_GREYSCALE_12, IImage::PF_GREYSCALE_14, IImage::PF_GREYSCALE_16, IImage::PF_GREYSCALE_24, IImage::PF_GREYSCALE_32, IImage::PF_GREYSCALE_8, IImage::PF_GREYSCALE_FLOAT32, IImage::PF_RGB_444, IImage::PF_RGB_555, IImage::PF_RGB_565, IImage::PF_RGB_8, IImage::PF_RGB_888, IImage::PF_RGBA_4444, IImage::PF_RGBA_5551, IImage::PF_RGBA_8888, IImage::PF_RGBx_8888, IImage::PF_UNKNOWN, IImage::PF_xBGR_8888, IImage::PF_xRGB_8888, and IImage::PF_YUV420P_888.
Referenced by cGLTexture::Create(), and GetPixelFormatStr().
|
inline |
Retrieves the image's pixel format as string.
Definition at line 623 of file image.h.
References GetPixelFormat(), and GetPixelFormatIdentifier().
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Returns the width of the image.
Implements IImage.
Definition at line 707 of file image.h.
References m_sFormat.
Referenced by AlphaBlend(), Resize(), and SetTransparency().
|
inlinestatic |
Returns the green component of a color.
| nColor | [in] The color. |
Definition at line 2147 of file image.h.
Referenced by Brightness().
|
inlinestatic |
Tries to guess the PixelFormat based on the other parameters of a bitmap format.
| [in] | pFormat | The input format to base the guess on. If the nPixelFormat member is set to something other than PF_UNKNOWN, this value is returned. |
Definition at line 2603 of file image.h.
References tBitmapFormat::nBitsPerPixel, tBitmapFormat::nHeight, tBitmapFormat::nPixelFormat, tBitmapFormat::nSize, tBitmapFormat::nWidth, IImage::PF_GREYSCALE_8, IImage::PF_RGB_555, IImage::PF_RGB_888, IImage::PF_RGBA_8888, and IImage::PF_UNKNOWN.
|
inlineprotected |
Initialize the image.
Definition at line 2859 of file image.h.
References m_bReference, m_hBitmapMemory, m_nBitmapInfoSize, m_nGreyPaletteSize, m_pBitmap, m_pPalette, m_psBitmapInfo, and m_sFormat.
|
inline |
Loads an image from a file.
This loads an image from a fileassuming the following pixelformats: 24 bit: PF_RGB_888 32 bit: PF_RGBA_8888 You may overwrite the pixelformat with SetPixelFormat
Currently only the BMP Format is supported.
| strFile | [in] The filename. |
| nFlags | [in] Special Flags, see tLoadFlags. |
| ERR_NOERROR | if all went well |
| ERR_POINTER | if strFile is NULL |
| ERR_NOERROR | if all went well. |
| ERR_OPEN_FAILED | if the file could not be opened ( e.g. does not exist ) |
| ERR_INVALID_FILE | if file could be opened but is no compatible bitmap |
| ERR_NOT_SUPPORTED | if the file's bits per pixel is less than 8 |
| ERR_MEMORY | if memory allocation for the buffer failed |
Definition at line 364 of file image.h.
References CalcAlignedMemSize(), Convert(), Create(), Flip(), GetPaletteSize(), IImage::LF_FLIP_VERTICAL, m_nGreyPaletteSize, m_pBitmap, m_pPalette, m_sFormat, tWin32BitmapInfoHeader::nBitCount, tWin32BitmapInfoHeader::nHeight, tWin32BitmapInfoHeader::nWidth, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_888, IImage::PF_RGBA_8888, Release(), tBitmapFileHeader::ui16Type, and tBitmapFileHeader::ui32DataOffset.
|
inline |
Creates an alpha channel.
| sColorKey | [in] The alpha value of pixels with this color will be set to 0, all others will get 0xFF. A given alpha channel will be ignored |
| bClearTransparent | [in] If tTrue then pixels matching sColorKey will be set to black. |
| ERR_NOERROR | if all went well. |
| ERR_NOT_SUPPORTED | if no conversion could be found to convert to PF_RGBA_888 |
| ERR_POINTER | if no image has been loaded, attached or created yet |
Definition at line 1574 of file image.h.
References ChangePixelFormat(), GetBitmap(), GetBytesPerLine(), GetHeight(), GetPixelFormat(), and IImage::PF_RGBA_8888.
|
inline |
|
inlinestatic |
|
inline |
|
inline |
Set the current image to the image oImage.
| oImage | [in] Given Image. |
Definition at line 4403 of file image.h.
References Create(), GetBitmap(), m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nPixelFormat, and tBitmapFormat::nWidth.
|
inlinestatic |
Returns the red component of a color.
| nColor | [in] The color. |
Definition at line 2135 of file image.h.
Referenced by Brightness().
|
inline |
|
inline |
Resizes the image to the new height nHeight and width nWidth.
This function is calling the Convert() function, in which the parameters nBytesPerLine and ui32Mask are not specified and nBitsPerPixel stays unchanged. In this special case, the Convert() function calls the function StretchBlit(), in which the image is resized by a "Nearest Neighbour" algorithm. For further information about the implemented Nearest Neighbour algorithm, please have a look at StretchBlit().
| nWidth | [in] The new width. |
| nHeight | [in] The new height. |
| ERR_NOERROR | if all went well. |
| ERR_INVAILD_ARGUMENT | if nWidth or nHeight <= 0 |
| ERR_MEMORY | if memory reallocation failed |
| ERR_POINTER | if no image has been created, attached or loaded yet |
Definition at line 1128 of file image.h.
References Convert(), GetHeight(), GetWidth(), m_pBitmap, and m_sFormat.
|
inline |
Saves the image to a file.
This saves the raw image as is allowing you to save your data in what ever format it currenntly is. Since the format information, except the bpp, is not stored along in the resulting file, you have to use this with care.
| strFile | [in] The filename. |
| ERR_NOERROR | if all went well |
| ERR_POINTER | if strFile is NULL |
| ERR_OPEN_FAILED | if the file could not be created |
| ERR_DEVICE_IO | if there was an error while writing |
| ERR_NOT_IMPL | if this function is called in non WIN32 environments. |
Definition at line 458 of file image.h.
References cImage(), ChangePixelFormat(), Convert(), Create(), Flip(), GetBitmap(), GetBitmapInfo(), GetDefaultFormatFromBpp(), m_nGreyPaletteSize, m_pBitmap, m_pPalette, m_sFormat, IImage::PF_16BIT, IImage::PF_24BIT, IImage::PF_32BIT, IImage::PF_8BIT, IImage::PF_BGR_888, IImage::PF_BGRA_8888, IImage::PF_RGB_888, IImage::PF_YUV420P_888, Save(), tBitmapFileHeader::ui16Reserved1, tBitmapFileHeader::ui16Reserved2, tBitmapFileHeader::ui16Type, tBitmapFileHeader::ui32DataOffset, and tBitmapFileHeader::ui32Size.
Referenced by Save().
|
inline |
Sets the image's bitmap data.
The SetBits method sets the image's bitmap data, and will release the current buffer if format differs. When format not differs it will only overwrite the current buffer.
| pSrcBitmapData | [in] Specifies the source bitmap data. |
| psSrcBitmapFormat | [in] Specifies the source bitmap format. |
| ERR_POINTER | if pSrcBitmapData or psSrcBitmapFormat |
| ERR_MEMORY | if a problem occured during creation of new image buffer |
| ERR_NOERROR | if all went well |
Definition at line 1660 of file image.h.
References Create(), GetFormat(), GetSize(), m_pBitmap, and Release().
Referenced by Create().
|
inline |
Sets a color palette.
| nPaletteSize | [in] The size of the pPalette array |
| pPalette | [in] The color palette array. If this is NULL, initialises palette as greyscale |
| ERR_NOERROR | if all went well. |
| ERR_NOT_SUPPORTED | if bits per pixel are not 8 |
| ERR_MEMORY | if memory allocation for the palette failed |
Definition at line 791 of file image.h.
References AllocPalette(), FreePalette(), m_nGreyPaletteSize, m_pPalette, m_sFormat, IImage::PF_GREYSCALE_8, and IImage::PF_RGB_8.
|
inline |
Sets an entry of the color palette.
| nIdx | [in] The index of the entry, starting at 0. |
| sColor | [in] The new color value. |
| ERR_INVALID_ARG | if nIdx is not part of the palette |
| ERR_NOERROR | if all went well |
Definition at line 880 of file image.h.
References m_pPalette, and m_sFormat.
|
inline |
Sets the pixel format used.
Does NOT perform a conversion.
| nPixelFormat | [in] The new pixel format, see tPixelFormat. |
Definition at line 599 of file image.h.
References m_sFormat.
Referenced by ChangePixelFormat().
|
inlinestatic |
Helper method for setting transparency in bitmaps.
(BMP doesn't know anything about transparency) The alpha channel for all pixels with the given color will be set to 0. If the images is of format other than PF_RGBA_8888 and PF_BGRA_8888 it will be converted to PF_RGBA_8888.
| pImage | [in/out] Pointer to the image which gets transparent pixels |
| oColor | [in] The color of the pixels which will converted to transparent |
Definition at line 2081 of file image.h.
References Convert(), GetBitmap(), GetBitmapInfo(), GetBytesPerLine(), GetFormat(), GetHeight(), GetPixelFormat(), cColor::GetRGBA(), GetWidth(), tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nPixelFormat, IImage::PF_BGRA_8888, and IImage::PF_RGBA_8888.
|
inlinestatic |
Copies bitmap data from one image (with height H1 and width W1) to another image, stretching the scr image to the width and height of the dest image (with height H2 and width W2).
The stretching is done via a Nearest Neighbour algorithm. The value for the pixel (x_n,y_m) in the dest image is given by the value of the pixel: (x,y)= ( |_ (x_n*W1)/W2 _| , |_ (y_m*H1)/H2 _| ) of the src image. |_x_| stands for the mathematical floor function (e.g. |_1.34_| = 1).
| oSrcImage | [in] Specifies the source image. |
| oDestImage | [in] Specifies the destination image. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_NO_SUPPORTED | if a pixelformat conversion was needed but was not supported |
Definition at line 1755 of file image.h.
References GetBitmap(), GetFormat(), and StretchBlit().
Referenced by Convert(), and StretchBlit().
|
inlinestatic |
Copies bitmap data from one image (with height H1 and width W1) to another image, stretching the scr image to the width and height of the dest image (with height H2 and width W2).
The stretching is done via a Nearest Neighbour algorithm. The value for the pixel (x_n,y_m) in the dest image is given by the value of the pixel: (x,y)= ( |_ (x_n*W1)/W2 _| , |_ (y_m*H1)/H2 _| ) of the src image. |_x_| stands for the mathematical floor function (e.g. |_1.34_| = 1).
| pSrcBitmapData | [in] Specifies the source bitmap data. |
| psSrcBitmapFormat | [in] Specifies the source bitmap format. |
| pDestBitmapData | [in] Specifies the destination bitmap buffer. |
| psDestBitmapFormat | [in] Specifies the destination bitmap format. |
| nFlags | [in] Flags, see tBlitFlags |
| ERR_NOERROR | if all went well. |
| ERR_NO_SUPPORTED | if a pixelformat conversion was needed but was not supported |
Definition at line 1780 of file image.h.
References StretchBlit_impl().
|
inlinestaticprotected |
Internal blitting operation.
| pSrcBitmapData | [in] Source bitmap data. |
| psSrcBitmapFormat | [in] Source bitmap format. |
| pDestBitmapData | [in] Destination bitmap data. |
| psDestBitmapFormat | [in] Destination bitmap format. |
| nFlags | [in] Blitting flags. |
| ui32Mask | [in] Blitting mask. |
Definition at line 3182 of file image.h.
References cImage(), Blit(), CalcAlignedMemSize(), Convert_impl(), Create(), GetBitmap(), GetFormat(), m_nDefaultLineAlignment, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nBytesPerLine, tBitmapFormat::nHeight, tBitmapFormat::nPixelFormat, and tBitmapFormat::nWidth.
Referenced by Convert(), Convert(), and StretchBlit().
|
inlineprotected |
|
protected |
flag indicating the m_pBitmap pointer is used as a reference
Definition at line 114 of file image.h.
Referenced by Alloc(), Attach(), ChangePixelFormat(), Free(), and Initialize().
|
protected |
Handle for bitmap memory.
Definition at line 122 of file image.h.
Referenced by Alloc(), ChangePixelFormat(), Free(), and Initialize().
|
protected |
size of windows bitmap info
Definition at line 118 of file image.h.
Referenced by AllocBitmapInfo(), FreeBitmapInfo(), GetBitmapInfoSize(), and Initialize().
|
inlinestatic |
the default line alignment, currently power of 2
Definition at line 111 of file image.h.
Referenced by Alloc(), ChangePixelFormat(), Convert(), cGLTexture::Create(), Create(), and StretchBlit_impl().
|
inlinestatic |
the default memory alignment used, currently 16
Definition at line 110 of file image.h.
Referenced by AllocImpl().
|
protected |
size of palette
Definition at line 124 of file image.h.
Referenced by AllocBitmapInfo(), FreePalette(), Initialize(), Load(), Save(), and SetPalette().
|
protected |
actual pixel data, may be reference to data of other pic
Definition at line 121 of file image.h.
Referenced by Alloc(), Attach(), ChangePixelFormat(), Convert(), Flip(), FlipRGB(), Free(), GetBitmap(), GetBitmapLine(), Initialize(), Load(), Mirror(), Resize(), Save(), and SetBits().
|
protected |
array of colors making up the palette
Definition at line 120 of file image.h.
Referenced by AllocBitmapInfo(), AllocPalette(), FreePalette(), GetPalette(), GetPaletteEntry(), Initialize(), Load(), Save(), SetPalette(), and SetPaletteEntry().
|
protected |
current bitmap info, windows style
Definition at line 117 of file image.h.
Referenced by AllocBitmapInfo(), FreeBitmapInfo(), GetBitmapInfo(), and Initialize().
|
protected |
current format of bitmap
Definition at line 116 of file image.h.
Referenced by Alloc(), AllocBitmapInfo(), AllocPalette(), Attach(), ChangeDepth(), ChangePixelFormat(), Compare(), Convert(), Convert(), CountDifferences(), Create(), Flip(), FlipAlpha(), FlipRGB(), Free(), FreePalette(), GetBitmapLine(), GetBitsPerPixel(), GetBytesPerLine(), GetFormat(), GetHeight(), GetPaletteEntry(), GetPaletteSize(), GetPixelFormat(), GetRatio(), GetSize(), GetWidth(), Initialize(), Load(), Mirror(), operator=(), Resize(), Save(), SetPalette(), SetPaletteEntry(), and SetPixelFormat().