ADTF_DISPLAY_TOOLBOX  3.8.0 (ADTF 3.14.3)
IImageabstract

Image and bitmap handling. More...

Inheritance diagram for IImage:
[legend]

Public Types

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_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...
 

Public Member Functions

virtual tVoid Destroy ()=0
 Destroy the instance.
 
virtual tInt GetPixelFormat () const =0
 Returns the pixel format. More...
 
virtual tInt GetWidth () const =0
 Returns the width of the image. More...
 
virtual tInt GetHeight () const =0
 Returns the height of the image. More...
 
virtual tInt GetBitsPerPixel () const =0
 Returns the bits per pixel of the image. More...
 
virtual tInt GetBytesPerLine () const =0
 Returns the bytes per line of the image. More...
 
virtual tInt GetSize () const =0
 Returns the size of the image in bytes. More...
 
virtual tFloat64 GetRatio () const =0
 Returns the aspect ratio of the image. More...
 
virtual const tBitmapFormatGetFormat () const =0
 Returns the current bitmap format of the image. More...
 
virtual tWin32BitmapInfoGetBitmapInfo ()=0
 Generates a Win32 image descriptor. More...
 
virtual tColor * GetPalette () const =0
 Returns the color palette. More...
 
virtual tInt GetPaletteSize () const =0
 Returns the color palette size. More...
 
virtual tColor GetPaletteEntry (tInt nIdx) const =0
 Returns a color palette entry. More...
 
virtual tUInt8 * GetBitmap () const =0
 Returns a pointer to the raw data. More...
 
virtual tUInt8 * GetBitmapLine (tInt nY) const =0
 Returns a pointer to raw data of a line. More...
 
virtual tResult GetBits (tUInt8 *pDestBitmapData, const tBitmapFormat *psDestBitmapFormat, tInt nFlags=0)=0
 Retrieves the image's bitmap data. More...
 

Detailed Description

Image and bitmap handling.

The Image class encapsulates basic image handling methods.

Definition at line 28 of file image_intf.h.

Member Enumeration Documentation

◆ tBlitFlags

enum tBlitFlags

This enumeration is used for the Blit function.

It specifies additional operations to perform during blit

See also
Blit.
Enumerator
BLIT_VerticalFlip 

Blit with vertical flip.

BLIT_DontStretch 

Blit with no stretch and keep width-height-relation of image.

Definition at line 159 of file image_intf.h.

◆ tLoadFlags

enum tLoadFlags

The enum tLoadFlags specifies options available for image transformation.

Enumerator
LF_SWAP_RGB 

this flag is ignored, since it is not longer needed

LF_FLIP_VERTICAL 

perform a vertical flip

Definition at line 148 of file image_intf.h.

◆ tPixelFormat

The enum ePixelFormat specifies some common pixel formats, that is, descriptions of a byte to color mapping.

Most functions of IImage rely on the pixelformat for pixelconversions and access. Some need a special pixelformat in order to work correctly. Please refer to the documentation of the individual member functions.

Important: You have to know the tPixelformat flips intern the red and blue value of the tPixelformat.
This is because of Little-Endian, so a RGB is intern saved as BGR (Alpha-Channel is seperated).
This is just neccessary if you use methods with tUInt32 as RGBA value.
In the default settings, ADTF uses tPixelformat PF_BGRA_8888 so you can define your color (tUInt32) as RGBA-Type with Byte0=Red, Byte1=Green, Byte2=Blue and Byte3=Alpha_Channel.

Examples for color BlueViolet with RGB(138,43,226) or 0x8A2BE2 (=9055202 dec)

(1) cColor(138, 43, 226) // with default PF_BGRA_8888
(2) cColor::SetRGBA(cColor(138, 43, 226).GetRGBA()) // with default PF_BGRA_8888
(3) cColor::SetRGBA(9055202) // with default PF_BGRA_8888
(4) cColor::SetRGBA(9055202, PF_BGRA_8888)
(5) cColor::SetRGBA(14822282, PF_RGBA_8888)

Enumerator
PF_UNKNOWN 

unknown / not set

PF_8BIT 

8 bit

PF_GREYSCALE_8 

8 bit greyscale - default format for 8 bpp

PF_RGB_8 

8 bit RGB (R: 3 bit, G: 3 bit, B: 2 Bit) - palletized 8 bpp format

PF_16BIT 

16 bit This definition is a placeholder a 16 Bit format, bitorder is undefined.

PF_GREYSCALE_10 

10 bit greyscale To setup Format use tBitmapFormat::nBitsPerPixel = 16 ! the most significant (upper) bits are valid (11111111 11000000) A_UTILS convert just 8bit greyscales to display this format

PF_GREYSCALE_12 

12 bit greyscale To setup Format use tBitmapFormat::nBitsPerPixel = 16 ! the most significant (upper) bits are valid (11111111 11110000) A_UTILS convert just 8bit greyscales to display this format

PF_GREYSCALE_14 

14 bit greyscale To setup Format use tBitmapFormat::nBitsPerPixel = 16 ! the most significant (upper) bits are valid (11111111 11111100) A_UTILS convert just 8bit greyscales to display this format

PF_GREYSCALE_16 

16 bit greyscale

PF_RGB_444 

12 bit RGB (R: 4 bit, G: 4 bit, B: 4 bit)

PF_RGB_555 

15 bit RGB (R: 5 bit, G: 5 bit, B: 5 bit) - default format for 16 bpp

PF_RGB_565 

16 bit RGB (R: 5 bit, G: 6 bit, B: 5 bit)

PF_RGBA_4444 

16 bit RGBA (R: 4 bit, G: 4 bit, B: 4 bit, A: 4 bit) with alpha value

PF_ABGR_4444 

16 bit ABGR (A: 4 bit, B: 4 bit, G: 4 bit, R: 4 bit) with alpha value - inverted RGBA

PF_24BIT 

24 bit This definition is a placeholder a 24 Bit format, bitorder is undefined.

PF_GREYSCALE_24 

24 bit greyscale

PF_RGB_888 

24 bit RGB (R: 8 bit, G: 8 bit, B: 8 bit) - default format for 24 bpp

PF_BGR_888 

24 bit BGR (B: 8 bit, G: 8 bit, R: 8 bit) - inverted RGB

PF_32BIT 

32 bit This definition is a placeholder a 32 Bit format, bitorder is undefined.

PF_ARGB_8888 

32 bit ARGB (A: 8 bit, R: 8 bit, G: 8 bit, B: 8 bit) with alpha value

PF_ABGR_8888 

32 bit ABGR (A: 8 bit, B: 8 bit, G: 8 bit, R: 8 bit) with alpha value - inverted RGBA

PF_RGBA_8888 

32 bit RGBA (R: 8 bit, G: 8 bit, B: 8 bit, A: 8 bit) with alpha value - default format for 32 bpp

PF_BGRA_8888 

32 bit BGRA (B: 8 bit, G: 8 bit, R: 8 bit, A: 8 bit) with alpha value - inverted RGB + A

PF_GREYSCALE_32 

32 bit greyscale

PF_GREYSCALE_FLOAT32 

32 bit greyscale float value

PF_YUV420P_888 

24 bit YUV (Y: 8 bit, U: 8 bit, V: 8 bit) - Y = luminance, U+V = chrominance If using this format in the VideoDisplay a conversion to RBG will be done.

This is not very performant!

PF_CUSTOM 

custom

Definition at line 54 of file image_intf.h.

Member Function Documentation

◆ GetBitmap()

virtual tUInt8* GetBitmap ( ) const
pure virtual

Returns a pointer to the raw data.

Return values
tUInt8*pointer to the raw data.
NULLimage is not initialised.

Implemented in cImage.

◆ GetBitmapInfo()

virtual tWin32BitmapInfo* GetBitmapInfo ( )
pure virtual

Generates a Win32 image descriptor.

The GetBitmapInfo method generates a Win32 image descriptor structure.

Returns
Returns a pointer to the Win32 image descriptor structure.

Implemented in cImage.

◆ GetBitmapLine()

virtual tUInt8* GetBitmapLine ( tInt  nY) const
pure virtual

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!

Parameters
nY[in] The line number, starting at 0.
Return values
tUInt8*pointer to raw data of a line
NULLif index is out of bounds

Implemented in cImage.

◆ GetBits()

virtual tResult GetBits ( tUInt8 *  pDestBitmapData,
const tBitmapFormat psDestBitmapFormat,
tInt  nFlags = 0 
)
pure virtual

Retrieves the image's bitmap data.

The GetBits method retrieves the image's bitmap data.

Parameters
pDestBitmapData[in] Specifies the destination bitmap data.
psDestBitmapFormat[in] Specifies the destination bitmap format.
nFlags[in] Flags, see cImage::tBlitFlags
Return values
ERR_NOERRORall went well.
ERR_POINTERoSrcBitmapData or pSrcBitmapFormat is NULL

Implemented in cImage.

◆ GetBitsPerPixel()

virtual tInt GetBitsPerPixel ( ) const
pure virtual

Returns the bits per pixel of the image.

Returns
The bits per pixel of the image.

Implemented in cImage.

◆ GetBytesPerLine()

virtual tInt GetBytesPerLine ( ) const
pure virtual

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

Returns
The bytes per line of the image.

Implemented in cImage.

◆ GetFormat()

virtual const tBitmapFormat* GetFormat ( ) const
pure virtual

Returns the current bitmap format of the image.

See also
tBitmapFormat
Returns
Pointer to the current bitmap format of the image.

Implemented in cImage.

◆ GetHeight()

virtual tInt GetHeight ( ) const
pure virtual

Returns the height of the image.

Returns
The height of the image.

Implemented in cImage.

◆ GetPalette()

virtual tColor* GetPalette ( ) const
pure virtual

Returns the color palette.

Returns
The color palette.

Implemented in cImage.

◆ GetPaletteEntry()

virtual tColor GetPaletteEntry ( tInt  nIdx) const
pure virtual

Returns a color palette entry.

Parameters
nIdx[in] The index of the entry, starting at 0.
Returns
The color palette entry.

Implemented in cImage.

◆ GetPaletteSize()

virtual tInt GetPaletteSize ( ) const
pure virtual

Returns the color palette size.

Returns
The color palette size.

Implemented in cImage.

◆ GetPixelFormat()

virtual tInt GetPixelFormat ( ) const
pure virtual

Returns the pixel format.

Returns
The pixel format, see tPixelFormat.

Implemented in cImage.

◆ GetRatio()

virtual tFloat64 GetRatio ( ) const
pure virtual

Returns the aspect ratio of the image.

Returns
The aspect ratio of the image.

Implemented in cImage.

◆ GetSize()

virtual tInt GetSize ( ) const
pure virtual

Returns the size of the image in bytes.

Returns
The size of the image in bytes. My be bigger than w*h*(bpp/8) due to stuffing bytes

Implemented in cImage.

◆ GetWidth()

virtual tInt GetWidth ( ) const
pure virtual

Returns the width of the image.

Returns
The width of the image.

Implemented in cImage.