49 constexpr
static std::int32_t
rectNull = 0x80000000;
50 constexpr
static std::int32_t
rectMax = 0x7fffffff;
65 constexpr
SWFRect(
int xmin,
int ymin,
int xmax,
int ymax)
77 return (_xMin == rectNull && _xMax == rectNull);
83 _xMin = _yMin = _xMax = _yMax =
rectNull;
89 return _xMin == (- rectMax >> 9)
90 && _yMin == (- rectMax >> 9)
91 && _xMax == (rectMax >> 9)
92 && _yMax == (rectMax >> 9);
98 _xMin = _yMin = - rectMax >> 9;
99 _xMax = _yMax = rectMax >> 9;
105 return _xMax - _xMin;
111 return _yMax - _yMin;
147 if (x < _xMin || x > _xMax || y < _yMin || y > _yMax) {
161 void set_to_rect(std::int32_t x1, std::int32_t y1, std::int32_t x2,
198 _xMin = std::min(_xMin, x - radius);
199 _yMin = std::min(_yMin, y - radius);
200 _xMax = std::max(_xMax, x + radius);
201 _yMax = std::max(_yMax, y + radius);
246 void expand_to(std::int32_t
x, std::int32_t
y)
248 _xMin = std::min(_xMin, x);
249 _yMin = std::min(_yMin, y);
250 _xMax = std::max(_xMax, x);
251 _yMax = std::max(_yMax, y);
280 #endif // GNASH_RECT_H
Definition: GnashKey.h:147
std::string toString() const
Return a string representation for this rectangle.
Definition: SWFRect.cpp:128
A NULL range is a range enclosing NO points.
Definition: Range2d.h:43
void set_lerp(const SWFRect &a, const SWFRect &b, float t)
Definition: SWFRect.cpp:107
std::int32_t get_x_max() const
Get the x coordinate of the right-down corner.
Definition: SWFRect.h:122
void clamp(geometry::Point2d &p) const
Make sure that the given point falls in this rectangle, modifying it's coordinates if needed...
Definition: SWFRect.cpp:120
bool is_world() const
TODO: deprecate this 'world' concept.
Definition: SWFRect.h:87
std::int32_t get_y_min() const
Get the y coordinate of the left-up corner.
Definition: SWFRect.h:129
void set_to_rect(std::int32_t x1, std::int32_t y1, std::int32_t x2, std::int32_t y2)
Definition: SWFRect.h:161
A WORLD range2d is a range including all points on the plane.
Definition: Range2d.h:52
constexpr SWFRect(int xmin, int ymin, int xmax, int ymax)
Construct a rectangle with given coordinates.
Definition: SWFRect.h:65
bool point_test(std::int32_t x, std::int32_t y) const
Return true if the given point is inside this SWFRect.
Definition: SWFRect.h:143
DSOEXPORT void expand_to_transformed_rect(const SWFMatrix &m, const SWFRect &r)
Definition: SWFRect.cpp:74
Definition: SWFMatrix.h:53
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
void enclose_transformed_rect(const SWFMatrix &m, const SWFRect &r)
Definition: SWFRect.cpp:32
2D Point class
Definition: Point2d.h:38
std::int32_t height() const
Return height of this rectangle in TWIPS.
Definition: SWFRect.h:109
constexpr SWFRect()
Construct a NULL rectangle.
Definition: SWFRect.h:56
void set_world()
set the rectangle to the WORLD value
Definition: SWFRect.h:96
void expand_to_point(std::int32_t x, std::int32_t y)
Expand this rectangle to enclose the given point.
Definition: SWFRect.h:171
static constexpr std::int32_t rectNull
Definition: SWFRect.h:49
2d Range template class
Definition: Range2d.h:77
geometry::Range2d< std::int32_t > getRange() const
Construct and return a Range2d object.
Definition: SWFRect.h:222
bool is_null() const
returns true if this is a NULL rectangle
Definition: SWFRect.h:75
Definition: GnashKey.h:164
std::ostream & operator<<(std::ostream &o, const URL &u)
Definition: URL.cpp:447
Definition: GnashKey.h:166
std::int32_t x
Definition: BitmapData_as.cpp:434
static constexpr std::int32_t rectMax
Definition: SWFRect.h:50
Definition: GnashKey.h:148
#define DSOEXPORT
Definition: dsodefs.h:55
void set_to_point(std::int32_t x, std::int32_t y)
Set ourself to bound the given point.
Definition: SWFRect.h:154
void set_null()
set the rectangle to the NULL value
Definition: SWFRect.h:81
std::int32_t y
Definition: BitmapData_as.cpp:435
std::int32_t width() const
Return width of this rectangle in TWIPS.
Definition: SWFRect.h:103
DSOEXPORT void expand_to_rect(const SWFRect &r)
Makes union of the given and the current SWFRect.
Definition: SWFRect.cpp:56
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: GnashKey.h:162
void expand_to_circle(std::int32_t x, std::int32_t y, std::int32_t radius)
Expand this rectangle to enclose the given circle.
Definition: SWFRect.h:186
std::int32_t get_y_max() const
Get the y coordinate of the right-down corner.
Definition: SWFRect.h:136
Definition: GnashKey.h:159
std::int32_t get_x_min() const
Get the x coordinate of the left-up corner.
Definition: SWFRect.h:115
friend std::ostream & operator<<(std::ostream &os, const SWFRect &SWFRect)
Ouput operator.
Definition: SWFRect.h:262