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;
145 if (is_null())
return false;
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);
229 else if( is_world() )
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
A NULL range is a range enclosing NO points.
Definition: Range2d.h:43
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
Definition: SWFMatrix.h:53
std::int32_t get_y_min() const
Get the y coordinate of the left-up corner.
Definition: SWFRect.h:129
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
std::int32_t get_x_max() const
Get the x coordinate of the right-down corner.
Definition: SWFRect.h:122
geometry::Range2d< std::int32_t > getRange() const
Construct and return a Range2d object.
Definition: SWFRect.h:222
2D Point class
Definition: Point2d.h:38
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
2d Range template class
Definition: Range2d.h:77
Definition: GnashKey.h:164
std::ostream & operator<<(std::ostream &os, const Point2d &p)
Output operator.
Definition: Point2d.h:136
Definition: GnashKey.h:166
const std::string & toString(VM &vm, const ObjectURI &uri)
Definition: VM.h:308
std::int32_t x
Definition: BitmapData_as.cpp:434
std::int32_t width() const
Return width of this rectangle in TWIPS.
Definition: SWFRect.h:103
Definition: GnashKey.h:148
#define DSOEXPORT
Definition: dsodefs.h:55
T clamp(T i, T min, T max)
Definition: GnashNumeric.h:77
void set_to_point(std::int32_t x, std::int32_t y)
Set ourself to bound the given point.
Definition: SWFRect.h:154
std::int32_t get_y_max() const
Get the y coordinate of the right-down corner.
Definition: SWFRect.h:136
void set_null()
set the rectangle to the NULL value
Definition: SWFRect.h:81
std::int32_t y
Definition: BitmapData_as.cpp:435
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: GnashKey.h:162
std::int32_t height() const
Return height of this rectangle in TWIPS.
Definition: SWFRect.h:109
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
bool is_world() const
TODO: deprecate this 'world' concept.
Definition: SWFRect.h:87
Definition: GnashKey.h:159
std::int32_t get_x_min() const
Get the x coordinate of the left-up corner.
Definition: SWFRect.h:115
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
bool is_null() const
returns true if this is a NULL rectangle
Definition: SWFRect.h:75