23 #ifndef BAGEL_BOFLIB_GFX_BMP_H 24 #define BAGEL_BOFLIB_GFX_BMP_H 26 #include "graphics/managed_surface.h" 27 #include "bagel/boflib/cache.h" 28 #include "bagel/boflib/error.h" 29 #include "bagel/boflib/object.h" 30 #include "bagel/boflib/point.h" 31 #include "bagel/boflib/rect.h" 32 #include "bagel/boflib/size.h" 33 #include "bagel/boflib/stdinc.h" 34 #include "bagel/boflib/gfx/palette.h" 40 #define NOT_TRANSPARENT -1 42 #define COLOR_WHITE 255 45 #define CBMP_FADE_SPEED 10 46 #define CBMP_FADE_SIZE 4 48 #define CBMP_CURT_SPEED 8 // Must be a power of 2 50 #define CBMP_LINE_SPEED 32 // Should be a power of 4 61 bool alloc()
override;
71 static bool _bUseBackdrop;
73 char _szFileName[MAX_FNAME];
77 byte *_pBits =
nullptr;
84 bool _bTopDown =
false;
86 bool _bOwnPalette =
false;
87 bool _bReadOnly =
false;
88 bool _bInitialized =
false;
104 CBofBitmap(
int dx,
int dy,
CBofPalette *pPalette,
bool bOwnPalette =
false, byte *pPrivateBuff =
nullptr);
153 void setIsOwnPalette(
bool own) {
177 return CBofRect(0, 0, _nDX - 1, _nDY - 1);
180 void setReadOnly(
bool bReadOnly) {
181 _bReadOnly = bReadOnly;
228 ErrorCode
paint(
CBofWindow *pWnd,
int x,
int y,
CBofRect *pSrcRect =
nullptr,
int nMaskColor = NOT_TRANSPARENT);
259 ErrorCode
paint(
CBofBitmap *pBmp,
int x,
int y,
CBofRect *pSrcRect =
nullptr,
int nMaskColor = NOT_TRANSPARENT);
323 ErrorCode
fadeIn(
CBofWindow *pWnd,
int x = 0,
int y = 0,
int nMaskColor = NOT_TRANSPARENT,
int nBlockSize = CBMP_FADE_SIZE,
int nSpeed = CBMP_FADE_SPEED);
325 ErrorCode curtain(
CBofWindow *pWnd,
int nSpeed = CBMP_CURT_SPEED,
int nMaskColor = NOT_TRANSPARENT);
326 ErrorCode fadeLines(
CBofWindow *pWnd,
int nSpeed = CBMP_LINE_SPEED,
int nMaskColor = NOT_TRANSPARENT);
351 void circle(
int x,
int y, uint16 nRadius, byte iColor);
361 void line(
int nSrcX,
int nSrcY,
int nDstX,
int nDstY, byte iColor);
394 ErrorCode scrollLeft(
int nPixels,
CBofRect *pRect =
nullptr) {
405 static void setUseBackdrop(
bool b) {
408 static bool getUseBackdrop() {
409 return _bUseBackdrop;
438 extern ErrorCode paintBitmap(
CBofWindow *pWindow,
const char *pszFileName,
CBofRect *pDstRect =
nullptr,
439 CBofRect *pSrcRect =
nullptr,
CBofPalette *pPalette =
nullptr,
int nMaskColor = NOT_TRANSPARENT);
Definition: managed_surface.h:51
void writePixel(int x, int y, byte iColor)
ErrorCode scrollUp(int nPixels)
ErrorCode scrollRight(int nPixels, CBofRect *pRect=nullptr)
byte * getPixelAddress(int x, int y)
ErrorCode fadeIn(CBofWindow *pWnd, int x=0, int y=0, int nMaskColor=-1, int nBlockSize=4, int nSpeed=10)
ErrorCode paintStretchOpt(CBofBitmap *pBmp, CBofRect *pDstRect, CBofRect *pSrcRect, int nOptSize)
byte readPixel(int x, int y)
void line(int nSrcX, int nSrcY, int nDstX, int nDstY, byte iColor)
void drawRect(CBofRect *cRect, byte iColor)
ErrorCode paintMaskBackdrop(CBofWindow *pWnd, CBofRect *pDstRect=nullptr, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
void setPalette(CBofPalette *pPalette, bool bOwnPalette=false)
ErrorCode paint(CBofWindow *pWnd, int x, int y, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
ErrorCode captureScreen(CBofWindow *pWnd, CBofRect *pSrcRect, CBofRect *pDstRect=nullptr)
void fillRect(CBofRect *cRect, byte iColor)
ErrorCode loadBitmap(const char *pszFileName, CBofPalette *pPalette)
ErrorCode buildBitmap(CBofPalette *pPalette)
ErrorCode paintStretch4(CBofBitmap *pBmp, CBofRect *pDstRect, CBofRect *pSrcRect)
The Destination rectangle MUST be divisible by 4. Both bitmaps must be Bottom-Up. The Source must be ...
ErrorCode paint1To1(CBofBitmap *pBmp)
void circle(int x, int y, uint16 nRadius, byte iColor)
const char * getFileName()