CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
Bitmap.h
Go to the documentation of this file.
1
10#if !defined(_BITMAP_H_)
11#define _BITMAP_H_
12
13#include "MathClasses.h"
14#include "DataMessage.h"
15
16namespace cmlabs {
17
18// #define GET_RGB_FROM_RGBA(a) (((unsigned char*)&a)[0] << 0) + (((unsigned char*)&a)[1] << 8) + (((unsigned char*)&a)[2] << 16)
19#define GET_RGB_FROM_RGBA(a) (a & 0x00ffffff)
20//#define GET_R_FROM_RGBA(a) (a & 0xff000000)
21//#define GET_G_FROM_RGBA(a) (a & 0x00ff0000)
22//#define GET_B_FROM_RGBA(a) (a & 0x0000ff00)
23//#define GET_R_FROM_RGBA(a) (char)(a & 0x000000ff)
24//#define GET_G_FROM_RGBA(a) (char)(a & 0x0000ff00)
25//#define GET_B_FROM_RGBA(a) (char)(a & 0x00ff0000)
26//#define GET_R_FROM_RGBA(a) ((unsigned char*)&a)[0]
27//#define GET_G_FROM_RGBA(a) ((unsigned char*)&a)[1]
28//#define GET_B_FROM_RGBA(a) ((unsigned char*)&a)[2]
29#define GET_R_FROM_RGBA(a) (unsigned char)(a & 0x000000ff)
30#define GET_G_FROM_RGBA(a) (unsigned char)((a & 0x0000ff00)>>8)
31#define GET_B_FROM_RGBA(a) (unsigned char)((a & 0x00ff0000)>>16)
32#define GET_RGB_FROM_GRAY(a) (unsigned int)(((unsigned int)a<<16) + ((unsigned int)a<<8) + (unsigned int)a)
33#define GET_RGB_FROM_COMP(r,g,b) (unsigned int)((((unsigned int)b)<<16) + (((unsigned int)g)<<8) + (unsigned int)r)
34#define GET_GRAY_FROM_RGB(a) (unsigned char)((GET_R_FROM_RGBA(a)+GET_G_FROM_RGBA(a)+GET_B_FROM_RGBA(a))/3)
35
36// Red 0xF800 (5 bits of red) Green 0x07E0 (6 bits of green) Blue 0x001F (5 bits of blue)
37#define GET_DRGB_FROM_2RGBS(a,b) (((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)
38#define GET_FIRSTRGB_FROM_DRGB(a) ((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)
39#define GET_SECONDRGB_FROM_DRGB(a) ((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)
40
41#define DATACTRL 1
42#define RLECTRL 2
43#define DIFCTRL 3
44
45typedef unsigned char CMBYTE;
46typedef unsigned int CMUINT;
47typedef unsigned int CMDWORD;
48typedef unsigned short CMWORD;
49typedef signed int CMLONG;
50
51#pragma pack(2)
60
61#pragma pack(2)
76#pragma pack()
77
85
87class Pixel {
88public:
89 Pixel() {x=0; y=0; value = NULL; }
90 uint32 x;
91 uint32 y;
92 uint32* value;
93};
94
95class BitmapUpdate;
96
139class Bitmap {
140public:
141 // Constructors
142 Bitmap();
143 Bitmap(uint32 w, uint32 h);
144 Bitmap(char* imgData, uint32 w, uint32 h, bool takeData = false);
145 Bitmap(const char* imgData, uint32 size, uint32 w, uint32 h, uint32 linestep);
146 Bitmap(const char* imgData, uint32 size, uint32 w, uint32 h, const char* encoding);
147 Bitmap(const char* imgData, uint32 size, uint32 w, uint32 h, const char* encoding, uint32 linestep);
148 Bitmap(const char* filename);
149 Bitmap(BitmapUpdate* update);
150 Bitmap(DataMessage* msg);
151 virtual ~Bitmap();
152 bool init(uint32 w, uint32 h);
153 bool init(const char* imgData, uint32 size, uint32 w, uint32 h, const char* encoding, uint32 linestep);
154
156
157 BitmapUpdate* operator -( const Bitmap &bitmap ) const;
158 bool updateBitmap(BitmapUpdate* update, bool takeData);
161
162 bool reset();
163
164 bool mirror(bool horizontal, bool vertical);
165
166 // Basic Functions
167 bool setPixel(uint32 x, uint32 y, uint8 red, uint8 green, uint8 blue, uint8 alpha = 0);
168 bool setPixel(uint32 pos, uint8 red, uint8 green, uint8 blue, uint8 alpha = 0);
169 bool setPixelXOR(uint32 x, uint32 y, uint8 red, uint8 green, uint8 blue, uint8 alpha = 0);
170 bool setPixelXOR(uint32 pos, uint8 red, uint8 green, uint8 blue, uint8 alpha = 0);
171
172 Pixel getPixel(uint32 x, uint32 y);
173 bool getPixel(Pixel* pixel);
174
175 uint32 getPos(uint32 x, uint32 y);
176 double getDPos(double x, double y);
177 Pixel getXY(uint32 pos);
178
179 Color getPixelColor(uint32 x, uint32 y);
180
181 // Bitmap Functions
182 bool eraseBitmap();
183 bool eraseBitmap(uint8 r, uint8 g, uint8 b, uint8 a = 0);
184 bool eraseBitmap(const Color& color);
185 bool replaceColor(const Color& oldColor, const Color& newColor);
186
187 bool fillBox(const Box& box, const Color& color);
188 bool fillBox(uint32 x, uint32 y, uint32 w, uint32 h, const Color& color);
189
190 bool putTransPixel(uint32 x, uint32 y, const Color& color, double weight);
191 bool drawLine(const Line& line, const Color& color);
192 bool drawLine(const PolyLine& polyline, const Color& color);
193 bool drawBox(const Box& box, const Color& color);
194 bool drawCircle(uint32 xCenter, uint32 yCenter, uint32 radius, const Color& color, double weight, double lineWidth, bool filled = false);
195 bool putQuadPixel(uint32 xCenter, uint32 yCenter, uint32 x, uint32 y, const Color& color, double weight);
196
197 bool drawBitmap(Bitmap* bitmap, uint32 x, uint32 y);
198 bool drawBitmap(Bitmap* bitmap, uint32 x, uint32 y, uint32 w, uint32 h);
199 bool drawBitmap(Bitmap* bitmap, const Point& p);
200 bool drawBitmap(Bitmap* bitmap, const Box& box);
201 bool drawBitmap(Bitmap* bitmap, uint32 srcx, uint32 srcy, uint32 dstx, uint32 dsty, uint32 w, uint32 h);
202
203 Bitmap* getCopy(const Box& box);
204
205 bool canBeResizedTo(uint32 width, uint32 height);
206 Bitmap* getResizedCopy(uint32 w, uint32 h, bool proportional);
207 Bitmap* getResizedCopy(double scale);
208 bool resizeTo(uint32 w, uint32 h, bool proportional);
209 bool copyDataFromBitmap(Bitmap* bitmap, bool shouldResize = false);
210 bool takeDataFromBitmap(Bitmap* bitmap);
211 double getBestResizeFactor(double factor);
212 double getBestResizeFactors(double factor, int &scaleUp, int &scaleDown, int &scale66);
213 char* createResizedData(uint32 newWidth, uint32 newHeight, int32 scaleUp, int32 scaleDown, int32 scale66);
214
215 //bool shape(uint32 x1, uint32 y1, uint32 x2, uint32 y2, uint32 x3, uint32 y3);
216 //bool shapeSlow(uint32 x1, uint32 y1, uint32 x2, uint32 y2, uint32 x3, uint32 y3);
217
219 //bool rotate(double angle);
220 //bool rotateSlow(double angle);
221
222 // File Routines
223 bool readFromMemory(const char* data, uint32 size);
224 bool readFromFile(const char* filename);
225 bool saveToFile(const char* filename);
226
227 static bool convertBitmapFileData(const char* src, uint32 width, uint32 height, uint32 depth, char* dst, uint32 dstlen);
228 static char* convertBitmapFileDataRunLength(const char* src, uint32 width, uint32 height, uint32 depth, uint32 &dstlen);
229 static char* differenceBitmapFileData(char* orig, char* src, uint32 width, uint32 height, uint32 depth, uint32 &dstlen);
230 static char* differenceBitmapFileDataRunLength(char* orig, char* src, uint32 width, uint32 height, uint32 depth, uint32 &dstlen);
231
232 BitmapUpdate* getCompressedUpdate(bool destructive) const;
233
234 char* getGrayScaleDataCopy(uint32 &len);
235 bool copyGrayScaleData(char* src, uint32 len);
236
237 //int getMaxUpdates();
238 //bool setMaxUpdates(uint32 max);
239 bool resetBitmapUpdates();
240 bool setBitmapUpdated();
241 bool addBitmapUpdateRegion(const Box& updateBox);
242 bool hasBitmapBeenUpdated();
244
245 // Public variables
246// JString name;
247// JTime timestamp;
248 uint32 width;
249 uint32 height;
250 uint32 size;
251 char* data;
253
254// int byteDepth;
255// int byteWidth;
256// int planes;
257// long size;
258// char* data;
259
260// long* N;
261// long* P;
262// int* L;
263// Color bgColor;
264// Color fgColor;
265// Bitmap* altBitmap;
266// char* eraseLine;
267
268 // Math Helper Routines
269 int32 round(double d);
270
271 //HTMLPage* toHTMLBitmap();
272 char* toBitmapFileFormat(uint32& len);
274 static char* DataToBitmapFileFormat(const char* data, uint32 size, uint32 width,
275 uint32 height, uint32& len);
277 static char* DataToBitmapFileFormat(const char* data, uint32 size, uint32 width,
278 uint32 height, uint32 linestep, uint32& len);
280 static char* DataToBitmapFileFormat(const char* data, uint32 size, uint32 width,
281 uint32 height, const char* encoding, uint32& len);
283 static char* DataToBitmapFileFormat(const char* data, uint32 size, uint32 width,
284 uint32 height, const char* encoding, uint32 linestep, uint32& len);
285
290 static char* DataToEncodingFormat(const char* data, uint32 size, uint32 width,
291 uint32 height, const char* srcEncoding, uint32 linestep, const char* targetEncoding, uint32& len);
292
294 static bool UnitTest();
295};
296
298char* ImageResizeDown66(char* bytesource, uint32 &cols, uint32 &rows);
300char* ImageResizeDown(char* bytesource, uint32 &cols, uint32 &rows, uint32 factor);
302char* ImageResizeUp66(char* bytesource, uint32 &cols, uint32 &rows);
304char* ImageResizeUp(char* bytesource, uint32 &cols, uint32 &rows, uint32 factor);
305
306
307
318{
319public:
322 // Constructors
323 BitmapUpdate();
324 BitmapUpdate(uint32 w, uint32 h);
325 BitmapUpdate(const char* filename, bool compress);
326 virtual ~BitmapUpdate();
327 bool init(uint32 w, uint32 h);
328 bool reset();
329
330 bool update(BitmapUpdate* update);
331
332 Bitmap* toBitmap();
333 //HTMLPage* toHTMLBitmap();
334
335 bool setUpdateType(BitmapUpdate::Type updateType);
337
338 bool setFullUpdate(Bitmap* bitmap);
339 bool readFromFile(const char* filename);
340 bool readFromFileRLE(const char* filename);
341 bool readFromFileDiff(const char* filename, Bitmap* oldBitmap);
342 bool readFromFileRLEDiff(const char* filename, Bitmap* oldBitmap);
343
344 uint32 width;
345 uint32 height;
346 uint32 size;
347 char* data;
348};
349
350
351} // namespace cmlabs
352
353
354
355#endif // _BITMAP_H_
The binary DataMessage container — the central data-exchange object of Psyclone/CMSDK.
Geometry and 2D/3D math value classes: Color, Size, Point, PointFloat, Line, PolyLine,...
32-bit RGBA raster image with drawing, compositing, scaling, BMP I/O and update-region tracking.
Definition Bitmap.h:139
static char * convertBitmapFileDataRunLength(const char *src, uint32 width, uint32 height, uint32 depth, uint32 &dstlen)
As convertBitmapFileData() but RLE-compressing on the fly.
Definition Bitmap.cpp:2874
bool putQuadPixel(uint32 xCenter, uint32 yCenter, uint32 x, uint32 y, const Color &color, double weight)
Plot the 4 symmetric points of a circle octant (internal helper for drawCircle()).
Definition Bitmap.cpp:1360
bool addBitmapUpdateRegion(const Box &updateBox)
Grow the dirty region to include updateBox.
Definition Bitmap.cpp:336
bool init(uint32 w, uint32 h)
(Re)allocate as w x h.
Definition Bitmap.cpp:305
bool setPixelXOR(uint32 x, uint32 y, uint8 red, uint8 green, uint8 blue, uint8 alpha=0)
XOR the color into the pixel at (x,y) (reversible marker drawing).
Definition Bitmap.cpp:683
bool hasBitmapBeenTotallyChanged()
Definition Bitmap.cpp:368
bool fillBox(const Box &box, const Color &color)
Fill a rectangle (clipped to the image).
Definition Bitmap.cpp:817
Bitmap * getCopy(const Box &box)
Extract a sub-image (caller owns).
Definition Bitmap.cpp:381
double getBestResizeFactors(double factor, int &scaleUp, int &scaleDown, int &scale66)
Decompose factor into up/down/66% passes used by createResizedData().
Definition Bitmap.cpp:1074
bool copyGrayScaleData(char *src, uint32 len)
Fill this RGBA image from an 8-bit grayscale buffer of matching size.
Definition Bitmap.cpp:418
bool drawCircle(uint32 xCenter, uint32 yCenter, uint32 radius, const Color &color, double weight, double lineWidth, bool filled=false)
Draw a circle.
Definition Bitmap.cpp:1373
Pixel getXY(uint32 pos)
Inverse of getPos(): coordinates for a linear index.
Definition Bitmap.cpp:739
bool mirror(bool horizontal, bool vertical)
Flip in place along the requested axes.
Definition Bitmap.cpp:1447
bool drawLine(const Line &line, const Color &color)
Draw a (possibly anti-aliased) line segment.
Definition Bitmap.cpp:886
bool hasBitmapBeenUpdated()
Definition Bitmap.cpp:364
static bool UnitTest()
Self test for Bitmap and BitmapUpdate.
Definition Bitmap.cpp:4500
Color getPixelColor(uint32 x, uint32 y)
Pixel color at (x,y) as a Color value (black when out of bounds).
Definition Bitmap.cpp:862
bool setPixel(uint32 x, uint32 y, uint8 red, uint8 green, uint8 blue, uint8 alpha=0)
Set the pixel at (x,y).
Definition Bitmap.cpp:658
bool setBitmapUpdated()
Mark the whole image as changed.
Definition Bitmap.cpp:359
uint32 height
Height in pixels.
Definition Bitmap.h:249
uint32 width
Width in pixels.
Definition Bitmap.h:248
BitmapUpdate * operator-(const Bitmap &bitmap) const
Difference update transforming bitmap into this image.
Definition Bitmap.cpp:3279
DataMessage * toMessage()
Serialize into a new DataMessage (caller owns).
Definition Bitmap.cpp:294
BitmapUpdate * getCompressedUpdate(bool destructive) const
Full-frame update, RLE compressed.
Definition Bitmap.cpp:3271
bool resizeTo(uint32 w, uint32 h, bool proportional)
Resize in place.
Definition Bitmap.cpp:1065
bool takeDataFromBitmap(Bitmap *bitmap)
Steal the pixel buffer from bitmap (which becomes empty); no copy.
Definition Bitmap.cpp:1225
static char * differenceBitmapFileDataRunLength(char *orig, char *src, uint32 width, uint32 height, uint32 depth, uint32 &dstlen)
Difference encoding + RLE compression.
Definition Bitmap.cpp:3153
double getBestResizeFactor(double factor)
Snap factor to the nearest factor achievable by the fast integer resizers.
Definition Bitmap.cpp:1126
bool eraseBitmap()
Fill with black/zero.
Definition Bitmap.cpp:759
Box updateRegion
Accumulated dirty region since the last resetBitmapUpdates().
Definition Bitmap.h:252
virtual ~Bitmap()
Definition Bitmap.cpp:256
BitmapUpdate * runLengthDestructiveEncode() const
RLE-compress, allowed to modify this image's buffer for speed.
Definition Bitmap.cpp:3494
bool copyDataFromBitmap(Bitmap *bitmap, bool shouldResize=false)
Copy pixels from bitmap; optionally resize this image to fit.
Definition Bitmap.cpp:1193
bool putTransPixel(uint32 x, uint32 y, const Color &color, double weight)
Alpha-blend color onto the pixel with fraction weight [0,1] (anti-aliasing helper).
Definition Bitmap.cpp:876
bool updateBitmap(BitmapUpdate *update, bool takeData)
Apply a full/RLE/diff update.
Definition Bitmap.cpp:430
uint32 size
Data buffer size in bytes (width*height*4).
Definition Bitmap.h:250
static char * differenceBitmapFileData(char *orig, char *src, uint32 width, uint32 height, uint32 depth, uint32 &dstlen)
Encode the difference between two frames.
Definition Bitmap.cpp:3022
Bitmap()
Empty 0x0 bitmap.
Definition Bitmap.cpp:18
char * createResizedData(uint32 newWidth, uint32 newHeight, int32 scaleUp, int32 scaleDown, int32 scale66)
Produce a resized pixel buffer using the given pass counts (caller frees).
Definition Bitmap.cpp:1137
bool resetBitmapUpdates()
Clear the dirty-region tracking.
Definition Bitmap.cpp:354
Bitmap * getResizedCopy(uint32 w, uint32 h, bool proportional)
Resized copy (caller owns).
Definition Bitmap.cpp:1053
bool readFromMemory(const char *data, uint32 size)
Parse a BMP file image from memory.
Definition Bitmap.cpp:1898
uint32 getPos(uint32 x, uint32 y)
Linear pixel index of (x,y) = y*width+x.
Definition Bitmap.cpp:727
char * data
Pixel data, 32-bit RGBA, row-major top-down.
Definition Bitmap.h:251
bool replaceColor(const Color &oldColor, const Color &newColor)
Replace every exact occurrence of oldColor with newColor.
Definition Bitmap.cpp:798
int32 round(double d)
Round to nearest integer (helper for pixel math).
Definition Bitmap.cpp:2775
bool reset()
Release pixel data and return to the empty state.
Definition Bitmap.cpp:375
bool canBeResizedTo(uint32 width, uint32 height)
Check whether the integer-ratio resizer supports this target size.
Definition Bitmap.cpp:984
char * toBitmapFileFormat(uint32 &len)
Serialize this image as a complete BMP file in memory.
Definition Bitmap.cpp:2109
Pixel getPixel(uint32 x, uint32 y)
Get a Pixel referencing (x,y); value pointer is NULL when out of bounds.
Definition Bitmap.cpp:708
static char * DataToEncodingFormat(const char *data, uint32 size, uint32 width, uint32 height, const char *srcEncoding, uint32 linestep, const char *targetEncoding, uint32 &len)
General pixel-format converter between named encodings.
Definition Bitmap.cpp:2409
bool drawBitmap(Bitmap *bitmap, uint32 x, uint32 y)
Blit bitmap with its upper-left corner at (x,y).
Definition Bitmap.cpp:1550
char * getGrayScaleDataCopy(uint32 &len)
8-bit grayscale copy of the image.
Definition Bitmap.cpp:403
static bool convertBitmapFileData(const char *src, uint32 width, uint32 height, uint32 depth, char *dst, uint32 dstlen)
Convert raw BMP pixel rows (bottom-up, padded) into the internal top-down RGBA layout.
Definition Bitmap.cpp:2850
double getDPos(double x, double y)
Fractional linear index for sub-pixel coordinates.
Definition Bitmap.cpp:733
bool saveToFile(const char *filename)
Save as a BMP file.
Definition Bitmap.cpp:2003
BitmapUpdate * runLengthEncode() const
RLE-compress the full image.
Definition Bitmap.cpp:3413
bool readFromFile(const char *filename)
Load a BMP file.
Definition Bitmap.cpp:1989
static char * DataToBitmapFileFormat(const char *data, uint32 size, uint32 width, uint32 height, uint32 &len)
Convert raw RGBA data into a BMP file image in memory.
Definition Bitmap.cpp:2113
bool drawBox(const Box &box, const Color &color)
Draw a rectangle outline.
Definition Bitmap.cpp:1345
Transportable image update: either a full frame or a compressed (RLE and/or difference) delta against...
Definition Bitmap.h:318
uint32 size
Payload size in bytes.
Definition Bitmap.h:346
BitmapUpdate::Type getUpdateType()
Definition Bitmap.cpp:4212
Bitmap * toBitmap()
Decode into a new full Bitmap (caller owns); requires a FULL-equivalent payload.
Definition Bitmap.cpp:4203
uint32 height
Frame height in pixels.
Definition Bitmap.h:345
BitmapUpdate()
Empty update.
Definition Bitmap.cpp:4136
bool reset()
Release the payload.
Definition Bitmap.cpp:4168
uint32 width
Frame width in pixels.
Definition Bitmap.h:344
bool update(BitmapUpdate *update)
Merge a newer update into this one.
Definition Bitmap.cpp:4478
virtual ~BitmapUpdate()
Definition Bitmap.cpp:4156
char * data
Encoded payload (interpretation depends on type).
Definition Bitmap.h:347
bool setUpdateType(BitmapUpdate::Type updateType)
Set the payload encoding tag.
Definition Bitmap.cpp:4207
bool readFromFile(const char *filename)
Load a BMP file as a FULL update.
Definition Bitmap.cpp:4239
bool setFullUpdate(Bitmap *bitmap)
Fill as an uncompressed full frame from bitmap.
Definition Bitmap.cpp:4227
bool init(uint32 w, uint32 h)
(Re)initialize for a w x h frame.
Definition Bitmap.cpp:4160
bool readFromFileRLEDiff(const char *filename, Bitmap *oldBitmap)
Load, difference against oldBitmap and RLE-compress.
Definition Bitmap.cpp:4425
bool readFromFileDiff(const char *filename, Bitmap *oldBitmap)
Load a BMP file and store the difference against oldBitmap.
Definition Bitmap.cpp:4373
bool readFromFileRLE(const char *filename)
Load a BMP file and RLE-compress it.
Definition Bitmap.cpp:4312
Type
Payload encoding: FULL raw frame, RUNLENGTH RLE frame, RL16 16-bit RLE, DIF raw difference,...
Definition Bitmap.h:321
Axis-aligned rectangle defined by an upper-left corner and a Size, with overlap/containment math.
24-bit RGB color with mixing, inversion, distance and palette-generation helpers.
The central Psyclone data container: a self-contained binary message with typed, named user entries.
Line segment between two PointFloat endpoints with a drawing width.
Reference to one pixel: coordinates plus a pointer directly into the owning Bitmap's data (no copy).
Definition Bitmap.h:87
uint32 x
Definition Bitmap.h:90
uint32 * value
Definition Bitmap.h:92
uint32 y
Definition Bitmap.h:91
Integer 3D point with an optional attached Size; interoperates with PointFloat and vectors.
Ordered collection of Line segments (not necessarily connected).
signed int CMLONG
Definition Bitmap.h:49
char * ImageResizeUp66(char *bytesource, uint32 &cols, uint32 &rows)
Enlarge an RGBA image to 3/2 size (2→3 pixel interpolation).
Definition Bitmap.cpp:3787
char * ImageResizeUp(char *bytesource, uint32 &cols, uint32 &rows, uint32 factor)
Enlarge an RGBA image by an integer factor (pixel replication).
Definition Bitmap.cpp:4080
struct cmlabs::tagBITMAPFILEHEADER_CM BITMAPFILEHEADER_CM
BMP file header (14 bytes), local packed definition so no windows.h dependency is needed.
char * ImageResizeDown66(char *bytesource, uint32 &cols, uint32 &rows)
Shrink an RGBA image to 2/3 size (3→2 pixel averaging).
Definition Bitmap.cpp:3622
struct cmlabs::tagRGBA valRGBA
One RGBA pixel value as separate byte components.
unsigned int CMDWORD
Definition Bitmap.h:47
unsigned char CMBYTE
Definition Bitmap.h:45
unsigned int CMUINT
Definition Bitmap.h:46
struct cmlabs::tagBITMAPINFOHEADER_CM BITMAPINFOHEADER_CM
BMP info header (40 bytes, BITMAPINFOHEADER equivalent), packed to 2-byte alignment for direct file m...
unsigned short CMWORD
Definition Bitmap.h:48
char * ImageResizeDown(char *bytesource, uint32 &cols, uint32 &rows, uint32 factor)
Shrink an RGBA image by an integer factor (box averaging).
Definition Bitmap.cpp:3994
BMP file header (14 bytes), local packed definition so no windows.h dependency is needed.
Definition Bitmap.h:53
BMP info header (40 bytes, BITMAPINFOHEADER equivalent), packed to 2-byte alignment for direct file m...
Definition Bitmap.h:63
One RGBA pixel value as separate byte components.
Definition Bitmap.h:79
CMBYTE blue
Definition Bitmap.h:82
CMBYTE green
Definition Bitmap.h:81
CMBYTE red
Definition Bitmap.h:80
CMBYTE alpha
Definition Bitmap.h:83