resonance 1.0.1
Loading...
Searching...
No Matches
abitmap.h
Go to the documentation of this file.
1#pragma once
2
3class APalette;
4
30
36
47extern const unsigned char g_abBitmapBitsPerPixel[kABitmapFormatCount];
48
60extern int g_nSkipColorSwap;
61
95class ABitmap {
96public:
106 static const unsigned char bmPixelSize[kABitmapFormatCount];
107
132 ABitmap(void *pPixels,
133 int nFormat,
134 bool bHasTransparentColor,
135 int nWidth,
136 int nHeight,
137 int nBytesPerRow);
138
156 ABitmap(const ABitmap &source, int nX, int nY, int nWidth, int nHeight);
157
171 void SetPaletteEntries(const unsigned int *pEntries, int nFirst, int nCount);
172
184 static int Bpp2Format(int nBitsPerPixel);
185
200 static int ComputeByteCount(int nFormat, int nWidth, int nHeight);
201
210 static void Reverse15(unsigned short *pPixels, int nCount);
211
220 static void Reverse24(unsigned char *pPixels, int nCount);
221
230 static void Reverse32(unsigned char *pPixels, int nCount);
231
252 void ApplyColorKey(int nFlags);
253
266
280 void SetPaletteAlphaFromLowByte(int bWhiten);
281
297 int Clone(ABitmap &source);
298
299 void *mPixels;
300 unsigned short mHasTransparentColor : 8;
301 unsigned short mFormat : 4;
302 unsigned short mOwnsPixels : 1;
303 unsigned short mOddNibbleStart : 1;
304 unsigned short mUnused : 2;
305 short mWidth;
306 short mHeight;
308 unsigned int mTransparentColor;
311};
ABitmapColorKey
Colour key choices ABitmap::ApplyColorKey() takes.
Definition abitmap.h:32
@ kABitmapColorKeyBlack
Definition abitmap.h:34
@ kABitmapColorKeyWhite
Definition abitmap.h:33
ABitmapFormat
Pixel layout code stored in ABitmap::mFormat.
Definition abitmap.h:21
@ kABitmapFormatCount
Definition abitmap.h:28
@ kABitmapFormatLinear15
Definition abitmap.h:24
@ kABitmapFormatLinear24
Definition abitmap.h:25
@ kABitmapFormatLinear4
Definition abitmap.h:22
@ kABitmapFormatLinear8
Definition abitmap.h:23
@ kABitmapFormatRle8
Definition abitmap.h:27
@ kABitmapFormatLinear32
Definition abitmap.h:26
int g_nSkipColorSwap
Non-zero to leave bitmap colours in file order rather than swapping red and blue.
const unsigned char g_abBitmapBitsPerPixel[kABitmapFormatCount]
Bits one pixel of each ABitmapFormat occupies.
unsigned short mOddNibbleStart
Definition abitmap.h:303
unsigned short mUnused
Definition abitmap.h:304
int mByteCount
Definition abitmap.h:309
static int ComputeByteCount(int nFormat, int nWidth, int nHeight)
Return the size of a pixel rectangle in bytes, with rows packed at the format's own stride.
short mHeight
Definition abitmap.h:306
unsigned int mTransparentColor
Definition abitmap.h:308
ABitmap(void *pPixels, int nFormat, bool bHasTransparentColor, int nWidth, int nHeight, int nBytesPerRow)
Describe a pixel rectangle, allocating the pixels when the caller supplies none.
void * mPixels
Definition abitmap.h:299
static void Reverse15(unsigned short *pPixels, int nCount)
Exchange the red and blue fields of a run of 1555 pixels in place.
static int Bpp2Format(int nBitsPerPixel)
Return the ABitmapFormat code for a pixel width in bits.
unsigned short mOwnsPixels
Definition abitmap.h:302
ABitmap(const ABitmap &source, int nX, int nY, int nWidth, int nHeight)
Describe a rectangle inside another bitmap, sharing its pixels.
void SetPaletteEntries(const unsigned int *pEntries, int nFirst, int nCount)
Set or replace a run of palette entries, allocating the palette on first use.
short mWidth
Definition abitmap.h:305
void SwapRedBlue()
Exchange red and blue throughout the bitmap, or throughout its palette.
unsigned short mFormat
Definition abitmap.h:301
void SetPaletteAlphaFromLowByte(int bWhiten)
Copy the low byte of every palette entry into its alpha byte.
unsigned short mHasTransparentColor
Definition abitmap.h:300
static void Reverse24(unsigned char *pPixels, int nCount)
Exchange the first and third byte of a run of three byte pixels in place.
static void Reverse32(unsigned char *pPixels, int nCount)
Exchange the first and third byte of a run of four byte pixels in place.
static const unsigned char bmPixelSize[kABitmapFormatCount]
Bytes one pixel of each ABitmapFormat occupies.
Definition abitmap.h:106
int Clone(ABitmap &source)
Make this bitmap an owning copy of another.
void ApplyColorKey(int nFlags)
Pick a colour key from the flags and rebuild the alpha of every pixel from it.
short mBytesPerRow
Definition abitmap.h:307
APalette * mPalette
Definition abitmap.h:310
A 256 entry colour table an ABitmap points at.
Definition apalette.h:31