resonance 1.0.1
Loading...
Searching...
No Matches
ARect Class Reference

Half open rectangle of pixel coordinates. More...

#include <arect.h>

Public Member Functions

ARect Intersection (const ARect &other) const
 Intersect this rectangle with another.

Public Attributes

short mLeft
short mTop
short mRight
short mBottom

Detailed Description

Half open rectangle of pixel coordinates.

The record is not polymorphic and has no RTTI, and the image retains no title for it. The name here follows the A prefix every other art library type uses, and is therefore inferred rather than recovered.

The record is eight bytes, four signed halfwords in left, top, right, bottom order. The layout was recovered from three independent places. ACanvas stores its clip rectangle in exactly this form at offset 0x18. ACanvas::DrawRectU() reads the four halfwords at 0x00, 0x02, 0x04, and 0x06 of its argument and treats the first pair as the origin and the second as the limit. And Intersection() takes the maximum of the two origins with the minimum of the two limits.

The right and bottom edges are exclusive. ACanvas::DrawHorzLineU() fills the column range from mLeft up to but excluding mRight, and ACanvas::DrawBoxU() draws its bottom edge at mBottom minus one.

An eight byte class passed by value arrives through an invisible reference to a copy the caller allocated. ACanvas::DrawRect() proves the convention. The routine writes the clipped result back through the pointer it received and then copies the result into a fresh stack record before passing it on.

Member Function Documentation

◆ Intersection()

ARect ARect::Intersection ( const ARect & other) const

Intersect this rectangle with another.

Takes the maximum of the two origins and the minimum of the two limits. An empty result is reported through mLeft at or beyond mRight, or mTop at or beyond mBottom, rather than being normalised.

Parameters
otherThe rectangle to intersect with.
Returns
The intersection.
Ghidra address:
NTSC-U/C: 0x00613b58
Ghidra address:
PAL: 0x006546e8

Member Data Documentation

◆ mLeft

short ARect::mLeft

The first column the rectangle admits. +0x00

◆ mTop

short ARect::mTop

The first row the rectangle admits. +0x02

◆ mRight

short ARect::mRight

One past the last column the rectangle admits. +0x04

◆ mBottom

short ARect::mBottom

One past the last row the rectangle admits. +0x06


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