CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::BitmapUpdate Class Reference

Transportable image update: either a full frame or a compressed (RLE and/or difference) delta against a previous frame. More...

#include <Bitmap.h>

Public Types

enum  Type {
  FULL , RUNLENGTH , RL16 , DIF ,
  DIFRUNLENGTH , NONE
}
 Payload encoding: FULL raw frame, RUNLENGTH RLE frame, RL16 16-bit RLE, DIF raw difference, DIFRUNLENGTH RLE difference, NONE empty. More...

Public Member Functions

 BitmapUpdate ()
 Empty update.
 BitmapUpdate (uint32 w, uint32 h)
 Pre-sized update for a w x h frame.
 BitmapUpdate (const char *filename, bool compress)
 Load a BMP file as an update.
virtual ~BitmapUpdate ()
bool init (uint32 w, uint32 h)
 (Re)initialize for a w x h frame.
bool reset ()
 Release the payload.
bool update (BitmapUpdate *update)
 Merge a newer update into this one.
BitmaptoBitmap ()
 Decode into a new full Bitmap (caller owns); requires a FULL-equivalent payload.
bool setUpdateType (BitmapUpdate::Type updateType)
 Set the payload encoding tag.
BitmapUpdate::Type getUpdateType ()
bool setFullUpdate (Bitmap *bitmap)
 Fill as an uncompressed full frame from bitmap.
bool readFromFile (const char *filename)
 Load a BMP file as a FULL update.
bool readFromFileRLE (const char *filename)
 Load a BMP file and RLE-compress it.
bool readFromFileDiff (const char *filename, Bitmap *oldBitmap)
 Load a BMP file and store the difference against oldBitmap.
bool readFromFileRLEDiff (const char *filename, Bitmap *oldBitmap)
 Load, difference against oldBitmap and RLE-compress.

Public Attributes

enum cmlabs::BitmapUpdate::Type type
uint32 width
 Frame width in pixels.
uint32 height
 Frame height in pixels.
uint32 size
 Payload size in bytes.
char * data
 Encoded payload (interpretation depends on type).

Detailed Description

Transportable image update: either a full frame or a compressed (RLE and/or difference) delta against a previous frame.

Produced by Bitmap::operator-, runLengthEncode() and getCompressedUpdate(); consumed by Bitmap::updateBitmap(). Difference-typed updates (DIF, DIFRUNLENGTH) are only meaningful when applied to a bitmap holding the exact frame they were diffed against, and of matching dimensions; applying them to anything else yields garbage pixels. Only FULL-equivalent payloads can be decoded standalone via toBitmap(). The object owns data and releases it in reset()/destructor.

Definition at line 317 of file Bitmap.h.

Member Enumeration Documentation

◆ Type

Payload encoding: FULL raw frame, RUNLENGTH RLE frame, RL16 16-bit RLE, DIF raw difference, DIFRUNLENGTH RLE difference, NONE empty.

Enumerator
FULL 
RUNLENGTH 
RL16 
DIF 
DIFRUNLENGTH 
NONE 

Definition at line 321 of file Bitmap.h.

Constructor & Destructor Documentation

◆ BitmapUpdate() [1/3]

cmlabs::BitmapUpdate::BitmapUpdate ( )

Empty update.

Definition at line 4136 of file Bitmap.cpp.

References init().

Referenced by update().

◆ BitmapUpdate() [2/3]

cmlabs::BitmapUpdate::BitmapUpdate ( uint32 w,
uint32 h )

Pre-sized update for a w x h frame.

Definition at line 4140 of file Bitmap.cpp.

References init().

◆ BitmapUpdate() [3/3]

cmlabs::BitmapUpdate::BitmapUpdate ( const char * filename,
bool compress )

Load a BMP file as an update.

Parameters
filenameBMP file path.
compressRLE-compress the payload.

Definition at line 4144 of file Bitmap.cpp.

References init(), readFromFile(), and readFromFileRLE().

◆ ~BitmapUpdate()

cmlabs::BitmapUpdate::~BitmapUpdate ( )
virtual

Definition at line 4156 of file Bitmap.cpp.

References reset().

Member Function Documentation

◆ getUpdateType()

BitmapUpdate::Type cmlabs::BitmapUpdate::getUpdateType ( )

◆ init()

bool cmlabs::BitmapUpdate::init ( uint32 w,
uint32 h )

(Re)initialize for a w x h frame.

Returns
true on success.

Definition at line 4160 of file Bitmap.cpp.

References height, and width.

Referenced by BitmapUpdate(), BitmapUpdate(), BitmapUpdate(), Java_com_cmlabs_cmsdk_cmsdkJNI_BitmapUpdate_1init(), and setFullUpdate().

◆ readFromFile()

◆ readFromFileDiff()

◆ readFromFileRLE()

◆ readFromFileRLEDiff()

◆ reset()

bool cmlabs::BitmapUpdate::reset ( )

◆ setFullUpdate()

bool cmlabs::BitmapUpdate::setFullUpdate ( Bitmap * bitmap)

Fill as an uncompressed full frame from bitmap.

Returns
true on success.

Definition at line 4227 of file Bitmap.cpp.

References cmlabs::Bitmap::data, data, FULL, cmlabs::Bitmap::height, init(), reset(), setUpdateType(), cmlabs::Bitmap::size, size, and cmlabs::Bitmap::width.

◆ setUpdateType()

◆ toBitmap()

Bitmap * cmlabs::BitmapUpdate::toBitmap ( )

Decode into a new full Bitmap (caller owns); requires a FULL-equivalent payload.

Returns
Bitmap or NULL.

Definition at line 4203 of file Bitmap.cpp.

◆ update()

bool cmlabs::BitmapUpdate::update ( BitmapUpdate * update)

Merge a newer update into this one.

Returns
true on success.

Definition at line 4478 of file Bitmap.cpp.

References BitmapUpdate(), and update().

Referenced by _wrap_BitmapUpdate_update(), _wrap_BitmapUpdate_update(), Java_com_cmlabs_cmsdk_cmsdkJNI_BitmapUpdate_1update(), and update().

Member Data Documentation

◆ data

◆ height

uint32 cmlabs::BitmapUpdate::height

◆ size

◆ type

◆ width

uint32 cmlabs::BitmapUpdate::width

The documentation for this class was generated from the following files:
  • /home/ubuntu/c/partner/psyclone2/CMSDK/include/Bitmap.h
  • /home/ubuntu/c/partner/psyclone2/CMSDK/src/Bitmap.cpp