OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TCelArray Class Reference

TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an entire bitmap into evenly sized shapes. More...

#include <owl/celarray.h>

Public Member Functions

 TCelArray (TBitmap *bmp, int numCels, TSize celSize=TSize(), TPoint offset=TPoint(), int numRows=1, TAutoDelete=AutoDelete)
 Constructs a TCelArray from a bitmap by slicing the bitmap into a horizontal array of cels of a specified size.
 
 TCelArray (const TDib &dib, int numCels, int numRows=1)
 Constructs a TCelArray from a device independent bitmap (DIB) by slicing the DIB into a horizontal array of evenly sized cels.
 
 TCelArray (const TCelArray &src)
 Constructs a TCelArray as a copy of an existing one.
 
 TCelArray (const TSize &size, uint flags, int init, int grow, int numRows=1)
 Constructs an empty CelArray of a given size. flags is not used.
 
virtual ~TCelArray ()
 Destruct the CelArray and clean up its resources.
 
TCelArrayoperator= (const TCelArray &)
 Assign a CelArray over this CelArray, replacing all contents.
 
 operator const TBitmap & () const
 Return the image bitmap used by this CelArray.
 
 operator TBitmap & ()
 Return the image bitmap used by this CelArray.
 
TPoint Offset () const
 Return the offset within the bitmap for the celarray.
 
int NumCels () const
 Return number of cels currently in this CelArray.
 
int NumAllocCels () const
 Return number of cels allocated in this CelArray.
 
int CurRow () const
 Return NCurRow, the current row in the bitmap.
 
int NumRows () const
 Return NRows, the number of rows in this CelArray.
 
TSize CelSize () const
 Return the size of the celarray.
 
TPoint CelOffset (int cel) const
 Returns the position of the upper left corner of a given cel from the current row, relative to the upper left corner of the bitmap.
 
TRect CelRect (int cel) const
 Returns the upper left and lower right corner of a given cell from the current row, relative to the upper left corner of the bitmap.
 
TRect operator[] (int cel) const
 Retrieve the 'cel'th image from the celarray.
 
void SetNumCels (int numCels)
 Set the number of cels within the celarary.
 
void SetCelSize (TSize size)
 Sets the size of each cel in the array.
 
void SetOffset (TPoint offs)
 Set the offset within a bitmap for the start of the celarray.
 
void SetNGrowBy (int growBy)
 Set the increment by which the bitmap is resized.
 
void SetCurRow (int raw)
 Sets NCurRow to row.
 
int Add (const TBitmap &image)
 Add new cel(s) to the CelArray - return index of new addition.
 
int Add (const TCelArray &src, int index)
 Add a cel from another CelArray to this CelArray.
 
bool Remove (int index=-1)
 Removes a cel from this CelArray.
 
bool RemoveAll ()
 Removes all the cels from the array by calling Remove(-1).
 
bool Replace (int index, const TBitmap &image)
 Replace a cel in this CelArray.
 
bool Replace (int index, const TCelArray &src, int srcidx)
 Replaces a cel in this CelArray, from another CelArray.
 
TColor GetBkColor () const
 Get the current background color for this CelArray.
 
TColor SetBkColor (const TColor &)
 Set the current background color for this CelArray, returning the previous color.
 
bool BitBlt (int index, TDC &dc, int x, int y, uint32 rop=SRCCOPY)
 Draws the cel at index onto the DC at position x and y.
 
bool StretchBlt (int index, TDC &dc, const TRect &dstRect, uint32 rop=SRCCOPY)
 Draws the image of the cel onto the DC.
 
bool BitBlt (int index, TDC &, int x, int y, int dx, int dy, const TColor &bgClr, const TColor &fgClr)
 Draws the image of the cel onto the DC.
 

Detailed Description

TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an entire bitmap into evenly sized shapes.

Gadgets such as buttons can use a TCelArray to save resource space. TCelArray's functions let you control the dimensions of each cel and determine if the cel can delete the bitmap.

Definition at line 35 of file celarray.h.

Constructor & Destructor Documentation

◆ TCelArray() [1/4]

owl::TCelArray::TCelArray ( TBitmap * bmp,
int numCels,
TSize celSize = TSize(),
TPoint offset = TPoint(),
int numRows = 1,
TAutoDelete autoDelete = AutoDelete )

Constructs a TCelArray from a bitmap by slicing the bitmap into a horizontal array of cels of a specified size.

If autoDelete is true, TCelArray can automatically delete the bitmap. The ShouldDelete data member defaults to true, ensuring that the handle will be deleted when the bitmap is destroyed. If numRows is 0, the number of rows is calculated using the bitmap height and the celSize y parameter.

Definition at line 29 of file celarray.cpp.

References owl::AutoDelete, OWL_CDLEVEL, PRECONDITION, owl::ToBool(), and TRACEX.

◆ TCelArray() [2/4]

owl::TCelArray::TCelArray ( const TDib & dib,
int numCels,
int numRows = 1 )

Constructs a TCelArray from a device independent bitmap (DIB) by slicing the DIB into a horizontal array of evenly sized cels.

If numRows is 0, the number of rows is calculated using the bitmap height and the celSize y parameter.

Definition at line 55 of file celarray.cpp.

References OWL_CDLEVEL, and TRACEX.

◆ TCelArray() [3/4]

owl::TCelArray::TCelArray ( const TCelArray & src)

Constructs a TCelArray as a copy of an existing one.

If the original TCelArray owned its bitmap, the constructor copies this bitmap; otherwise, it keeps a reference to the bitmap.

Definition at line 77 of file celarray.cpp.

References OWL_CDLEVEL, and TRACEX.

◆ TCelArray() [4/4]

owl::TCelArray::TCelArray ( const TSize & size,
uint flags,
int init,
int grow,
int numRows = 1 )

Constructs an empty CelArray of a given size. flags is not used.

Definition at line 99 of file celarray.cpp.

References OWL_CDLEVEL, and TRACEX.

◆ ~TCelArray()

owl::TCelArray::~TCelArray ( )
virtual

Destruct the CelArray and clean up its resources.

If ShouldDelete is true (the default value), the bitmap is deleted. If ShouldDelete is false, no action is taken.

Definition at line 130 of file celarray.cpp.

References OWL_CDLEVEL, and TRACEX.

Member Function Documentation

◆ Add() [1/2]

int owl::TCelArray::Add ( const TBitmap & image)

Add new cel(s) to the CelArray - return index of new addition.

No mask bitmap is added.

Definition at line 186 of file celarray.cpp.

References CelOffset(), CelSize(), owl::OwlCopyBmp(), and TRACEX.

◆ Add() [2/2]

int owl::TCelArray::Add ( const TCelArray & src,
int index )

Add a cel from another CelArray to this CelArray.

Definition at line 209 of file celarray.cpp.

References CelOffset(), CelRect(), owl::OwlCopyBmp(), and TRACEX.

◆ BitBlt() [1/2]

bool owl::TCelArray::BitBlt ( int index,
TDC & dstDC,
int x,
int y,
int dx,
int dy,
const TColor & bgClr,
const TColor & fgClr )

Draws the image of the cel onto the DC.

Definition at line 302 of file celarray.cpp.

References CelRect().

◆ BitBlt() [2/2]

bool owl::TCelArray::BitBlt ( int index,
TDC & dc,
int x,
int y,
uint32 rop = SRCCOPY )

Draws the cel at index onto the DC at position x and y.

Definition at line 290 of file celarray.cpp.

References CelRect().

◆ CelOffset()

TPoint owl::TCelArray::CelOffset ( int cel) const
inline

Returns the position of the upper left corner of a given cel from the current row, relative to the upper left corner of the bitmap.

Definition at line 141 of file celarray.h.

References CelOffset().

◆ CelRect()

TRect owl::TCelArray::CelRect ( int cel) const
inline

Returns the upper left and lower right corner of a given cell from the current row, relative to the upper left corner of the bitmap.

Definition at line 149 of file celarray.h.

References CelRect().

◆ CelSize()

TSize owl::TCelArray::CelSize ( ) const
inline

Return the size of the celarray.

Definition at line 133 of file celarray.h.

◆ CurRow()

int owl::TCelArray::CurRow ( ) const
inline

Return NCurRow, the current row in the bitmap.

Definition at line 170 of file celarray.h.

◆ GetBkColor()

TColor owl::TCelArray::GetBkColor ( ) const
inline

Get the current background color for this CelArray.

Definition at line 249 of file celarray.h.

◆ NumAllocCels()

int owl::TCelArray::NumAllocCels ( ) const
inline

Return number of cels allocated in this CelArray.

Definition at line 163 of file celarray.h.

◆ NumCels()

int owl::TCelArray::NumCels ( ) const
inline

Return number of cels currently in this CelArray.

Definition at line 156 of file celarray.h.

◆ NumRows()

int owl::TCelArray::NumRows ( ) const
inline

Return NRows, the number of rows in this CelArray.

Definition at line 177 of file celarray.h.

◆ Offset()

TPoint owl::TCelArray::Offset ( ) const
inline

Return the offset within the bitmap for the celarray.

Definition at line 126 of file celarray.h.

◆ operator const TBitmap &()

owl::TCelArray::operator const TBitmap & ( ) const
inline

Return the image bitmap used by this CelArray.

Definition at line 235 of file celarray.h.

◆ operator TBitmap &()

owl::TCelArray::operator TBitmap & ( )
inline

Return the image bitmap used by this CelArray.

Definition at line 242 of file celarray.h.

◆ operator=()

TCelArray & owl::TCelArray::operator= ( const TCelArray & src)

Assign a CelArray over this CelArray, replacing all contents.

Definition at line 142 of file celarray.cpp.

References TRACEX.

◆ operator[]()

TRect owl::TCelArray::operator[] ( int cel) const
inline

Retrieve the 'cel'th image from the celarray.

Definition at line 184 of file celarray.h.

References CelRect().

◆ Remove()

bool owl::TCelArray::Remove ( int index = -1)

Removes a cel from this CelArray.

If index is < 0, all cels are removed. Returns true if cels are removed; false otherwise.

Definition at line 232 of file celarray.cpp.

References CelOffset(), and TRACEX.

◆ RemoveAll()

bool owl::TCelArray::RemoveAll ( )
inline

Removes all the cels from the array by calling Remove(-1).

Returns true if cels are removed; false otherwise.

Definition at line 228 of file celarray.h.

References Remove().

◆ Replace() [1/2]

bool owl::TCelArray::Replace ( int index,
const TBitmap & image )

Replace a cel in this CelArray.

Definition at line 259 of file celarray.cpp.

References CelOffset(), owl::OwlCopyBmp(), and TRACEX.

◆ Replace() [2/2]

bool owl::TCelArray::Replace ( int index,
const TCelArray & src,
int srcidx )

Replaces a cel in this CelArray, from another CelArray.

Definition at line 274 of file celarray.cpp.

References CelOffset(), CelRect(), owl::OwlCopyBmp(), and TRACEX.

◆ SetBkColor()

TColor owl::TCelArray::SetBkColor ( const TColor & color)
inline

Set the current background color for this CelArray, returning the previous color.

Definition at line 257 of file celarray.h.

◆ SetCelSize()

void owl::TCelArray::SetCelSize ( TSize size)
inline

Sets the size of each cel in the array.

They are all assumed to be the same.

Definition at line 206 of file celarray.h.

◆ SetCurRow()

void owl::TCelArray::SetCurRow ( int raw)
inline

Sets NCurRow to row.

Definition at line 198 of file celarray.h.

◆ SetNGrowBy()

void owl::TCelArray::SetNGrowBy ( int growBy)
inline

Set the increment by which the bitmap is resized.

Definition at line 213 of file celarray.h.

◆ SetNumCels()

void owl::TCelArray::SetNumCels ( int numCels)
inline

Set the number of cels within the celarary.

Definition at line 191 of file celarray.h.

◆ SetOffset()

void owl::TCelArray::SetOffset ( TPoint offs)
inline

Set the offset within a bitmap for the start of the celarray.

Definition at line 220 of file celarray.h.

◆ StretchBlt()

bool owl::TCelArray::StretchBlt ( int index,
TDC & dc,
const TRect & dstRect,
uint32 rop = SRCCOPY )

Draws the image of the cel onto the DC.

Definition at line 315 of file celarray.cpp.

References CelRect().


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