OWLNext 7.0
Borland's Object Windows Library for the modern age
|
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. | |
TCelArray & | operator= (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. | |
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.
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.
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.
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.
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.
|
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.
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 a cel from another CelArray to this CelArray.
Definition at line 209 of file celarray.cpp.
References CelOffset(), CelRect(), owl::OwlCopyBmp(), and TRACEX.
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().
Draws the cel at index onto the DC at position x and y.
Definition at line 290 of file celarray.cpp.
References CelRect().
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().
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().
|
inline |
Return the size of the celarray.
Definition at line 133 of file celarray.h.
|
inline |
Return NCurRow, the current row in the bitmap.
Definition at line 170 of file celarray.h.
|
inline |
Get the current background color for this CelArray.
Definition at line 249 of file celarray.h.
|
inline |
Return number of cels allocated in this CelArray.
Definition at line 163 of file celarray.h.
|
inline |
Return number of cels currently in this CelArray.
Definition at line 156 of file celarray.h.
|
inline |
Return NRows, the number of rows in this CelArray.
Definition at line 177 of file celarray.h.
|
inline |
Return the offset within the bitmap for the celarray.
Definition at line 126 of file celarray.h.
|
inline |
Return the image bitmap used by this CelArray.
Definition at line 235 of file celarray.h.
|
inline |
Return the image bitmap used by this CelArray.
Definition at line 242 of file celarray.h.
Assign a CelArray over this CelArray, replacing all contents.
Definition at line 142 of file celarray.cpp.
References TRACEX.
Retrieve the 'cel'th image from the celarray.
Definition at line 184 of file celarray.h.
References CelRect().
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.
|
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 a cel in this CelArray.
Definition at line 259 of file celarray.cpp.
References CelOffset(), owl::OwlCopyBmp(), and TRACEX.
Replaces a cel in this CelArray, from another CelArray.
Definition at line 274 of file celarray.cpp.
References CelOffset(), CelRect(), owl::OwlCopyBmp(), and TRACEX.
Set the current background color for this CelArray, returning the previous color.
Definition at line 257 of file celarray.h.
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.
Sets NCurRow to row.
Definition at line 198 of file celarray.h.
Set the increment by which the bitmap is resized.
Definition at line 213 of file celarray.h.
Set the number of cels within the celarary.
Definition at line 191 of file celarray.h.
Set the offset within a bitmap for the start of the celarray.
Definition at line 220 of file celarray.h.
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().