resonance 1.0.1
Loading...
Searching...
No Matches
ACanvas Class Referenceabstract

Drawing surface over an ABitmap, with a clip rectangle. More...

#include <acanvas.h>

Inheritance diagram for ACanvas:
Collaboration diagram for ACanvas:

Classes

struct  Rle8Clip
 Columns and rows of a run length encoded copy that remain inside a clip rectangle. More...
struct  ARowInfo
 One row of source pixels addressed to one destination row of a canvas. More...
struct  AScaledRowInfo
 One stretched copy of a source bitmap into a destination rectangle, walked a row at a time. More...

Public Member Functions

 ACanvas (const ABitmap &bitmap)
 Adopt a pixel description.
void QuantizeToRamps (ACanvas &dest, const std::vector< const Color * > &colors) const
 Reduce this canvas's 32 bit pixels to palette indices over ramps of the given colours.
void DrawBitmap (const ABitmap &source, int nX, int nY)
 Copy a source bitmap, clipped, choosing the slot by source format.
virtual ~ACanvas ()
 Release the canvas.
virtual void SetColor8 (int nIndex)=0
 Set the pen colour from a palette index.
virtual void SetColor15 (unsigned short nColor)=0
 Set the pen colour from a 1555 halfword.
virtual void SetColor24 (const unsigned char *pRGB)=0
 Set the pen colour from three bytes in red, green, blue order.
virtual void SetColor32 (unsigned int nColor)=0
 Set the pen colour from an 8888 word.
virtual void SetColorNative (unsigned int nColor)=0
 Set the pen colour from a value already in the canvas storage width.
virtual int GetColor8 ()=0
 Return the palette index nearest the pen colour.
virtual unsigned short GetColor15 ()=0
 Return the pen colour packed to 1555.
virtual void GetColor24 (unsigned char *pRGB)=0
 Store the pen colour as three bytes in red, green, blue order.
virtual unsigned int GetColor32 ()=0
 Return the pen colour as an 8888 word.
virtual unsigned int GetColorNative ()=0
 Return the pen colour in the canvas storage width.
virtual void SetAlphaValues (unsigned int nColorKey)=0
 Rewrite every alpha byte of the pixel rectangle from a colour key.
virtual void DrawPixelU (int nX, int nY)=0
 Store the pen colour at one point, with no clip test.
virtual void DrawPixel (int nX, int nY)
 Store the pen colour at one point.
virtual void DrawPixel8U (int nX, int nY, int nIndex)=0
 Store one palette index at one point, with no clip test.
virtual void DrawPixel8 (int nX, int nY, int nIndex)
 Store one palette index at one point, clipped.
virtual void DrawPixel15U (int nX, int nY, unsigned short nColor)=0
 Store one 1555 colour at one point, with no clip test.
virtual void DrawPixel15 (int nX, int nY, unsigned short nColor)
 Store one 1555 colour at one point, clipped.
virtual void DrawPixel24U (int nX, int nY, const unsigned char *pRGB)=0
 Store one red, green, blue triple at one point, with no clip test.
virtual void DrawPixel24 (int nX, int nY, const unsigned char *pRGB)
 Store one red, green, blue triple at one point, clipped.
virtual void DrawPixel32U (int nX, int nY, unsigned int nColor)=0
 Store one 8888 colour at one point, with no clip test.
virtual void DrawPixel32 (int nX, int nY, unsigned int nColor)
 Store one 8888 colour at one point, clipped.
virtual void DrawPixelNativeU (int nX, int nY, unsigned int nColor)=0
 Store one value in the canvas storage width at one point, with no clip test.
virtual void DrawPixelNative (int nX, int nY, unsigned int nColor)
 Store one value in the canvas storage width at one point, clipped.
virtual int GetPixel8U (int nX, int nY)=0
 Read one point as a palette index, with no clip test.
virtual int GetPixel8 (int nX, int nY)
 Read one point as a palette index, clipped.
virtual unsigned short GetPixel15U (int nX, int nY)=0
 Read one point as a 1555 colour, with no clip test.
virtual unsigned short GetPixel15 (int nX, int nY)
 Read one point as a 1555 colour, clipped.
virtual void GetPixel24U (int nX, int nY, unsigned char *pRGB)=0
 Read one point into three bytes in red, green, blue order, with no clip test.
virtual void GetPixel24 (int nX, int nY, unsigned char *pRGB)
 Read one point into three bytes in red, green, blue order, clipped.
virtual unsigned int GetPixel32U (int nX, int nY)=0
 Read one point as an 8888 colour, with no clip test.
virtual unsigned int GetPixel32 (int nX, int nY)
 Read one point as an 8888 colour, clipped.
virtual unsigned int GetPixelNativeU (int nX, int nY)=0
 Read one point in the canvas storage width, with no clip test.
virtual unsigned int GetPixelNative (int nX, int nY)
 Read one point in the canvas storage width, clipped.
virtual void DrawHorzLineU (int nY, int nLeft, int nRight)
 Fill part of one row with the pen colour, with no clip test.
virtual void DrawHorzLine (int nY, int nLeft, int nRight)
 Fill part of one row with the pen colour.
virtual void DrawVertLineU (int nX, int nTop, int nBottom)
 Fill part of one column with the pen colour, with no clip test.
virtual void DrawVertLine (int nX, int nTop, int nBottom)
 Fill part of one column with the pen colour, clamped to the clip rectangle.
virtual void DrawRectU (ARect rect)
 Fill a rectangle with the pen colour, with no clip test.
virtual void DrawRect (ARect rect)
 Fill a rectangle with the pen colour.
virtual void DrawBoxU (ARect rect)
 Draw the four edges of a rectangle in the pen colour, with no clip test.
virtual void DrawBox (ARect rect)
 Draw the four edges of a rectangle in the pen colour, through the clipped fills.
virtual void DrawClutRectU (ARect rect, const unsigned char *pRemap)
 Rewrite every palette index inside a rectangle through a remap table.
virtual void DrawLineU (int nX0, int nY0, int nX1, int nY1)
 Draw a line in the pen colour, with no clip test.
virtual void DrawLine (int nX0, int nY0, int nX1, int nY1)
 Draw a line in the pen colour, clipped.
virtual void DrawTmapRow8U (int nY, int nLeft, int nRight, const ABitmap *pSource, APoint *pSourcePosition, const APoint *pSourceStep)
 Fill part of one row by sampling an indexed source bitmap along a fixed step.
virtual void DrawBitmapLin4U (const ABitmap &source, int nX, int nY)
 Copy a four bit source bitmap, with no clip test.
virtual void DrawBitmapLin4 (const ABitmap &source, int nX, int nY)
 Copy a four bit source bitmap, clipped.
virtual void DrawBitmapLin8U (const ABitmap &source, int nX, int nY)
 Copy an eight bit source bitmap, with no clip test.
virtual void DrawBitmapLin8 (const ABitmap &source, int nX, int nY)
 Copy an eight bit source bitmap, clipped.
virtual void DrawBitmapLin15U (const ABitmap &source, int nX, int nY)
 Copy a 1555 source bitmap, with no clip test.
virtual void DrawBitmapLin15 (const ABitmap &source, int nX, int nY)
 Copy a 1555 source bitmap, clipped.
virtual void DrawBitmapLin24U (const ABitmap &source, int nX, int nY)
 Copy a 24 bit source bitmap, with no clip test.
virtual void DrawBitmapLin24 (const ABitmap &source, int nX, int nY)
 Copy a 24 bit source bitmap, clipped.
virtual void DrawBitmapLin32U (const ABitmap &source, int nX, int nY)
 Copy a 32 bit source bitmap, with no clip test.
virtual void DrawBitmapLin32 (const ABitmap &source, int nX, int nY)
 Copy a 32 bit source bitmap, clipped.
virtual void DrawBitmapRle8U (const ABitmap &source, int nX, int nY)
 Copy a run length encoded eight bit source bitmap, with no clip test.
virtual void DrawBitmapRle8 (const ABitmap &source, int nX, int nY)
 Copy a run length encoded eight bit source bitmap, clipped.
virtual void GetBitmapLin4 (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a four bit bitmap, clipped.
virtual void GetBitmapLin4U (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a four bit bitmap, with no clip test.
virtual void GetBitmapLin8 (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into an eight bit bitmap, clipped.
virtual void GetBitmapLin8U (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into an eight bit bitmap, with no clip test.
virtual void GetBitmapLin15 (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a 1555 bitmap, clipped.
virtual void GetBitmapLin15U (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a 1555 bitmap, with no clip test.
virtual void GetBitmapLin24 (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a 24 bit bitmap, clipped.
virtual void GetBitmapLin24U (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a 24 bit bitmap, with no clip test.
virtual void GetBitmapLin32 (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a 32 bit bitmap, clipped.
virtual void GetBitmapLin32U (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a 32 bit bitmap, with no clip test.
virtual void DrawCharU (int nCharCode, const AFont *pFont, int nX, int nY)
 Draw one glyph of a font, with no clip test.
virtual void DrawChar (int nCharCode, const AFont *pFont, int nX, int nY)
 Draw one glyph of a font, clipped.
virtual void DrawTextU (const char *pText, const AFont *pFont, int nX, int nY)
 Draw a null terminated string, with no clip test.
virtual void DrawText (const char *pText, const AFont *pFont, int nX, int nY)
 Draw a null terminated string, clipped.
virtual void DrawClutBitmapLin4U (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Copy a four bit source bitmap through a remap table.
virtual void DrawClutBitmapLin8U (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Copy an eight bit source bitmap through a remap table, one row at a time.
virtual void DrawClutBitmapRowLin8U (const ARowInfo &span, const unsigned char *pRemap)
 Store one row of palette indices through a remap table.
virtual void DrawBlendBitmapLin4U (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Copy a four bit source bitmap through a blend table.
virtual void DrawBlendBitmapLin8U (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Copy an eight bit source bitmap through a blend table.
virtual void DrawBlendBitmapRowLin8U (const ARowInfo &span, const unsigned char *const *ppBlend)
 Store one row of palette indices blended against the destination.
virtual void DrawScaledBitmapRowLin8U (const AScaledRowInfo &span)
 Store one row of palette indices sampled along a fixed step.
virtual void DrawScaledBitmapRowLin15U (const AScaledRowInfo &span)
 Store one row of 1555 colours sampled along a fixed step.
virtual void DrawScaledBitmapRowLin24U (const AScaledRowInfo &span)
 Store one row of red, green, blue triples sampled along a fixed step.
virtual void DrawScaledBitmapRowLin32U (const AScaledRowInfo &span)
 Store one row of 8888 colours sampled along a fixed step.
virtual void DrawScaledClutBitmapRowLin8U (const AScaledRowInfo &span, const unsigned char *pRemap)
 Store one row of palette indices sampled along a fixed step, through a remap table.
virtual void DrawScaledBlendBitmapRowLin8U (const AScaledRowInfo &span, const unsigned char *const *ppBlend)
 Store one row of palette indices sampled along a fixed step, blended against the destination.

Static Public Member Functions

static ACanvas * NewCompatibleCanvas (const ABitmap &bitmap, bool bAllocatePixels)
 Construct the linear canvas subclass that draws a bitmap's format.
static ACanvas * NewCompatibleLinearCanvas (const ABitmap &bitmap)
 Construct a canvas over a fresh pixel rectangle shaped like a bitmap.
static ACanvas * SubCanvas (const ABitmap &source, int nX, int nY, int nWidth, int nHeight)
 Construct a canvas over a rectangle of a bitmap's pixels, sharing them.

Public Attributes

ABitmap mBitmap
ARect mClip

Static Public Attributes

static APalette * palDefault
 Palette every canvas falls back to when neither its bitmap nor its source supplies one.
static unsigned char tempBuff []
 One row of indices, shared by every block copy that has to expand a row before writing it.

Protected Member Functions

unsigned char ClipCode (int nX, int nY) const
 Classify a point against the clip rectangle.
int ClipRle8Bitmap (const ABitmap &source, int *pnX, int *pnY, ARle8Reader *pReader, Rle8Clip *pSpan) const
 Clip a run length encoded copy against the clip rectangle.
int ClipLine (int *pnX0, int *pnY0, int *pnX1, int *pnY1) const
 Clip a line against the clip rectangle, rewriting both endpoints in place.
int ClipBitmap (ABitmap *pBitmap, int *pnX, int *pnY) const
 Clip a source bitmap and a destination position against the clip rectangle.
int ClipRect (ARect *pRect) const
 Intersect a rectangle with the clip rectangle in place.
void DrawClutRect (ARect rect, const unsigned char *pRemap)
 Rewrite the palette indices inside a rectangle through a remap table, clipped.
void DrawBitmapU (const ABitmap &source, int nX, int nY)
 Copy a source bitmap, with no clip test, choosing the slot by source format.
void DrawClutBitmapLin4 (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Clip against the clip rectangle and then copy a four bit source through a remap table.
void DrawClutBitmapLin8 (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Clip against the clip rectangle and then copy an eight bit source through a remap table.
void DrawBlendBitmapLin4 (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Clip against the clip rectangle and then copy a four bit source through a blend table.
void DrawBlendBitmapLin8 (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Clip against the clip rectangle and then copy an eight bit source through a blend table.
void DrawFlatConvexPolygon (const APolygon &polygon)
 Fill a convex polygon with its colour.
void DrawTmappedConvexPolygon (const APolygon &polygon)
 Fill a convex polygon by sampling its texture.
void DrawClutBitmapU (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Copy a source bitmap through a remap table, choosing the arm by source format.
void DrawClutBitmap (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Clip against the clip rectangle and then copy through a remap table.
void DrawClutBitmapRle8U (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Copy a run length encoded source through a remap table.
void DrawClutBitmapRle8 (const ABitmap &source, int nX, int nY, const unsigned char *pRemap)
 Clip and copy a run length encoded source through a remap table.
void DrawBlendBitmapU (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Copy a source bitmap through a table of blend tables, choosing the arm by source format.
void DrawBlendBitmap (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Clip against the clip rectangle and then copy through a table of blend tables.
void DrawBlendBitmapRle8U (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Copy a run length encoded source through a table of blend tables.
void DrawBlendBitmapRle8 (const ABitmap &source, int nX, int nY, const unsigned char *const *ppBlend)
 Clip and copy a run length encoded source through a table of blend tables.
void GetBitmapU (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a bitmap, choosing the slot by destination format.
void GetBitmap (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a bitmap, clipped, choosing the slot by destination format.
void ReadRectRle8 (const ABitmap &dest, int nX, int nY)
 Read a rectangle of the canvas into a run length encoded bitmap.
int ClipAndSetupScaledBitmap (const ABitmap &source, const ARect &rect, AScaledRowInfo *pBlit) const
 Prepare a stretched copy of a source bitmap into a destination rectangle.
void DrawScaledBitmap (const ABitmap &source, const ARect &rect)
 Stretch a source bitmap into a destination rectangle, choosing the arm by source format.
void DrawScaledBitmapLin4 (const ABitmap &source, const ARect &rect)
 Stretch a four bit source bitmap into a destination rectangle.
void DrawScaledBitmapLin8 (const ABitmap &source, const ARect &rect)
 Stretch an eight bit source bitmap into a destination rectangle, through DrawScaledBitmapRowLin8U().
void DrawScaledBitmapLin15 (const ABitmap &source, const ARect &rect)
 Stretch a 1555 source bitmap into a destination rectangle, through DrawScaledBitmapRowLin15U().
void DrawScaledBitmapLin24 (const ABitmap &source, const ARect &rect)
 Stretch a 24 bit source bitmap into a destination rectangle, through DrawScaledBitmapRowLin24U().
void DrawScaledBitmapLin32 (const ABitmap &source, const ARect &rect)
 Stretch a 32 bit source bitmap into a destination rectangle, through DrawScaledBitmapRowLin32U().
void DrawScaledBitmapRle8 (const ABitmap &source, const ARect &rect)
 Stretch a run length encoded source into a destination rectangle.
void DrawScaledClutBitmap (const ABitmap &source, const ARect &rect, const unsigned char *pRemap)
 Stretch an indexed source through a remap table, choosing the arm by source format.
void DrawScaledClutBitmapLin4 (const ABitmap &source, const ARect &rect, const unsigned char *pRemap)
 Stretch a four bit source through a remap table.
void DrawScaledClutBitmapLin8 (const ABitmap &source, const ARect &rect, const unsigned char *pRemap)
 Stretch an eight bit source through a remap table, through DrawScaledClutBitmapRowLin8U().
void DrawScaledClutBitmapRle8 (const ABitmap &source, const ARect &rect, const unsigned char *pRemap)
 Stretch a run length encoded source through a remap table.
void DrawScaledBlendBitmap (const ABitmap &source, const ARect &rect, const unsigned char *const *ppBlend)
 Stretch an indexed source blended against the destination, choosing the arm by source format.
void DrawScaledBlendBitmapLin8 (const ABitmap &source, const ARect &rect, const unsigned char *const *ppBlend)
 Stretch an eight bit source blended against the destination.
void DrawScaledBlendBitmapLin4 (const ABitmap &source, const ARect &rect, const unsigned char *const *ppBlend)
 Stretch a four bit source blended against the destination.
void DrawScaledBlendBitmapRle8 (const ABitmap &source, const ARect &rect, const unsigned char *const *ppBlend)
 Stretch a run length encoded source blended against the destination.

Static Protected Member Functions

static int SetupLine (int nX0, int nY0, int nX1, int nY1, int *pnStepX, int *pnStepY)
 Derive the per pixel step of a line and return the pixel count.
static int FindTopmostPolyVertex (const APolygon &polygon)
 Return the position in APolygon::mIndices of the vertex with the smallest row.
static void Unpack4 (const unsigned char *pSource, unsigned char *pDest, int nCount, int bStartHighNibble)
 Unpack one row of four bit pixels into one byte each.

Detailed Description

Drawing surface over an ABitmap, with a clip rectangle.

Its RTTI descriptor is at 0x0086f660 and lacks a base class. The virtual function table pointer sits after the data members at offset 0x20, the position the toolchain uses for a class with no base.

The table at 0x00837dc8 has 85 slots and terminates on the all zero entry at 0x00838070. Slot 0 is the type function at 0x005ead28 and slot 1 is the destructor. 22 of the remaining slots point at the shared pure virtual stub at 0x005381a8. Every declaration below appears in slot order, which is the order the toolchain assigns, so the position of a member in this class reproduces its index.

Five subclasses implement the drawing operations, one per accepted ABitmapFormat code, and each derives through an intermediate width class: ACanvasLin4 through ACanvas8, ACanvasLin8 through ACanvas8, ACanvasLin15 through ACanvas15, ACanvasLin24 through ACanvas24, and ACanvasLin32 through ACanvas32. Every object in the family is 0x28 bytes, the subclass pen colour at offset 0x24 being one byte wide for the two indexed formats, two for the 15 bit format, and four for the 24 and 32 bit formats.

The division of labour between the two subclass levels is clean. The width class implements the five pen colour setters, the five pen colour getters, and the eight per format pixel accessors, all in terms of the two accessors that use its own storage width. The layout class implements those two, plus whichever bulk operation benefits from direct addressing.

Every operation appears twice, once with the clip test and once without. The unclipped form takes the U suffix. For the pixel accessors and the row, column, and rectangle fills the unclipped form is pure virtual here and the clipped form is implemented here in terms of it. For the copy and read slots both forms are implemented here, the clipped one calling ClipBitmap() and then the unclipped one.

Six colour formats arrive at a pixel. The pen colour form uses no argument. The indexed form takes a palette index, the 1555 form a halfword, the RGB form three bytes, the 8888 form a word, and the native form a value in the canvas storage width. On a 32 bit canvas the 8888 and native forms coincide, and ACanvas32 implements the native pair by forwarding to the 8888 pair.

Both data members are public. Rnd::Font::CharInfo::CharInfo() reads mBitmap.mWidth and mBitmap.mHeight from outside the hierarchy and the image supplies no accessor. The access rule therefore gives public. A friend declaration for Rnd::Font fits the image equally well. mClip has no reader outside the hierarchy and would otherwise be protected, and it shares the public section so that the recovered order of the two is preserved.

Constructor & Destructor Documentation

◆ ACanvas()

ACanvas::ACanvas ( const ABitmap & bitmap)
explicit

Adopt a pixel description.

The description is copied whole and the clip rectangle is set to the full bitmap, from the origin to mWidth by mHeight. Every subclass constructor calls this first and then installs its own virtual function table.

Parameters
bitmapThe description to adopt.
Ghidra address:
NTSC-U/C: 0x005eb1a0
Ghidra address:
PAL: 0x0062d2e8

◆ ~ACanvas()

virtual ACanvas::~ACanvas ( )
virtual

Release the canvas.

The compiled body reinstalls this class's virtual function table before releasing. That is what the toolchain emits for a base destructor. The pixel rectangle is not released here.

Every subclass destructor compiles to the same body, which installs this class's table and releases the object when the deleting flag is set. ACanvas15, ACanvas32, and ACanvasLin32 leave theirs implicit (0x0062fb40, 0x0062f710, and 0x006141a0), and the other subclasses declare one.

Ghidra address:
NTSC-U/C: 0x005ead68
Ghidra address:
PAL: 0x0062ceb0

Member Function Documentation

◆ NewCompatibleCanvas()

ACanvas * ACanvas::NewCompatibleCanvas ( const ABitmap & bitmap,
bool bAllocatePixels )
static

Construct the linear canvas subclass that draws a bitmap's format.

Copies the description. When asked to allocate, the copy gains a row stride derived from its format, (mWidth + 2) / 2 for kABitmapFormatLinear4 and mWidth times the matching entry of ABitmap::bmPixelSize otherwise, and a pixel rectangle allocated with the source file and line as its tag. The copy's mByteCount is not updated. The format code then selects the subclass through the jump table at 0x00837d90.

The byte count passed to the allocator is a 64-bit product of the height and the stride, computed through the helper at 0x00600270 and truncated to 32 bits.

Parameters
bitmapThe description to copy.
bAllocatePixelsWhether to allocate a fresh pixel rectangle for the copy.
Returns
The new canvas, or null for a format code of kABitmapFormatCount or more, or when the allocation returns null.
Ghidra address:
NTSC-U/C: 0x005e8bc8
Ghidra address:
PAL: 0x0062ad10

◆ NewCompatibleLinearCanvas()

ACanvas * ACanvas::NewCompatibleLinearCanvas ( const ABitmap & bitmap)
static

Construct a canvas over a fresh pixel rectangle shaped like a bitmap.

Rewrites a format code of kABitmapFormatRle8 to kABitmapFormatLinear8 in a copy, then calls NewCompatibleCanvas() with allocation requested. The image has no caller.

Parameters
bitmapThe description to copy.
Returns
The new canvas, or null.
Ghidra address:
NTSC-U/C: 0x005eb200
Ghidra address:
PAL: 0x0062d348

◆ SubCanvas()

ACanvas * ACanvas::SubCanvas ( const ABitmap & source,
int nX,
int nY,
int nWidth,
int nHeight )
static

Construct a canvas over a rectangle of a bitmap's pixels, sharing them.

Builds the rectangle through the sub-rectangle ABitmap constructor and selects the subclass through the jump table at 0x00837db0. Unlike NewCompatibleCanvas(), a kABitmapFormatLinear4 rectangle gets an ACanvasLin8, and kABitmapFormatRle8 gets no canvas. The image has no caller.

Parameters
sourceThe bitmap whose pixels the canvas draws into.
nXThe left column of the rectangle.
nYThe top row of the rectangle.
nWidthThe width in pixels.
nHeightThe height in pixels.
Returns
The new canvas, or null for a format code of kABitmapFormatRle8 or more.
Ghidra address:
NTSC-U/C: 0x005e8e38
Ghidra address:
PAL: 0x0062af80

◆ QuantizeToRamps()

void ACanvas::QuantizeToRamps ( ACanvas & dest,
const std::vector< const Color * > & colors ) const

Reduce this canvas's 32 bit pixels to palette indices over ramps of the given colours.

One NormalKey per distinct hue is collected from colors through NormalKey::InsertUniqueNormalKey(), and the static APalette::BuildRampPalette() writes their ramps into dest's palette. Every source pixel then writes one byte to dest. A pixel with zero alpha becomes index 0. Any other pixel is matched to the key whose ratios have the least summed absolute difference from its own, the first such key winning a tie. Its shade is (int)(pixel scale / key scale / 17 + 0.5), and a shade of 0 becomes index 16 while any other becomes 16 times the key's position plus the shade, capped at 15. With no colours, dest's first width times height bytes are cleared. The pixel count is this canvas's width times height, and dest is assumed to be as large. MetRenderer's routine at 0x001716d0 is the one caller, passing the locked canvases of two textures. The name is inferred.

Parameters
destThe eight bit canvas whose pixels and palette are written.
colorsThe colours whose hues the palette covers. Their alpha is not read.
Ghidra address:
NTSC-U/C: 0x00557af8
Ghidra address:
PAL: 0x00598c50

◆ DrawBitmap()

void ACanvas::DrawBitmap ( const ABitmap & source,
int nX,
int nY )

Copy a source bitmap, clipped, choosing the slot by source format.

Calls through the six entry table of pointers to member functions at 0x0077dcc8, the same table DrawChar() uses, whose entries are DrawBitmapLin4() through DrawBitmapLin32() and then DrawBitmapRle8(). The one caller in the image is Rnd::Movie::OnChunk() at 0x005cf4c0, outside the art library.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec1d8
Ghidra address:
PAL: 0x0062e320

◆ SetColor8()

virtual void ACanvas::SetColor8 ( int nIndex)
pure virtual

Set the pen colour from a palette index.

Parameters
nIndexThe palette index.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ SetColor15()

virtual void ACanvas::SetColor15 ( unsigned short nColor)
pure virtual

Set the pen colour from a 1555 halfword.

Parameters
nColorThe colour, five bits per channel with alpha in the top bit.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ SetColor24()

virtual void ACanvas::SetColor24 ( const unsigned char * pRGB)
pure virtual

Set the pen colour from three bytes in red, green, blue order.

Alpha is forced to full on every subclass that stores one.

Parameters
pRGBThe three channel bytes.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ SetColor32()

virtual void ACanvas::SetColor32 ( unsigned int nColor)
pure virtual

Set the pen colour from an 8888 word.

Parameters
nColorThe colour, one byte per channel in red, green, blue, alpha order.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ SetColorNative()

virtual void ACanvas::SetColorNative ( unsigned int nColor)
pure virtual

Set the pen colour from a value already in the canvas storage width.

Parameters
nColorThe colour in the canvas pixel format.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ GetColor8()

virtual int ACanvas::GetColor8 ( )
pure virtual

Return the palette index nearest the pen colour.

Returns
The palette index.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ GetColor15()

virtual unsigned short ACanvas::GetColor15 ( )
pure virtual

Return the pen colour packed to 1555.

Returns
The colour, five bits per channel with alpha in the top bit.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ GetColor24()

virtual void ACanvas::GetColor24 ( unsigned char * pRGB)
pure virtual

Store the pen colour as three bytes in red, green, blue order.

Parameters
pRGBThe three channel bytes to write.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ GetColor32()

virtual unsigned int ACanvas::GetColor32 ( )
pure virtual

Return the pen colour as an 8888 word.

Returns
The colour, one byte per channel.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ GetColorNative()

virtual unsigned int ACanvas::GetColorNative ( )
pure virtual

Return the pen colour in the canvas storage width.

Returns
The colour in the canvas pixel format.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ SetAlphaValues()

virtual void ACanvas::SetAlphaValues ( unsigned int nColorKey)
pure virtual

Rewrite every alpha byte of the pixel rectangle from a colour key.

A pixel whose colour channels equal the key loses its alpha, and every other pixel gains full alpha. The two indexed subclasses implement the slot over their own storage width.

Parameters
nColorKeyThe colour to treat as transparent.

Implemented in ACanvas8, ACanvasLin15, ACanvasLin24, and ACanvasLin32.

◆ DrawPixelU()

virtual void ACanvas::DrawPixelU ( int nX,
int nY )
pure virtual

Store the pen colour at one point, with no clip test.

Parameters
nXThe column.
nYThe row.

Implemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, ACanvasLin4, and ACanvasLin8.

◆ DrawPixel()

virtual void ACanvas::DrawPixel ( int nX,
int nY )
virtual

Store the pen colour at one point.

Returns with no store for a point outside the clip rectangle.

Parameters
nXThe column.
nYThe row.
Ghidra address:
NTSC-U/C: 0x005eb520
Ghidra address:
PAL: 0x0062d668

◆ DrawPixel8U()

virtual void ACanvas::DrawPixel8U ( int nX,
int nY,
int nIndex )
pure virtual

Store one palette index at one point, with no clip test.

Parameters
nXThe column.
nYThe row.
nIndexThe palette index.

Implemented in ACanvas15, ACanvas24, ACanvas32, ACanvasLin4, and ACanvasLin8.

◆ DrawPixel8()

virtual void ACanvas::DrawPixel8 ( int nX,
int nY,
int nIndex )
virtual

Store one palette index at one point, clipped.

Parameters
nXThe column.
nYThe row.
nIndexThe palette index.
Ghidra address:
NTSC-U/C: 0x005eb590
Ghidra address:
PAL: 0x0062d6d8

◆ DrawPixel15U()

virtual void ACanvas::DrawPixel15U ( int nX,
int nY,
unsigned short nColor )
pure virtual

Store one 1555 colour at one point, with no clip test.

Parameters
nXThe column.
nYThe row.
nColorThe colour.

Implemented in ACanvas24, ACanvas32, ACanvas8, and ACanvasLin15.

◆ DrawPixel15()

virtual void ACanvas::DrawPixel15 ( int nX,
int nY,
unsigned short nColor )
virtual

Store one 1555 colour at one point, clipped.

Parameters
nXThe column.
nYThe row.
nColorThe colour.
Ghidra address:
NTSC-U/C: 0x005eb608
Ghidra address:
PAL: 0x0062d750

◆ DrawPixel24U()

virtual void ACanvas::DrawPixel24U ( int nX,
int nY,
const unsigned char * pRGB )
pure virtual

Store one red, green, blue triple at one point, with no clip test.

Parameters
nXThe column.
nYThe row.
pRGBThe three channel bytes.

Implemented in ACanvas15, ACanvas32, ACanvas8, and ACanvasLin24.

◆ DrawPixel24()

virtual void ACanvas::DrawPixel24 ( int nX,
int nY,
const unsigned char * pRGB )
virtual

Store one red, green, blue triple at one point, clipped.

Parameters
nXThe column.
nYThe row.
pRGBThe three channel bytes.
Ghidra address:
NTSC-U/C: 0x005eb680
Ghidra address:
PAL: 0x0062d7c8

◆ DrawPixel32U()

virtual void ACanvas::DrawPixel32U ( int nX,
int nY,
unsigned int nColor )
pure virtual

Store one 8888 colour at one point, with no clip test.

Parameters
nXThe column.
nYThe row.
nColorThe colour.

Implemented in ACanvas15, ACanvas24, ACanvas8, and ACanvasLin32.

◆ DrawPixel32()

virtual void ACanvas::DrawPixel32 ( int nX,
int nY,
unsigned int nColor )
virtual

Store one 8888 colour at one point, clipped.

Parameters
nXThe column.
nYThe row.
nColorThe colour.
Ghidra address:
NTSC-U/C: 0x005eb6f0
Ghidra address:
PAL: 0x0062d838

◆ DrawPixelNativeU()

virtual void ACanvas::DrawPixelNativeU ( int nX,
int nY,
unsigned int nColor )
pure virtual

Store one value in the canvas storage width at one point, with no clip test.

Parameters
nXThe column.
nYThe row.
nColorThe colour in the canvas pixel format.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ DrawPixelNative()

virtual void ACanvas::DrawPixelNative ( int nX,
int nY,
unsigned int nColor )
virtual

Store one value in the canvas storage width at one point, clipped.

Parameters
nXThe column.
nYThe row.
nColorThe colour in the canvas pixel format.
Ghidra address:
NTSC-U/C: 0x005eb760
Ghidra address:
PAL: 0x0062d8a8

◆ GetPixel8U()

virtual int ACanvas::GetPixel8U ( int nX,
int nY )
pure virtual

Read one point as a palette index, with no clip test.

Parameters
nXThe column.
nYThe row.
Returns
The palette index.

Implemented in ACanvas15, ACanvas24, ACanvas32, ACanvasLin4, and ACanvasLin8.

◆ GetPixel8()

virtual int ACanvas::GetPixel8 ( int nX,
int nY )
virtual

Read one point as a palette index, clipped.

Parameters
nXThe column.
nYThe row.
Returns
The palette index, or zero when the point is clipped away.
Ghidra address:
NTSC-U/C: 0x005eb7d0
Ghidra address:
PAL: 0x0062d918

◆ GetPixel15U()

virtual unsigned short ACanvas::GetPixel15U ( int nX,
int nY )
pure virtual

Read one point as a 1555 colour, with no clip test.

Parameters
nXThe column.
nYThe row.
Returns
The colour.

Implemented in ACanvas24, ACanvas32, ACanvas8, and ACanvasLin15.

◆ GetPixel15()

virtual unsigned short ACanvas::GetPixel15 ( int nX,
int nY )
virtual

Read one point as a 1555 colour, clipped.

Parameters
nXThe column.
nYThe row.
Returns
The colour, or zero when the point is clipped away.
Ghidra address:
NTSC-U/C: 0x005eb848
Ghidra address:
PAL: 0x0062d990

◆ GetPixel24U()

virtual void ACanvas::GetPixel24U ( int nX,
int nY,
unsigned char * pRGB )
pure virtual

Read one point into three bytes in red, green, blue order, with no clip test.

Parameters
nXThe column.
nYThe row.
pRGBThe three channel bytes to write.

Implemented in ACanvas15, ACanvas32, ACanvas8, and ACanvasLin24.

◆ GetPixel24()

virtual void ACanvas::GetPixel24 ( int nX,
int nY,
unsigned char * pRGB )
virtual

Read one point into three bytes in red, green, blue order, clipped.

Clears the three bytes for a point outside the clip rectangle.

Parameters
nXThe column.
nYThe row.
pRGBThe three channel bytes to write.
Ghidra address:
NTSC-U/C: 0x005eb8c0
Ghidra address:
PAL: 0x0062da08

◆ GetPixel32U()

virtual unsigned int ACanvas::GetPixel32U ( int nX,
int nY )
pure virtual

Read one point as an 8888 colour, with no clip test.

ACanvasLin32 implements the slot at 0x00614350 as a single word load at the row stride times the row plus four times the column, which settles the result as one 32-bit word. Its signedness is not recoverable.

Parameters
nXThe column.
nYThe row.
Returns
The colour.

Implemented in ACanvas15, ACanvas24, ACanvas8, and ACanvasLin32.

◆ GetPixel32()

virtual unsigned int ACanvas::GetPixel32 ( int nX,
int nY )
virtual

Read one point as an 8888 colour, clipped.

Parameters
nXThe column.
nYThe row.
Returns
The colour, or zero when the point is clipped away.
Ghidra address:
NTSC-U/C: 0x005eb948
Ghidra address:
PAL: 0x0062da90

◆ GetPixelNativeU()

virtual unsigned int ACanvas::GetPixelNativeU ( int nX,
int nY )
pure virtual

Read one point in the canvas storage width, with no clip test.

Parameters
nXThe column.
nYThe row.
Returns
The value in the canvas pixel format.

Implemented in ACanvas15, ACanvas24, ACanvas32, and ACanvas8.

◆ GetPixelNative()

virtual unsigned int ACanvas::GetPixelNative ( int nX,
int nY )
virtual

Read one point in the canvas storage width, clipped.

Parameters
nXThe column.
nYThe row.
Returns
The value, or zero when the point is clipped away.
Ghidra address:
NTSC-U/C: 0x005eb9c0
Ghidra address:
PAL: 0x0062db08

◆ DrawHorzLineU()

virtual void ACanvas::DrawHorzLineU ( int nY,
int nLeft,
int nRight )
virtual

Fill part of one row with the pen colour, with no clip test.

Parameters
nYThe row.
nLeftThe first column.
nRightOne past the last column.
Ghidra address:
NTSC-U/C: 0x005eba38
Ghidra address:
PAL: 0x0062db80

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawHorzLine()

virtual void ACanvas::DrawHorzLine ( int nY,
int nLeft,
int nRight )
virtual

Fill part of one row with the pen colour.

Clamps the column range to the clip rectangle and returns for a row outside it.

Parameters
nYThe row.
nLeftThe first column.
nRightOne past the last column.
Ghidra address:
NTSC-U/C: 0x005ebab8
Ghidra address:
PAL: 0x0062dc00

◆ DrawVertLineU()

virtual void ACanvas::DrawVertLineU ( int nX,
int nTop,
int nBottom )
virtual

Fill part of one column with the pen colour, with no clip test.

Parameters
nXThe column.
nTopThe first row.
nBottomOne past the last row.
Ghidra address:
NTSC-U/C: 0x005ebb30
Ghidra address:
PAL: 0x0062dc78

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawVertLine()

virtual void ACanvas::DrawVertLine ( int nX,
int nTop,
int nBottom )
virtual

Fill part of one column with the pen colour, clamped to the clip rectangle.

Parameters
nXThe column.
nTopThe first row.
nBottomOne past the last row.
Ghidra address:
NTSC-U/C: 0x005ebbb0
Ghidra address:
PAL: 0x0062dcf8

◆ DrawRectU()

virtual void ACanvas::DrawRectU ( ARect rect)
virtual

Fill a rectangle with the pen colour, with no clip test.

Parameters
rectThe rectangle.
Ghidra address:
NTSC-U/C: 0x005ebc28
Ghidra address:
PAL: 0x0062dd70

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawRect()

virtual void ACanvas::DrawRect ( ARect rect)
virtual

Fill a rectangle with the pen colour.

Intersects the rectangle with the clip rectangle in place and returns for an empty result.

Parameters
rectThe rectangle.
Ghidra address:
NTSC-U/C: 0x005ebc98
Ghidra address:
PAL: 0x0062dde0

◆ DrawBoxU()

virtual void ACanvas::DrawBoxU ( ARect rect)
virtual

Draw the four edges of a rectangle in the pen colour, with no clip test.

Parameters
rectThe rectangle.
Ghidra address:
NTSC-U/C: 0x005e9378
Ghidra address:
PAL: 0x0062b4c0

◆ DrawBox()

virtual void ACanvas::DrawBox ( ARect rect)
virtual

Draw the four edges of a rectangle in the pen colour, through the clipped fills.

Parameters
rectThe rectangle.
Ghidra address:
NTSC-U/C: 0x005e9440
Ghidra address:
PAL: 0x0062b588

◆ DrawClutRectU()

virtual void ACanvas::DrawClutRectU ( ARect rect,
const unsigned char * pRemap )
virtual

Rewrite every palette index inside a rectangle through a remap table.

Parameters
rectThe rectangle.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ebd40
Ghidra address:
PAL: 0x0062de88

Reimplemented in ACanvasLin8.

◆ DrawLineU()

virtual void ACanvas::DrawLineU ( int nX0,
int nY0,
int nX1,
int nY1 )
virtual

Draw a line in the pen colour, with no clip test.

Every coordinate is 24.8 fixed point. SetupLine() supplies a step of one whole unit along the major axis and the pixel count.

Parameters
nX0The first column.
nY0The first row.
nX1The last column.
nY1The last row.
Ghidra address:
NTSC-U/C: 0x005ebec8
Ghidra address:
PAL: 0x0062e010

◆ DrawLine()

virtual void ACanvas::DrawLine ( int nX0,
int nY0,
int nX1,
int nY1 )
virtual

Draw a line in the pen colour, clipped.

Clips both endpoints first and returns when nothing survives. Every coordinate is 24.8 fixed point.

Parameters
nX0The first column.
nY0The first row.
nX1The last column.
nY1The last row.
Ghidra address:
NTSC-U/C: 0x005ebf70
Ghidra address:
PAL: 0x0062e0b8

◆ DrawTmapRow8U()

virtual void ACanvas::DrawTmapRow8U ( int nY,
int nLeft,
int nRight,
const ABitmap * pSource,
APoint * pSourcePosition,
const APoint * pSourceStep )
virtual

Fill part of one row by sampling an indexed source bitmap along a fixed step.

The position advances by the step once per destination column, and the whole parts of the two components address one source byte. The step advances both components, so the sampled run is an arbitrary straight line through the source rather than one source row.

Parameters
nYThe destination row.
nLeftThe first destination column.
nRightOne past the last destination column.
pSourceThe source bitmap.
pSourcePositionThe source position in 24.8 fixed point, advanced in place.
pSourceStepThe per column advance in 24.8 fixed point.
Ghidra address:
NTSC-U/C: 0x005ec050
Ghidra address:
PAL: 0x0062e198

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawBitmapLin4U()

virtual void ACanvas::DrawBitmapLin4U ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a four bit source bitmap, with no clip test.

Walks the low nibble of each byte first, and the kABitmapOddNibbleStart bit of the source starts a row in the high nibble instead.

The transparency test compares a whole source byte against mTransparentColor rather than the nibble the loop just consumed, and it reads the byte after the loop has already advanced past it in the high nibble case. Both are faithful to the binary.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec280
Ghidra address:
PAL: 0x0062e3c8

Reimplemented in ACanvasLin15, ACanvasLin32, ACanvasLin4, and ACanvasLin8.

◆ DrawBitmapLin4()

virtual void ACanvas::DrawBitmapLin4 ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a four bit source bitmap, clipped.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec3c0
Ghidra address:
PAL: 0x0062e508

◆ DrawBitmapLin8U()

virtual void ACanvas::DrawBitmapLin8U ( const ABitmap & source,
int nX,
int nY )
virtual

Copy an eight bit source bitmap, with no clip test.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec450
Ghidra address:
PAL: 0x0062e598

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, ACanvasLin4, and ACanvasLin8.

◆ DrawBitmapLin8()

virtual void ACanvas::DrawBitmapLin8 ( const ABitmap & source,
int nX,
int nY )
virtual

Copy an eight bit source bitmap, clipped.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec570
Ghidra address:
PAL: 0x0062e6b8

◆ DrawBitmapLin15U()

virtual void ACanvas::DrawBitmapLin15U ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a 1555 source bitmap, with no clip test.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec600
Ghidra address:
PAL: 0x0062e748

Reimplemented in ACanvasLin15.

◆ DrawBitmapLin15()

virtual void ACanvas::DrawBitmapLin15 ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a 1555 source bitmap, clipped.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec738
Ghidra address:
PAL: 0x0062e880

◆ DrawBitmapLin24U()

virtual void ACanvas::DrawBitmapLin24U ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a 24 bit source bitmap, with no clip test.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec7c8
Ghidra address:
PAL: 0x0062e910

Reimplemented in ACanvasLin24.

◆ DrawBitmapLin24()

virtual void ACanvas::DrawBitmapLin24 ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a 24 bit source bitmap, clipped.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec928
Ghidra address:
PAL: 0x0062ea70

◆ DrawBitmapLin32U()

virtual void ACanvas::DrawBitmapLin32U ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a 32 bit source bitmap, with no clip test.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec9b8
Ghidra address:
PAL: 0x0062eb00

Reimplemented in ACanvasLin32.

◆ DrawBitmapLin32()

virtual void ACanvas::DrawBitmapLin32 ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a 32 bit source bitmap, clipped.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ecad8
Ghidra address:
PAL: 0x0062ec20

◆ DrawBitmapRle8U()

virtual void ACanvas::DrawBitmapRle8U ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a run length encoded eight bit source bitmap, with no clip test.

Decodes one row into ACanvas::tempBuff, describes the decoded row as an eight bit ABitmap of one row, and copies it with DrawBitmapLin8U().

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ecb68
Ghidra address:
PAL: 0x0062ecb0

Reimplemented in ACanvasLin4, and ACanvasLin8.

◆ DrawBitmapRle8()

virtual void ACanvas::DrawBitmapRle8 ( const ABitmap & source,
int nX,
int nY )
virtual

Copy a run length encoded eight bit source bitmap, clipped.

Forwards to DrawBitmapRle8U() when the whole source fits inside the clip rectangle, and otherwise decodes and copies the surviving rows one at a time.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005e9cb8
Ghidra address:
PAL: 0x0062be00

◆ GetBitmapLin4()

virtual void ACanvas::GetBitmapLin4 ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a four bit bitmap, clipped.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ecef0
Ghidra address:
PAL: 0x0062f038

◆ GetBitmapLin4U()

virtual void ACanvas::GetBitmapLin4U ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a four bit bitmap, with no clip test.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ecdb8
Ghidra address:
PAL: 0x0062ef00

◆ GetBitmapLin8()

virtual void ACanvas::GetBitmapLin8 ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into an eight bit bitmap, clipped.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed070
Ghidra address:
PAL: 0x0062f1b8

◆ GetBitmapLin8U()

virtual void ACanvas::GetBitmapLin8U ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into an eight bit bitmap, with no clip test.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ecf80
Ghidra address:
PAL: 0x0062f0c8

◆ GetBitmapLin15()

virtual void ACanvas::GetBitmapLin15 ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a 1555 bitmap, clipped.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed208
Ghidra address:
PAL: 0x0062f350

◆ GetBitmapLin15U()

virtual void ACanvas::GetBitmapLin15U ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a 1555 bitmap, with no clip test.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed100
Ghidra address:
PAL: 0x0062f248

◆ GetBitmapLin24()

virtual void ACanvas::GetBitmapLin24 ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a 24 bit bitmap, clipped.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed398
Ghidra address:
PAL: 0x0062f4e0

◆ GetBitmapLin24U()

virtual void ACanvas::GetBitmapLin24U ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a 24 bit bitmap, with no clip test.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed298
Ghidra address:
PAL: 0x0062f3e0

◆ GetBitmapLin32()

virtual void ACanvas::GetBitmapLin32 ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a 32 bit bitmap, clipped.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed520
Ghidra address:
PAL: 0x0062f668

◆ GetBitmapLin32U()

virtual void ACanvas::GetBitmapLin32U ( const ABitmap & dest,
int nX,
int nY )
virtual

Read a rectangle of the canvas into a 32 bit bitmap, with no clip test.

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ed428
Ghidra address:
PAL: 0x0062f570

◆ DrawCharU()

virtual void ACanvas::DrawCharU ( int nCharCode,
const AFont * pFont,
int nX,
int nY )
virtual

Draw one glyph of a font, with no clip test.

Selects the unclipped copy slot from the glyph format code, through the six entry table of pointers to member functions at 0x0077dc98. A code below mFirstCharCode indexes before the glyph array, and a code at or beyond the glyph count yields a null glyph the routine then reads through. Both are faithful to the binary.

Parameters
nCharCodeThe character code.
pFontThe font.
nXThe destination column.
nYThe baseline row.
Ghidra address:
NTSC-U/C: 0x005e9ee8
Ghidra address:
PAL: 0x0062c030

◆ DrawChar()

virtual void ACanvas::DrawChar ( int nCharCode,
const AFont * pFont,
int nX,
int nY )
virtual

Draw one glyph of a font, clipped.

Selects the clipped copy slot through the table at 0x0077dcc8.

Parameters
nCharCodeThe character code.
pFontThe font.
nXThe destination column.
nYThe baseline row.
Ghidra address:
NTSC-U/C: 0x005e9fc8
Ghidra address:
PAL: 0x0062c110

◆ DrawTextU()

virtual void ACanvas::DrawTextU ( const char * pText,
const AFont * pFont,
int nX,
int nY )
virtual

Draw a null terminated string, with no clip test.

A newline returns to the starting column and advances the row by the font line height. Every other code draws one glyph and advances the column by the glyph width.

Parameters
pTextThe string.
pFontThe font.
nXThe starting column.
nYThe baseline row.
Ghidra address:
NTSC-U/C: 0x005ed5b0
Ghidra address:
PAL: 0x0062f6f8

◆ DrawText()

virtual void ACanvas::DrawText ( const char * pText,
const AFont * pFont,
int nX,
int nY )
virtual

Draw a null terminated string, clipped.

Parameters
pTextThe string.
pFontThe font.
nXThe starting column.
nYThe baseline row.
Ghidra address:
NTSC-U/C: 0x005ea120
Ghidra address:
PAL: 0x0062c268

◆ DrawClutBitmapLin4U()

virtual void ACanvas::DrawClutBitmapLin4U ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
virtual

Copy a four bit source bitmap through a remap table.

Unpacks one row into ACanvas::tempBuff and stores the remapped row.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ed858
Ghidra address:
PAL: 0x0062f9a0

◆ DrawClutBitmapLin8U()

virtual void ACanvas::DrawClutBitmapLin8U ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
virtual

Copy an eight bit source bitmap through a remap table, one row at a time.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005eda30
Ghidra address:
PAL: 0x0062fb78

◆ DrawClutBitmapRowLin8U()

virtual void ACanvas::DrawClutBitmapRowLin8U ( const ARowInfo & span,
const unsigned char * pRemap )
virtual

Store one row of palette indices through a remap table.

Skips a source value equal to the span transparent colour.

Parameters
spanThe row to store.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005edd08
Ghidra address:
PAL: 0x0062fe50

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawBlendBitmapLin4U()

virtual void ACanvas::DrawBlendBitmapLin4U ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
virtual

Copy a four bit source bitmap through a blend table.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005edfb8
Ghidra address:
PAL: 0x00630100

◆ DrawBlendBitmapLin8U()

virtual void ACanvas::DrawBlendBitmapLin8U ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
virtual

Copy an eight bit source bitmap through a blend table.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ee1c8
Ghidra address:
PAL: 0x00630310

◆ DrawBlendBitmapRowLin8U()

virtual void ACanvas::DrawBlendBitmapRowLin8U ( const ARowInfo & span,
const unsigned char *const * ppBlend )
virtual

Store one row of palette indices blended against the destination.

Reads the destination index, then selects the replacement from the blend row of the source index. Index zero is transparent when the span requests transparency, which differs from DrawClutBitmapRowLin8U(), where the span transparent colour applies instead.

Parameters
spanThe row to store.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ee4a0
Ghidra address:
PAL: 0x006305e8

Reimplemented in ACanvasLin8.

◆ DrawScaledBitmapRowLin8U()

virtual void ACanvas::DrawScaledBitmapRowLin8U ( const AScaledRowInfo & span)
virtual

Store one row of palette indices sampled along a fixed step.

Parameters
spanThe row to store.
Ghidra address:
NTSC-U/C: 0x005ee968
Ghidra address:
PAL: 0x00630ab0

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawScaledBitmapRowLin15U()

virtual void ACanvas::DrawScaledBitmapRowLin15U ( const AScaledRowInfo & span)
virtual

Store one row of 1555 colours sampled along a fixed step.

Parameters
spanThe row to store.
Ghidra address:
NTSC-U/C: 0x005eea18
Ghidra address:
PAL: 0x00630b60

◆ DrawScaledBitmapRowLin24U()

virtual void ACanvas::DrawScaledBitmapRowLin24U ( const AScaledRowInfo & span)
virtual

Store one row of red, green, blue triples sampled along a fixed step.

Parameters
spanThe row to store.
Ghidra address:
NTSC-U/C: 0x005eeac8
Ghidra address:
PAL: 0x00630c10

◆ DrawScaledBitmapRowLin32U()

virtual void ACanvas::DrawScaledBitmapRowLin32U ( const AScaledRowInfo & span)
virtual

Store one row of 8888 colours sampled along a fixed step.

Parameters
spanThe row to store.
Ghidra address:
NTSC-U/C: 0x005eebb8
Ghidra address:
PAL: 0x00630d00

◆ DrawScaledClutBitmapRowLin8U()

virtual void ACanvas::DrawScaledClutBitmapRowLin8U ( const AScaledRowInfo & span,
const unsigned char * pRemap )
virtual

Store one row of palette indices sampled along a fixed step, through a remap table.

Parameters
spanThe row to store.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005eedb8
Ghidra address:
PAL: 0x00630f00

Reimplemented in ACanvasLin15, ACanvasLin24, ACanvasLin32, and ACanvasLin8.

◆ DrawScaledBlendBitmapRowLin8U()

virtual void ACanvas::DrawScaledBlendBitmapRowLin8U ( const AScaledRowInfo & span,
const unsigned char *const * ppBlend )
virtual

Store one row of palette indices sampled along a fixed step, blended against the destination.

Parameters
spanThe row to store.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005eefc0
Ghidra address:
PAL: 0x00631108

Reimplemented in ACanvasLin8.

◆ ClipCode()

unsigned char ACanvas::ClipCode ( int nX,
int nY ) const
protected

Classify a point against the clip rectangle.

The code is formed in eight bits, and ClipLine() compares combinations of two codes in eight bits as well.

Parameters
nXThe horizontal coordinate.
nYThe vertical coordinate.
Returns
The ACanvasClipCode bits, or zero when the point is inside.
Ghidra address:
NTSC-U/C: 0x005eb3d0
Ghidra address:
PAL: 0x0062d518

◆ ClipRle8Bitmap()

int ACanvas::ClipRle8Bitmap ( const ABitmap & source,
int * pnX,
int * pnY,
ARle8Reader * pReader,
Rle8Clip * pSpan ) const
protected

Clip a run length encoded copy against the clip rectangle.

Records the decoded columns that remain and the destination row the copy stops at, and moves the destination position onto the clip rectangle. Rows above the clip rectangle are consumed through ARle8Reader::SkipRow(), so the reader then addresses the first row that remains. The row fields are not written when no column remains.

The image has no caller. DrawBitmapRle8(), DrawClutBitmapRle8(), and DrawBlendBitmapRle8() each compile an inlined copy.

Parameters
sourceThe source bitmap.
pnXThe destination column, moved right to the clip rectangle when it lies left of it.
pnYThe destination row, moved down likewise.
pReaderThe reader over the source, already at the first row.
pSpanThe record to fill.
Returns
Zero when no column or no row remains.
Ghidra address:
NTSC-U/C: 0x005eb418
Ghidra address:
PAL: 0x0062d560

◆ ClipLine()

int ACanvas::ClipLine ( int * pnX0,
int * pnY0,
int * pnX1,
int * pnY1 ) const
protected

Clip a line against the clip rectangle, rewriting both endpoints in place.

Every coordinate is 24.8 fixed point. The routine is a Cohen and Sutherland clip that only ever moves the second endpoint. When the second endpoint is inside and the first is not, the two are exchanged first, so the endpoints can return in the opposite order. An endpoint clipped to the right or bottom edge lands AFix::epsilon inside the exclusive edge.

The outcode of the first endpoint is computed once, before the loop, and after an exchange it is taken as zero rather than recomputed.

Parameters
pnX0The first column.
pnY0The first row.
pnX1The last column.
pnY1The last row.
Returns
Zero when nothing remains, and one otherwise.
Ghidra address:
NTSC-U/C: 0x005e8fd8
Ghidra address:
PAL: 0x0062b120

◆ ClipBitmap()

int ACanvas::ClipBitmap ( ABitmap * pBitmap,
int * pnX,
int * pnY ) const
protected

Clip a source bitmap and a destination position against the clip rectangle.

Advances the pixel pointer, shrinks the extent, and moves the destination position, all in place. Every clipped copy and read slot calls this first.

The left clip of a kABitmapFormatLinear4 bitmap has two defects in the binary. The pixel pointer advances by half the destination column rather than by half the columns clipped away, and for an odd count the new mOddNibbleStart is the inverse of this canvas's own flag rather than of the bitmap's.

Parameters
pBitmapThe bitmap to clip.
pnXThe destination column.
pnYThe destination row.
Returns
Zero when nothing remains.
Ghidra address:
NTSC-U/C: 0x005e91b8
Ghidra address:
PAL: 0x0062b300

◆ ClipRect()

int ACanvas::ClipRect ( ARect * pRect) const
protected

Intersect a rectangle with the clip rectangle in place.

Non-virtual, and the image has no caller.

Parameters
pRectThe rectangle to clip.
Returns
Zero when the intersection is empty.
Ghidra address:
NTSC-U/C: 0x005eaeb8
Ghidra address:
PAL: 0x0062d000

◆ DrawClutRect()

void ACanvas::DrawClutRect ( ARect rect,
const unsigned char * pRemap )
protected

Rewrite the palette indices inside a rectangle through a remap table, clipped.

Intersects the rectangle with the clip rectangle and calls DrawClutRectU() when the result is not empty. Non-virtual and orphaned.

Parameters
rectThe rectangle.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ebe10
Ghidra address:
PAL: 0x0062df58

◆ DrawBitmapU()

void ACanvas::DrawBitmapU ( const ABitmap & source,
int nX,
int nY )
protected

Copy a source bitmap, with no clip test, choosing the slot by source format.

Calls through the table at 0x0077dc98, the one DrawCharU() uses. Non-virtual and orphaned.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
Ghidra address:
NTSC-U/C: 0x005ec130
Ghidra address:
PAL: 0x0062e278

◆ DrawClutBitmapLin4()

void ACanvas::DrawClutBitmapLin4 ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
protected

Clip against the clip rectangle and then copy a four bit source through a remap table.

The clip runs against a stack copy of the source description. Non-virtual and orphaned.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ed990
Ghidra address:
PAL: 0x0062fad8

◆ DrawClutBitmapLin8()

void ACanvas::DrawClutBitmapLin8 ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
protected

Clip against the clip rectangle and then copy an eight bit source through a remap table.

Non-virtual and orphaned.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005edb38
Ghidra address:
PAL: 0x0062fc80

◆ DrawBlendBitmapLin4()

void ACanvas::DrawBlendBitmapLin4 ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
protected

Clip against the clip rectangle and then copy a four bit source through a blend table.

Non-virtual and orphaned.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ee128
Ghidra address:
PAL: 0x00630270

◆ DrawBlendBitmapLin8()

void ACanvas::DrawBlendBitmapLin8 ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
protected

Clip against the clip rectangle and then copy an eight bit source through a blend table.

Non-virtual and orphaned.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ee2d0
Ghidra address:
PAL: 0x00630418

◆ DrawFlatConvexPolygon()

void ACanvas::DrawFlatConvexPolygon ( const APolygon & polygon)
protected

Fill a convex polygon with its colour.

Sets the pen colour through SetColorNative() from APolygon::mColor, then walks two edges down from the top vertex, one forward and one backward through the vertex list, filling each row between them with DrawHorzLine(). Each edge column is rounded to the nearest whole column with AFix::onehalf. Rows above the clip rectangle advance the edges without drawing, and the walk stops at the bottom of the clip rectangle or when the two edges meet.

Non-virtual and orphaned.

Parameters
polygonThe polygon.
Ghidra address:
NTSC-U/C: 0x005e95e8
Ghidra address:
PAL: 0x0062b730

◆ DrawTmappedConvexPolygon()

void ACanvas::DrawTmappedConvexPolygon ( const APolygon & polygon)
protected

Fill a convex polygon by sampling its texture.

Walks the edges as DrawFlatConvexPolygon() does. Each row interpolates the texture position between the two edges, clamps its columns to the clip rectangle, advancing the start position by the columns clamped away on the left, and draws with DrawTmapRow8U(). A row of no columns draws nothing. FindTopmostPolyVertex() is compiled inline here.

Non-virtual and orphaned.

Parameters
polygonThe polygon, whose first word is its texture.
Ghidra address:
NTSC-U/C: 0x005e98c8
Ghidra address:
PAL: 0x0062ba10

◆ DrawClutBitmapU()

void ACanvas::DrawClutBitmapU ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
protected

Copy a source bitmap through a remap table, choosing the arm by source format.

Non-virtual, and orphaned in the shipped image: it fills no slot of this class's table and the image has no caller and no data reference. Format code 0 goes to DrawClutBitmapLin4U(), code 1 to DrawClutBitmapLin8U(), and code 5 to DrawClutBitmapRle8U(). Every other code returns without drawing.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ed6a8
Ghidra address:
PAL: 0x0062f7f0

◆ DrawClutBitmap()

void ACanvas::DrawClutBitmap ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
protected

Clip against the clip rectangle and then copy through a remap table.

The clip runs against a stack copy of the source description, because ClipBitmap() rewrites what it is given. A zero result returns without drawing. The run length encoded format is handed over unclipped, because DrawClutBitmapRle8() clips for itself.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ed718
Ghidra address:
PAL: 0x0062f860

◆ DrawClutBitmapRle8U()

void ACanvas::DrawClutBitmapRle8U ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
protected

Copy a run length encoded source through a remap table.

The run length encoded arm of DrawClutBitmapU(), reached only for format code 5. It decodes each row into ACanvas::tempBuff through ARle8Reader and stores it with DrawClutBitmapRowLin8U().

The row loop advances nY rather than the span row, so its bound recedes with the row and a source of one row or more never finishes. DrawClutBitmapU() has no caller in the image, so the defect is unreachable.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005edbd8
Ghidra address:
PAL: 0x0062fd20

◆ DrawClutBitmapRle8()

void ACanvas::DrawClutBitmapRle8 ( const ABitmap & source,
int nX,
int nY,
const unsigned char * pRemap )
protected

Clip and copy a run length encoded source through a remap table.

The clipped counterpart of DrawClutBitmapRle8U(), reached only from DrawClutBitmap(). Rows above the clip rectangle are consumed through ARle8Reader::SkipRow() rather than decoded. The clipping matches DrawBitmapRle8(), without its test for a source wholly inside the clip rectangle.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005ea280
Ghidra address:
PAL: 0x0062c3c8

◆ DrawBlendBitmapU()

void ACanvas::DrawBlendBitmapU ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
protected

Copy a source bitmap through a table of blend tables, choosing the arm by source format.

Non-virtual and orphaned, with the same shape as DrawClutBitmapU(). Format code 0 goes to DrawBlendBitmapLin4U(), code 1 to DrawBlendBitmapLin8U(), and code 5 to DrawBlendBitmapRle8U().

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ede08
Ghidra address:
PAL: 0x0062ff50

◆ DrawBlendBitmap()

void ACanvas::DrawBlendBitmap ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
protected

Clip against the clip rectangle and then copy through a table of blend tables.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ede78
Ghidra address:
PAL: 0x0062ffc0

◆ DrawBlendBitmapRle8U()

void ACanvas::DrawBlendBitmapRle8U ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
protected

Copy a run length encoded source through a table of blend tables.

The same code as DrawClutBitmapRle8U() with DrawBlendBitmapRowLin8U() in place of DrawClutBitmapRowLin8U(), including the row loop that never finishes. DrawBlendBitmapU() has no caller in the image.

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ee370
Ghidra address:
PAL: 0x006304b8

◆ DrawBlendBitmapRle8()

void ACanvas::DrawBlendBitmapRle8 ( const ABitmap & source,
int nX,
int nY,
const unsigned char *const * ppBlend )
protected

Clip and copy a run length encoded source through a table of blend tables.

The same code as DrawClutBitmapRle8() with DrawBlendBitmapRowLin8U() in place of DrawClutBitmapRowLin8U().

Parameters
sourceThe source bitmap.
nXThe destination column.
nYThe destination row.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005ea460
Ghidra address:
PAL: 0x0062c5a8

◆ GetBitmapU()

void ACanvas::GetBitmapU ( const ABitmap & dest,
int nX,
int nY )
protected

Read a rectangle of the canvas into a bitmap, choosing the slot by destination format.

Non-virtual and orphaned, like DrawClutBitmapU(). Calls through the six entry table of pointers to member functions at 0x0077dcf8, whose first five entries address the unclipped read slots GetBitmapLin4U() through GetBitmapLin32U() and whose sixth is ReadRectRle8().

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ecc68
Ghidra address:
PAL: 0x0062edb0

◆ GetBitmap()

void ACanvas::GetBitmap ( const ABitmap & dest,
int nX,
int nY )
protected

Read a rectangle of the canvas into a bitmap, clipped, choosing the slot by destination format.

Non-virtual and orphaned. Calls through the table at 0x0077dd28, which addresses the clipped read slots GetBitmapLin4() through GetBitmapLin32() and then ReadRectRle8().

Parameters
destThe destination bitmap, whose extent selects the rectangle.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005ecd10
Ghidra address:
PAL: 0x0062ee58

◆ ReadRectRle8()

void ACanvas::ReadRectRle8 ( const ABitmap & dest,
int nX,
int nY )
protected

Read a rectangle of the canvas into a run length encoded bitmap.

Empty. The run length encoded entry of both read tables addresses this one body, so a read into kABitmapFormatRle8 does nothing.

Parameters
destThe destination bitmap.
nXThe source column.
nYThe source row.
Ghidra address:
NTSC-U/C: 0x005eb190
Ghidra address:
PAL: 0x0062d2d8

◆ ClipAndSetupScaledBitmap()

int ACanvas::ClipAndSetupScaledBitmap ( const ABitmap & source,
const ARect & rect,
AScaledRowInfo * pBlit ) const
protected

Prepare a stretched copy of a source bitmap into a destination rectangle.

Both steps are the source extent in 24.8 fixed point divided by the destination extent, and each position starts at half its step, so the walk samples the centre of each source cell. The destination rectangle is clamped to the clip rectangle, and the positions advance by one step per row or column clamped away. AScaledRowInfo::mSource addresses the first source row the walk samples.

The palette resolves from the source, then the canvas, then ACanvas::palDefault.

Parameters
sourceThe source bitmap.
rectThe destination rectangle, before clipping.
pBlitThe record to fill.
Returns
Zero when the rectangle is empty before or after clipping.
Ghidra address:
NTSC-U/C: 0x005ea780
Ghidra address:
PAL: 0x0062c8c8

◆ DrawScaledBitmap()

void ACanvas::DrawScaledBitmap ( const ABitmap & source,
const ARect & rect )
protected

Stretch a source bitmap into a destination rectangle, choosing the arm by source format.

Non-virtual and orphaned. Calls through the six entry table of pointers to member functions at 0x0077dd58, whose entries are DrawScaledBitmapLin4() through DrawScaledBitmapLin32() and then DrawScaledBitmapRle8(). Every arm clips against the clip rectangle.

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ee580
Ghidra address:
PAL: 0x006306c8

◆ DrawScaledBitmapLin4()

void ACanvas::DrawScaledBitmapLin4 ( const ABitmap & source,
const ARect & rect )
protected

Stretch a four bit source bitmap into a destination rectangle.

Unpacks each sampled row into ACanvas::tempBuff and stores it with DrawScaledBitmapRowLin8U(). The row walk starts at the first source row rather than at the row ClipAndSetupScaledBitmap() selected. A rectangle clipped at the top samples rows from too high in the source.

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ea640
Ghidra address:
PAL: 0x0062c788

◆ DrawScaledBitmapLin8()

void ACanvas::DrawScaledBitmapLin8 ( const ABitmap & source,
const ARect & rect )
protected

Stretch an eight bit source bitmap into a destination rectangle, through DrawScaledBitmapRowLin8U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ee628
Ghidra address:
PAL: 0x00630770

◆ DrawScaledBitmapLin15()

void ACanvas::DrawScaledBitmapLin15 ( const ABitmap & source,
const ARect & rect )
protected

Stretch a 1555 source bitmap into a destination rectangle, through DrawScaledBitmapRowLin15U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ee6f8
Ghidra address:
PAL: 0x00630840

◆ DrawScaledBitmapLin24()

void ACanvas::DrawScaledBitmapLin24 ( const ABitmap & source,
const ARect & rect )
protected

Stretch a 24 bit source bitmap into a destination rectangle, through DrawScaledBitmapRowLin24U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ee7c8
Ghidra address:
PAL: 0x00630910

◆ DrawScaledBitmapLin32()

void ACanvas::DrawScaledBitmapLin32 ( const ABitmap & source,
const ARect & rect )
protected

Stretch a 32 bit source bitmap into a destination rectangle, through DrawScaledBitmapRowLin32U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ee898
Ghidra address:
PAL: 0x006309e0

◆ DrawScaledBitmapRle8()

void ACanvas::DrawScaledBitmapRle8 ( const ABitmap & source,
const ARect & rect )
protected

Stretch a run length encoded source into a destination rectangle.

Decodes the first sampled row into ACanvas::tempBuff, then decodes again only when the sampled row changes, consuming any rows between through ARle8Reader::SkipRow().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
Ghidra address:
NTSC-U/C: 0x005ea960
Ghidra address:
PAL: 0x0062caa8

◆ DrawScaledClutBitmap()

void ACanvas::DrawScaledClutBitmap ( const ABitmap & source,
const ARect & rect,
const unsigned char * pRemap )
protected

Stretch an indexed source through a remap table, choosing the arm by source format.

Non-virtual and orphaned. Format code 0 goes to DrawScaledClutBitmapLin4(), code 1 to DrawScaledClutBitmapLin8(), and code 5 to DrawScaledClutBitmapRle8(). Every other code draws nothing.

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005eec70
Ghidra address:
PAL: 0x00630db8

◆ DrawScaledClutBitmapLin4()

void ACanvas::DrawScaledClutBitmapLin4 ( const ABitmap & source,
const ARect & rect,
const unsigned char * pRemap )
protected

Stretch a four bit source through a remap table.

Empty.

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005eecd0
Ghidra address:
PAL: 0x00630e18

◆ DrawScaledClutBitmapLin8()

void ACanvas::DrawScaledClutBitmapLin8 ( const ABitmap & source,
const ARect & rect,
const unsigned char * pRemap )
protected

Stretch an eight bit source through a remap table, through DrawScaledClutBitmapRowLin8U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005eecd8
Ghidra address:
PAL: 0x00630e20

◆ DrawScaledClutBitmapRle8()

void ACanvas::DrawScaledClutBitmapRle8 ( const ABitmap & source,
const ARect & rect,
const unsigned char * pRemap )
protected

Stretch a run length encoded source through a remap table.

The same code as DrawScaledBitmapRle8() with DrawScaledClutBitmapRowLin8U() in place of DrawScaledBitmapRowLin8U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
pRemap256 replacement indices, one per source index.
Ghidra address:
NTSC-U/C: 0x005eaa98
Ghidra address:
PAL: 0x0062cbe0

◆ DrawScaledBlendBitmap()

void ACanvas::DrawScaledBlendBitmap ( const ABitmap & source,
const ARect & rect,
const unsigned char *const * ppBlend )
protected

Stretch an indexed source blended against the destination, choosing the arm by source format.

Non-virtual and orphaned. Format code 0 goes to DrawScaledBlendBitmapLin4(), code 1 to DrawScaledBlendBitmapLin8(), and code 5 to DrawScaledBlendBitmapRle8(). The four bit arm reads its source as eight bit and the eight bit arm is empty.

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005eee78
Ghidra address:
PAL: 0x00630fc0

◆ DrawScaledBlendBitmapLin8()

void ACanvas::DrawScaledBlendBitmapLin8 ( const ABitmap & source,
const ARect & rect,
const unsigned char *const * ppBlend )
protected

Stretch an eight bit source blended against the destination.

Empty.

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005eeed8
Ghidra address:
PAL: 0x00631020

◆ DrawScaledBlendBitmapLin4()

void ACanvas::DrawScaledBlendBitmapLin4 ( const ABitmap & source,
const ARect & rect,
const unsigned char *const * ppBlend )
protected

Stretch a four bit source blended against the destination.

The source is read as eight bit, through DrawScaledBlendBitmapRowLin8U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005eeee0
Ghidra address:
PAL: 0x00631028

◆ DrawScaledBlendBitmapRle8()

void ACanvas::DrawScaledBlendBitmapRle8 ( const ABitmap & source,
const ARect & rect,
const unsigned char *const * ppBlend )
protected

Stretch a run length encoded source blended against the destination.

The same code as DrawScaledBitmapRle8() with DrawScaledBlendBitmapRowLin8U() in place of DrawScaledBitmapRowLin8U().

Parameters
sourceThe source bitmap.
rectThe destination rectangle.
ppBlend256 rows of 256 replacement indices, selected by source then destination.
Ghidra address:
NTSC-U/C: 0x005eabe0
Ghidra address:
PAL: 0x0062cd28

◆ SetupLine()

int ACanvas::SetupLine ( int nX0,
int nY0,
int nX1,
int nY1,
int * pnStepX,
int * pnStepY )
staticprotected

Derive the per pixel step of a line and return the pixel count.

Every coordinate and both steps are 24.8 fixed point. The major axis advances one whole unit per pixel and the minor axis advances the quotient of the two extents.

Parameters
nX0The first column.
nY0The first row.
nX1The last column.
nY1The last row.
pnStepXThe column step to write.
pnStepYThe row step to write.
Returns
The pixel count, or zero for a line of no extent.
Ghidra address:
NTSC-U/C: 0x005e9508
Ghidra address:
PAL: 0x0062b650

◆ FindTopmostPolyVertex()

int ACanvas::FindTopmostPolyVertex ( const APolygon & polygon)
staticprotected

Return the position in APolygon::mIndices of the vertex with the smallest row.

A tie resolves to the earlier position.

Parameters
polygonThe polygon.
Returns
The index into APolygon::mIndices.
Ghidra address:
NTSC-U/C: 0x005ebfe0
Ghidra address:
PAL: 0x0062e128

◆ Unpack4()

void ACanvas::Unpack4 ( const unsigned char * pSource,
unsigned char * pDest,
int nCount,
int bStartHighNibble )
staticprotected

Unpack one row of four bit pixels into one byte each.

The low nibble of a byte supplies the earlier pixel.

Parameters
pSourceThe packed row.
pDestThe unpacked row.
nCountThe number of pixels.
bStartHighNibbleWhether the first pixel is the high nibble of the first byte.
Ghidra address:
NTSC-U/C: 0x005eddb8
Ghidra address:
PAL: 0x0062ff00

Member Data Documentation

◆ palDefault

APalette* ACanvas::palDefault
static

Palette every canvas falls back to when neither its bitmap nor its source supplies one.

Read by ACanvas8::SetColor8() and every other slot that resolves a palette index, always after the bitmap palette is found null.

No writer was located. The fallback may be permanently null.

Ghidra address:
NTSC-U/C: 0x0086f6f0
Ghidra address:
PAL: 0x008b3dd0

◆ tempBuff

unsigned char ACanvas::tempBuff[]
static

One row of indices, shared by every block copy that has to expand a row before writing it.

ACanvasLin4 unpacks a four-bit row into it, both four-bit layout classes decode a run-length encoded row into it, and several ACanvas block copies use it the same way. Each writes the row and consumes it before returning.

The bound is not recovered. The buffer is a plain static with no allocation to read a size from, and the definition takes the 0x400 bytes up to the nearest referenced address above it.

Ghidra address:
NTSC-U/C: 0x008f09f0
Ghidra address:
PAL: 0x00935a00

◆ mBitmap

ABitmap ACanvas::mBitmap

The pixel rectangle this canvas draws into. +0x00

◆ mClip

ARect ACanvas::mClip

The clip rectangle every clipped operation tests against. +0x18


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