plptools
Loading...
Searching...
No Matches
psibitmap.cpp File Reference
#include "config.h"
#include <stdint.h>
#include "psibitmap.h"
Include dependency graph for psibitmap.cpp:

Go to the source code of this file.

Macros

#define splitByte(v)
 

Functions

void encodeBitmap (int width, int height, getPixelFunction_t getPixel, bool, bufferStore &out)
 Convert an image into a bitmap in Psion format. More...
 
bool decodeBitmap (const unsigned char *p, int &width, int &height, bufferStore &out)
 Convert a Psion bitmap to a 8bit/pixel grayscale image. More...
 

Macro Definition Documentation

◆ splitByte

#define splitByte (   v)
Value:
do { \
int j; \
\
if (x < bytesPerLine) \
for (j = 0; j < pixelsPerByte; j++) { \
if (j && ((oidx % xPixels) == 0)) \
break; \
else \
if (oidx >= picsize) \
return false; \
else { \
out.addByte((v & mask) * grayVal); \
v >>= bitsPerPixel; \
oidx++; \
} \
} \
if (++x >= linelen) \
x = 0; \
} while (0)

Definition at line 119 of file psibitmap.cpp.

Function Documentation

◆ decodeBitmap()

bool decodeBitmap ( const unsigned char *  p,
int &  width,
int &  height,
bufferStore out 
)

Convert a Psion bitmap to a 8bit/pixel grayscale image.

Parameters
pPointer to an input buffer which contains the Psion-formatted bitmap to convert. Must start with a Psion bitmap header.
widthOn return, the image width in pixels is returned here.
heightOn return, the image height in pixels is returned here.
outBuffer which gets filled with the raw image data. Each pixel is represented by a byte. The image data is organized in height scanlines of width bytes, starting with the topmost scanline.
Returns
true on success, false if input data is inconsistent.

Definition at line 141 of file psibitmap.cpp.

◆ encodeBitmap()

void encodeBitmap ( int  width,
int  height,
getPixelFunction_t  getPixel,
bool  rle,
bufferStore out 
)

Convert an image into a bitmap in Psion format.

Parameters
widthThe width of the image to convert.
heightThe height of the image to convert.
getPixelPointer to a function for retrieving pixel values.
rleFlag: Perform RLE compression (currently ignored).
outOutput buffer; gets filled with the Psion representation of the converted image.

Definition at line 26 of file psibitmap.cpp.