19 const TSize& size,
const TPoint
offset=TPoint(0,0));
35 NCels = NCelsUsed = std::max(1,
numCels);
47 " from slicing the bitmap @" << (
void*)
bmp);
58 NCels = NCelsUsed = std::max(1,
numCels);
60 CSize =
TSize(
dib.Width() / NCels,
dib.Height() / NRows);
69 " from slicing the dib @" << (
void*)&
dib);
82 NCelsUsed =
src.NCelsUsed;
83 NGrowBy =
src.NGrowBy;
84 BkColor =
src.BkColor;
85 NCurRow =
src.NCurRow;
88 ShouldDelete =
src.ShouldDelete;
90 Bitmap = ShouldDelete ?
new TBitmap(*
src.Bitmap) :
src.Bitmap;
93 " from @" << (
void*)&
src);
121 " size (" << size.cx <<
"x" << size.cy <<
")");
147 ShouldDelete =
src.ShouldDelete;
148 Bitmap = ShouldDelete ?
new TBitmap(*
src.Bitmap) :
src.Bitmap;
152 NCurRow =
src.NCurRow;
157 " contents copied over with TCelArray @" << (
void*)&
src);
168 return TPoint(Offs.x+
cel*CSize.cx, Offs.y+CSize.cy*
row);
178 return TRect(TPoint(Offs.x+
cel*CSize.cx, Offs.y+CSize.cy*
row), CSize);
188 int width =
image.Width();
189 int count = width /
CelSize().cx;
191 if (!MaybeResize(count))
196 int index = NCelsUsed;
199 TRACEX(
OwlGadget, 1,
"TCelArray @" << (
void*)
this <<
" added bitmap @" <<
214 if (NCelsUsed >= NCels)
215 if (!Resize(NCels + NGrowBy))
219 TSize(CSize.cx,CSize.cy*NRows),
CelRect(index,0).TopLeft());
221 TRACEX(
OwlGadget, 1,
"TCelArray @" << (
void*)
this <<
" added TCelArray @" <<
222 (
void*)&
src <<
" index 0x" << index);
234 if (index >= NCelsUsed)
240 else if (index < NCelsUsed) {
241 if (index < NCelsUsed-1) {
250 TRACEX(
OwlGadget, 1,
"TCelArray @" << (
void*)
this <<
" removed index 0x" << index);
261 if (index >= 0 && index < NCelsUsed) {
263 TRACEX(
OwlGadget, 1,
"TCelArray @" << (
void*)
this <<
" index 0x" << index <<
264 " replaced by TBitmap @" << (
void*)&
image);
276 if (index >= 0 && index < NCelsUsed) {
279 TRACEX(
OwlGadget, 1,
"TCelArray @" << (
void*)
this <<
" index 0x" << index <<
280 " replaced by TCelArray @" <<
" index 0x" <<
srcidx);
344TCelArray::MaybeResize(
int need)
346 if (NCelsUsed +
need > NCels)
347 if (!Resize(NCels + NGrowBy*((NCelsUsed+
need-NCels) / NGrowBy + 1)))
364 TBitmap*
bitmap =
new TBitmap(TScreenDC(), CSize.cx*
newCount, CSize.cy*NRows);
369 TMemoryDC
srcDC(*Bitmap);
371 dstDC.BitBlt(TRect(0, 0, CSize.cx*NCels, CSize.cy*NRows),
srcDC, TPoint(0));
375 srcDC.RestoreBitmap();
Definition of a bitmap Cel array class.
#define PRECONDITION(condition)
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
TBitmap is the GDI bitmap class derived from TGdiObject.
TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an e...
TSize CelSize() const
Return the size of the celarray.
bool StretchBlt(int index, TDC &dc, const TRect &dstRect, uint32 rop=SRCCOPY)
Draws the image of the cel onto the DC.
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 speci...
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 Remove(int index=-1)
Removes a cel from this CelArray.
TCelArray & operator=(const TCelArray &)
Assign a CelArray over this CelArray, replacing all contents.
virtual ~TCelArray()
Destruct the CelArray and clean up its resources.
bool Replace(int index, const TBitmap &image)
Replace a cel in this CelArray.
int Add(const TBitmap &image)
Add new cel(s) to the CelArray - return index of new addition.
TPoint CelOffset(int cel) const
Returns the position of the upper left corner of a given cel from the current row,...
TRect CelRect(int cel) const
Returns the upper left and lower right corner of a given cell from the current row,...
Class wrapper for management of color values.
TDC is the root class for GDI DC wrappers.
Pseudo-GDI object Device Independent Bitmap (DIB) class.
A device context (DC) class derived from TCreatedDC, TMemoryDC provides access to a memory DC.
TPalette is the GDI Palette class derived from TGdiObject.
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
The tagSIZE struct is defined as.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Object Windows Library (OWLNext Core)
bool OwlCopyBmp(TBitmap &dstBM, const TBitmap &srcBM, const TPoint &pt, const TSize &size, const TPoint offset=TPoint(0, 0))
Copy specified bitmap to the destination DC.
#define CONST_CAST(targetType, object)