ScummVM API documentation
Bagel::CBofBitmap Class Reference
Inheritance diagram for Bagel::CBofBitmap:
Bagel::CBofError Bagel::CBofObject Bagel::CCache Bagel::CLList Bagel::CBagPanBitmap

Public Member Functions

 CBofBitmap ()
 
 CBofBitmap (int dx, int dy, CBofPalette *pPalette, bool bOwnPalette=false, byte *pPrivateBuff=nullptr)
 
 CBofBitmap (const char *pszFileName, CBofPalette *pPalette=nullptr, bool bOwnPalette=false)
 
virtual ~CBofBitmap ()
 
ErrorCode buildBitmap (CBofPalette *pPalette)
 
ErrorCode loadBitmap (const char *pszFileName, CBofPalette *pPalette)
 
void releaseBitmap ()
 
void setPalette (CBofPalette *pPalette, bool bOwnPalette=false)
 
CBofPalettegetPalette ()
 
void setIsOwnPalette (bool own)
 
byte * getPixelAddress (int x, int y)
 
byte * getPixelAddress (CBofPoint *pPoint)
 
CBofSize getSize ()
 
CBofRect getRect ()
 
void setReadOnly (bool bReadOnly)
 
bool getReadOnly ()
 
bool isTopDown ()
 
int width ()
 
int widthBytes ()
 
int height ()
 
 operator Graphics::ManagedSurface & ()
 
Graphics::ManagedSurface getSurface ()
 
const char * getFileName ()
 
ErrorCode paint (CBofWindow *pWnd, int x, int y, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
 
ErrorCode paint (CBofWindow *pWnd, CBofRect *pDstRect=nullptr, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
 
ErrorCode paintMaskBackdrop (CBofWindow *pWnd, CBofRect *pDstRect=nullptr, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
 
ErrorCode paint (CBofBitmap *pBmp, int x, int y, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
 
ErrorCode paint (CBofBitmap *pBmp, CBofRect *pDstRect=nullptr, CBofRect *pSrcRect=nullptr, int nMaskColor=-1)
 
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 smaller than the Destination. More...
 
ErrorCode paintStretchOpt (CBofBitmap *pBmp, CBofRect *pDstRect, CBofRect *pSrcRect, int nOptSize)
 
ErrorCode paint1To1 (CBofBitmap *pBmp)
 
ErrorCode captureScreen (CBofWindow *pWnd, CBofRect *pSrcRect, CBofRect *pDstRect=nullptr)
 
ErrorCode fadeIn (CBofWindow *pWnd, int x=0, int y=0, int nMaskColor=-1, int nBlockSize=4, int nSpeed=10)
 
ErrorCode curtain (CBofWindow *pWnd, int nSpeed=8, int nMaskColor=-1)
 
ErrorCode fadeLines (CBofWindow *pWnd, int nSpeed=32, int nMaskColor=-1)
 
byte readPixel (int x, int y)
 
void writePixel (int x, int y, byte iColor)
 
void circle (int x, int y, uint16 nRadius, byte iColor)
 
void line (int nSrcX, int nSrcY, int nDstX, int nDstY, byte iColor)
 
void line (CBofPoint *pSrc, CBofPoint *pDest, byte iColor)
 
void drawRect (CBofRect *cRect, byte iColor)
 
void fillRect (CBofRect *cRect, byte iColor)
 
ErrorCode scrollRight (int nPixels, CBofRect *pRect=nullptr)
 
ErrorCode scrollLeft (int nPixels, CBofRect *pRect=nullptr)
 
ErrorCode scrollUp (int nPixels)
 
- Public Member Functions inherited from Bagel::CBofError
void reportError (ErrorCode errCode, const char *format,...)
 
bool errorOccurred () const
 
ErrorCode getErrorCode () const
 
void clearError ()
 
- Public Member Functions inherited from Bagel::CCache
 CCache ()
 
virtual ~CCache ()
 
void load ()
 
bool release ()
 
void lock ()
 
void unlock ()
 
bool isLocked ()
 

Static Public Member Functions

static void setUseBackdrop (bool b)
 
static bool getUseBackdrop ()
 
- Static Public Member Functions inherited from Bagel::CBofError
static void fatalError (ErrorCode errCode, const char *format,...)
 
static void initialize ()
 
static int getErrorCount ()
 
- Static Public Member Functions inherited from Bagel::CBofObject
static bool isValidObject (const CBofObject *pObject)
 
- Static Public Member Functions inherited from Bagel::CCache
static void initialize ()
 
static bool flush ()
 
static bool optimize (uint32 lRequestedFreeSpace)
 

Protected Member Functions

bool alloc () override
 
void free () override
 
- Protected Member Functions inherited from Bagel::CBofError
virtual void bofMessageBox (const Common::String &content, const Common::String &title)
 

Protected Attributes

char _szFileName [MAX_FNAME]
 
Graphics::ManagedSurface _bitmap
 
byte * _pBits = nullptr
 
CBofPalette_pPalette = nullptr
 
int _nScanDX = 0
 
int _nDX = 0
 
int _nDY = 0
 
bool _bTopDown = false
 
bool _bOwnPalette = false
 
bool _bReadOnly = false
 
bool _bInitialized = false
 
- Protected Attributes inherited from Bagel::CBofError
ErrorCode _errCode
 

Static Protected Attributes

static bool _bUseBackdrop
 
- Static Protected Attributes inherited from Bagel::CBofError
static int _count
 

Constructor & Destructor Documentation

◆ CBofBitmap() [1/3]

Bagel::CBofBitmap::CBofBitmap ( )

Default constructor

◆ CBofBitmap() [2/3]

Bagel::CBofBitmap::CBofBitmap ( int  dx,
int  dy,
CBofPalette pPalette,
bool  bOwnPalette = false,
byte *  pPrivateBuff = nullptr 
)

Constructs a CBofBitmap

Parameters
dxWidth of new bitmap
dyHeight of new bitmap
pPalettePalette to use for this bitmap
bOwnPalettetrue if destructor should delete palette
pPrivateBuff

◆ CBofBitmap() [3/3]

Bagel::CBofBitmap::CBofBitmap ( const char *  pszFileName,
CBofPalette pPalette = nullptr,
bool  bOwnPalette = false 
)

Constructs a CBofBitmap

Parameters
pszFileNamePath and Filename for Bitmap on disk
pPalettePalette to use for this bitmap
bOwnPalettetrue if destructor should delete palette

◆ ~CBofBitmap()

virtual Bagel::CBofBitmap::~CBofBitmap ( )
virtual

Destructor

Member Function Documentation

◆ alloc()

bool Bagel::CBofBitmap::alloc ( )
overrideprotectedvirtual

Does the actual allocation for this bitmap

Returns
true is this bitmap was successfully loaded into the cache

Implements Bagel::CCache.

◆ free()

void Bagel::CBofBitmap::free ( )
overrideprotectedvirtual

Frees the data used by this bitmap (removes from cache)

Implements Bagel::CCache.

◆ buildBitmap()

ErrorCode Bagel::CBofBitmap::buildBitmap ( CBofPalette pPalette)

Allocates the structures needed for a CBofBitmap

Parameters
pPalettePalette to be assigned into this bitmap

◆ loadBitmap()

ErrorCode Bagel::CBofBitmap::loadBitmap ( const char *  pszFileName,
CBofPalette pPalette 
)

Loads the specified bitmap from disk

Parameters
pszFileNameFilename
pPalettePalette
Returns
Error return code

◆ releaseBitmap()

void Bagel::CBofBitmap::releaseBitmap ( )

Frees the data used by this bitmap

◆ setPalette()

void Bagel::CBofBitmap::setPalette ( CBofPalette pPalette,
bool  bOwnPalette = false 
)

Assigns specified palette to this bitmap

Parameters
pPalettePointer to CBofPalette to be assigned
bOwnPalettetrue if bitmap is to own this palette

◆ getPixelAddress()

byte* Bagel::CBofBitmap::getPixelAddress ( int  x,
int  y 
)

Returns the bit address of the (x, y) location in this bmp

Parameters
xColumn in _pBits
yRow in _pBits
Returns
Address of (x,y) in bitmap surface

◆ getFileName()

const char* Bagel::CBofBitmap::getFileName ( )

Returns current bitmap's filename (if any)

Returns
Pointer to bitmap's filename

◆ paint() [1/4]

ErrorCode Bagel::CBofBitmap::paint ( CBofWindow pWnd,
int  x,
int  y,
CBofRect pSrcRect = nullptr,
int  nMaskColor = -1 
)

Paints some or all of the bitmap directly to the screen

Parameters
pWndDestination device for painting
xDestination column
yDestination row
pSrcRectSource rectangle from bitmap
nMaskColorTransparency color
Returns
error return code

◆ paint() [2/4]

ErrorCode Bagel::CBofBitmap::paint ( CBofWindow pWnd,
CBofRect pDstRect = nullptr,
CBofRect pSrcRect = nullptr,
int  nMaskColor = -1 
)

Paints some or all of the bitmap directly to the screen

Parameters
pWndDestination Device to paint to
pDstRectDestination rectangle (for stretching)
pSrcRectSource rectangle from bitmap
nMaskColortransparency color
Returns
Error return code

◆ paintMaskBackdrop()

ErrorCode Bagel::CBofBitmap::paintMaskBackdrop ( CBofWindow pWnd,
CBofRect pDstRect = nullptr,
CBofRect pSrcRect = nullptr,
int  nMaskColor = -1 
)

Paints some or all of the bitmap directly to the screen

Parameters
pWndDestination Device to paint to
pDstRectDestination rectangle (for stretching)
pSrcRectSource rectangle from bitmap
nMaskColorTransparency color
Returns
Error return code

◆ paint() [3/4]

ErrorCode Bagel::CBofBitmap::paint ( CBofBitmap pBmp,
int  x,
int  y,
CBofRect pSrcRect = nullptr,
int  nMaskColor = -1 
)

Paints some or all of the bitmap directly to the screen

Parameters
pBmpDestination bitmap to paint to
xDestination column
yDestination row
pSrcRectSource rectangle from bitmap
nMaskColorTransparency color
Returns
Error return code

◆ paint() [4/4]

ErrorCode Bagel::CBofBitmap::paint ( CBofBitmap pBmp,
CBofRect pDstRect = nullptr,
CBofRect pSrcRect = nullptr,
int  nMaskColor = -1 
)

Paints some or all of the bitmap directly to the screen

Parameters
pBmpDestination bitmap to paint to
pDstRectDestination rectangle (for stretching)
pSrcRectSource rectangle from bitmap
nMaskColorTransparency color
Returns
Error return code.

◆ paintStretch4()

ErrorCode Bagel::CBofBitmap::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 smaller than the Destination.

Stretches 4 pixel wide strips from source to destination

Parameters
pBmpDestination bitmap to paint to
pDstRectDestination rectangle (for stretching)
pSrcRectSource rectangle from bitmap
Returns
Error return code

◆ paintStretchOpt()

ErrorCode Bagel::CBofBitmap::paintStretchOpt ( CBofBitmap pBmp,
CBofRect pDstRect,
CBofRect pSrcRect,
int  nOptSize 
)

Stretches a multiple of 4 pixel wide strips from source to destination

Parameters
pBmpDestination bitmap to paint to
pDstRectDestination rectangle (for stretching)
pSrcRectSource rectangle from bitmap
nOptSize
Returns
Error return code

◆ paint1To1()

ErrorCode Bagel::CBofBitmap::paint1To1 ( CBofBitmap pBmp)

Paints some or all of the bitmap directly to the screen

Parameters
pBmpDestination bitmap to paint to
Returns
Error return code

◆ captureScreen()

ErrorCode Bagel::CBofBitmap::captureScreen ( CBofWindow pWnd,
CBofRect pSrcRect,
CBofRect pDstRect = nullptr 
)

Copy specified section of screen (or window) to bitmap.

Parameters
pWndWindow to capture
pSrcRectSource rectangle in window
pDstRectDestination area to copy image to
Returns
Error return code

◆ fadeIn()

ErrorCode Bagel::CBofBitmap::fadeIn ( CBofWindow pWnd,
int  x = 0,
int  y = 0,
int  nMaskColor = -1,
int  nBlockSize = 4,
int  nSpeed = 10 
)

Performs a "Fade" onto the specified window

Parameters
pWndPointer to window to fade into
xFade upper left X
yFade upper left Y
nMaskColorTransparency color (if any)
nBlockSizeSize of Fade Blocks
nSpeedSpeed for fade (not implemented yet)
Returns
Error return code

◆ readPixel()

byte Bagel::CBofBitmap::readPixel ( int  x,
int  y 
)

Returns the color at the (x, y) location in this bmp

Parameters
xX position
yY position
Returns
Color Index of specified (x,y) location in _pBits

◆ writePixel()

void Bagel::CBofBitmap::writePixel ( int  x,
int  y,
byte  iColor 
)

Assigns the specified color to the (x, y) location

Parameters
xX position
yY position
iColorPixel value

◆ circle()

void Bagel::CBofBitmap::circle ( int  x,
int  y,
uint16  nRadius,
byte  iColor 
)

Writes a circle into this bitmap

Parameters
xX center position
yY center position
nRadiusRadius of circle
iColorPixel value

◆ line() [1/2]

void Bagel::CBofBitmap::line ( int  nSrcX,
int  nSrcY,
int  nDstX,
int  nDstY,
byte  iColor 
)

Writes a line into this bitmap

Parameters
nSrcXEndpoint 1 x
nSrcYEndpoint 1 y
nDstXEndpoint 2 x
nDstYEndpoint 2 y
iColorPixel value

◆ line() [2/2]

void Bagel::CBofBitmap::line ( CBofPoint pSrc,
CBofPoint pDest,
byte  iColor 
)

Writes a line into this bitmap

Parameters
pSrcEndpoint 1
pDestEndpoint 2
iColorPixel value

◆ drawRect()

void Bagel::CBofBitmap::drawRect ( CBofRect cRect,
byte  iColor 
)

Writes a Rectangle into this bitmap

Parameters
cRectPointer to rectangle Coordinates
iColorColor of rectangle

◆ fillRect()

void Bagel::CBofBitmap::fillRect ( CBofRect cRect,
byte  iColor 
)

Writes a filled in Rectangle to this bitmap

Parameters
cRectPointer to rectangle Coordinates
iColorColor of rectangle

◆ scrollRight()

ErrorCode Bagel::CBofBitmap::scrollRight ( int  nPixels,
CBofRect pRect = nullptr 
)

Scrolls current bitmap horizontally

Parameters
nPixelsNumber of pixels to scroll by
pRectSection of bitmap to scroll
Returns
Error return code

◆ scrollUp()

ErrorCode Bagel::CBofBitmap::scrollUp ( int  nPixels)

Scrolls current bitmap vertically

Parameters
nPixelsNumber of pixels to scroll by
Returns
Error return code

The documentation for this class was generated from the following file: