CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
Bitmap.h File Reference

In-memory RGBA raster image (Bitmap) with drawing primitives, resizing, BMP file I/O and delta/RLE compression (BitmapUpdate). More...

#include "MathClasses.h"
#include "DataMessage.h"
Include dependency graph for Bitmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cmlabs::tagBITMAPFILEHEADER_CM
 BMP file header (14 bytes), local packed definition so no windows.h dependency is needed. More...
struct  cmlabs::tagBITMAPINFOHEADER_CM
 BMP info header (40 bytes, BITMAPINFOHEADER equivalent), packed to 2-byte alignment for direct file mapping. More...
struct  cmlabs::tagRGBA
 One RGBA pixel value as separate byte components. More...
class  cmlabs::Pixel
 Reference to one pixel: coordinates plus a pointer directly into the owning Bitmap's data (no copy). More...
class  cmlabs::Bitmap
 32-bit RGBA raster image with drawing, compositing, scaling, BMP I/O and update-region tracking. More...
class  cmlabs::BitmapUpdate
 Transportable image update: either a full frame or a compressed (RLE and/or difference) delta against a previous frame. More...

Namespaces

namespace  cmlabs

Macros

#define GET_RGB_FROM_RGBA(a)
#define GET_R_FROM_RGBA(a)
#define GET_G_FROM_RGBA(a)
#define GET_B_FROM_RGBA(a)
#define GET_RGB_FROM_GRAY(a)
#define GET_RGB_FROM_COMP(r, g, b)
#define GET_GRAY_FROM_RGB(a)
#define GET_DRGB_FROM_2RGBS(a, b)
#define GET_FIRSTRGB_FROM_DRGB(a)
#define GET_SECONDRGB_FROM_DRGB(a)
#define DATACTRL   1
#define RLECTRL   2
#define DIFCTRL   3

Typedefs

typedef unsigned char cmlabs::CMBYTE
typedef unsigned int cmlabs::CMUINT
typedef unsigned int cmlabs::CMDWORD
typedef unsigned short cmlabs::CMWORD
typedef signed int cmlabs::CMLONG
typedef struct cmlabs::tagBITMAPFILEHEADER_CM cmlabs::BITMAPFILEHEADER_CM
 BMP file header (14 bytes), local packed definition so no windows.h dependency is needed.
typedef struct cmlabs::tagBITMAPINFOHEADER_CM cmlabs::BITMAPINFOHEADER_CM
 BMP info header (40 bytes, BITMAPINFOHEADER equivalent), packed to 2-byte alignment for direct file mapping.
typedef struct cmlabs::tagRGBA cmlabs::valRGBA
 One RGBA pixel value as separate byte components.

Functions

char * cmlabs::ImageResizeDown66 (char *bytesource, uint32 &cols, uint32 &rows)
 Shrink an RGBA image to 2/3 size (3→2 pixel averaging).
char * cmlabs::ImageResizeDown (char *bytesource, uint32 &cols, uint32 &rows, uint32 factor)
 Shrink an RGBA image by an integer factor (box averaging).
char * cmlabs::ImageResizeUp66 (char *bytesource, uint32 &cols, uint32 &rows)
 Enlarge an RGBA image to 3/2 size (2→3 pixel interpolation).
char * cmlabs::ImageResizeUp (char *bytesource, uint32 &cols, uint32 &rows, uint32 factor)
 Enlarge an RGBA image by an integer factor (pixel replication).

Detailed Description

In-memory RGBA raster image (Bitmap) with drawing primitives, resizing, BMP file I/O and delta/RLE compression (BitmapUpdate).

Pixels are stored as 32-bit RGBA in a contiguous buffer, row-major from the top-left. The GET_*_FROM_* macros manipulate packed pixel values and assume little-endian byte order (R in the lowest byte), matching the Windows BMP layout used by the file routines. BitmapUpdate carries either a full frame or a compressed difference so remote views can be refreshed incrementally.

Definition in file Bitmap.h.

Macro Definition Documentation

◆ DATACTRL

◆ DIFCTRL

◆ GET_B_FROM_RGBA

#define GET_B_FROM_RGBA ( a)
Value:
(unsigned char)((a & 0x00ff0000)>>16)

Definition at line 31 of file Bitmap.h.

Referenced by cmlabs::ImageResizeDown66().

◆ GET_DRGB_FROM_2RGBS

#define GET_DRGB_FROM_2RGBS ( a,
b )
Value:
(((unsigned int)GET_R_FROM_RGBA(a)>>3)<<27) + (((unsigned int)GET_G_FROM_RGBA(a)>>2)<<21) + (((unsigned int)GET_B_FROM_RGBA(a)>>3)<<16) + (((unsigned int)GET_R_FROM_RGBA(b)>>3)<<11) + (((unsigned int)GET_G_FROM_RGBA(b)>>2)<<5) + (((unsigned int)GET_B_FROM_RGBA(b)>>3)<<0)
#define GET_B_FROM_RGBA(a)
Definition Bitmap.h:31
#define GET_G_FROM_RGBA(a)
Definition Bitmap.h:30
#define GET_R_FROM_RGBA(a)
Definition Bitmap.h:29

Definition at line 37 of file Bitmap.h.

Referenced by cmlabs::Bitmap::runLengthDestructiveEncode().

◆ GET_FIRSTRGB_FROM_DRGB

#define GET_FIRSTRGB_FROM_DRGB ( a)
Value:
((unsigned int)((unsigned short)((a>>16)&0xF800)>>8)) | ((unsigned int)((unsigned short)((a>>16)&0xE000)>>13)) | ((unsigned int)((unsigned short)((a>>16)&0x07E0)<<5)) | ((unsigned int)((unsigned short)((a>>16)&0x0600))>>1) | ((unsigned int)((unsigned short)(a>>16)&0x001F)<<19) | (((unsigned int)(unsigned short)(a>>16)&0x001C)<<14)

Definition at line 38 of file Bitmap.h.

Referenced by cmlabs::Bitmap::updateBitmap().

◆ GET_G_FROM_RGBA

#define GET_G_FROM_RGBA ( a)
Value:
(unsigned char)((a & 0x0000ff00)>>8)

Definition at line 30 of file Bitmap.h.

Referenced by cmlabs::ImageResizeDown66().

◆ GET_GRAY_FROM_RGB

#define GET_GRAY_FROM_RGB ( a)
Value:
(unsigned char)((GET_R_FROM_RGBA(a)+GET_G_FROM_RGBA(a)+GET_B_FROM_RGBA(a))/3)

Definition at line 34 of file Bitmap.h.

Referenced by cmlabs::Bitmap::getGrayScaleDataCopy().

◆ GET_R_FROM_RGBA

#define GET_R_FROM_RGBA ( a)
Value:
(unsigned char)(a & 0x000000ff)

Definition at line 29 of file Bitmap.h.

Referenced by cmlabs::ImageResizeDown66().

◆ GET_RGB_FROM_COMP

#define GET_RGB_FROM_COMP ( r,
g,
b )
Value:
(unsigned int)((((unsigned int)b)<<16) + (((unsigned int)g)<<8) + (unsigned int)r)

Definition at line 33 of file Bitmap.h.

◆ GET_RGB_FROM_GRAY

#define GET_RGB_FROM_GRAY ( a)
Value:
(unsigned int)(((unsigned int)a<<16) + ((unsigned int)a<<8) + (unsigned int)a)

Definition at line 32 of file Bitmap.h.

Referenced by cmlabs::Bitmap::copyGrayScaleData().

◆ GET_RGB_FROM_RGBA

#define GET_RGB_FROM_RGBA ( a)
Value:
(a & 0x00ffffff)

Definition at line 19 of file Bitmap.h.

Referenced by cmlabs::ImageResizeDown66(), cmlabs::ImageResizeUp(), and cmlabs::ImageResizeUp66().

◆ GET_SECONDRGB_FROM_DRGB

#define GET_SECONDRGB_FROM_DRGB ( a)
Value:
((unsigned int)((unsigned short)(a&0xF800)>>8)) | ((unsigned int)((unsigned short)(a&0xE000)>>13)) | ((unsigned int)((unsigned short)(a&0x07E0)<<5)) | ((unsigned int)((unsigned short)(a&0x0600))>>1) | ((unsigned int)((unsigned short)a&0x001F)<<19) | (((unsigned int)(unsigned short)a&0x001C)<<14)

Definition at line 39 of file Bitmap.h.

Referenced by cmlabs::Bitmap::updateBitmap().

◆ RLECTRL