26 #include <boost/cstdint.hpp>
49 static const boost::int32_t
rectNull = 0x80000000;
50 static const boost::int32_t
rectMax = 0x7fffffff;
65 SWFRect(
int xmin,
int ymin,
int xmax,
int ymax)
83 _xMin = _yMin = _xMax = _yMax =
rectNull;
89 return _xMin == (-
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(boost::int32_t x1, boost::int32_t y1, boost::int32_t x2,
187 boost::int32_t radius)
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(boost::int32_t
x, boost::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);
254 boost::int32_t _xMin;
255 boost::int32_t _yMin;
256 boost::int32_t _xMax;
257 boost::int32_t _yMax;
280 #endif // GNASH_RECT_H
Definition: GnashKey.h:147
boost::int32_t width() const
Return width of this rectangle in TWIPS.
Definition: SWFRect.h:103
std::string toString() const
Return a string representation for this rectangle.
Definition: SWFRect.cpp:132
A NULL range is a range enclosing NO points.
Definition: Range2d.h:42
void set_lerp(const SWFRect &a, const SWFRect &b, float t)
Definition: SWFRect.cpp:111
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:124
void expand_to_circle(boost::int32_t x, boost::int32_t y, boost::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
void expand_to_point(boost::int32_t x, boost::int32_t y)
Expand this rectangle to enclose the given point.
Definition: SWFRect.h:171
A WORLD range2d is a range including all points on the plane.
Definition: Range2d.h:51
bool point_test(boost::int32_t x, boost::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:78
Definition: SWFMatrix.h:53
boost::int32_t get_x_max() const
Get the x coordinate of the right-down corner.
Definition: SWFRect.h:122
static const boost::int32_t rectMax
Definition: SWFRect.h:50
geometry::Range2d< boost::int32_t > getRange() const
Construct and return a Range2d object.
Definition: SWFRect.h:222
boost::int32_t height() const
Return height of this rectangle in TWIPS.
Definition: SWFRect.h:109
void enclose_transformed_rect(const SWFMatrix &m, const SWFRect &r)
Definition: SWFRect.cpp:36
2D Point class
Definition: Point2d.h:38
void set_world()
set the rectangle to the WORLD value
Definition: SWFRect.h:96
2d Range template class
Definition: Range2d.h:69
boost::int32_t get_y_min() const
Get the y coordinate of the left-up corner.
Definition: SWFRect.h:129
boost::int32_t get_x_min() const
Get the x coordinate of the left-up corner.
Definition: SWFRect.h:115
bool is_null() const
returns true if this is a NULL rectangle
Definition: SWFRect.h:75
Definition: GnashKey.h:164
void set_to_rect(boost::int32_t x1, boost::int32_t y1, boost::int32_t x2, boost::int32_t y2)
Definition: SWFRect.h:161
std::ostream & operator<<(std::ostream &o, const URL &u)
Definition: URL.cpp:448
Definition: GnashKey.h:166
void set_to_point(boost::int32_t x, boost::int32_t y)
Set ourself to bound the given point.
Definition: SWFRect.h:154
SWFRect()
Construct a NULL rectangle.
Definition: SWFRect.h:56
boost::int32_t x
Definition: BitmapData_as.cpp:434
Definition: GnashKey.h:148
#define DSOEXPORT
Definition: dsodefs.h:55
boost::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
static const boost::int32_t rectNull
Definition: SWFRect.h:49
boost::int32_t y
Definition: BitmapData_as.cpp:435
DSOEXPORT void expand_to_rect(const SWFRect &r)
Makes union of the given and the current SWFRect.
Definition: SWFRect.cpp:60
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: GnashKey.h:162
Definition: GnashKey.h:159
friend std::ostream & operator<<(std::ostream &os, const SWFRect &SWFRect)
Ouput operator.
Definition: SWFRect.h:262
SWFRect(int xmin, int ymin, int xmax, int ymax)
Construct a rectangle with given coordinates.
Definition: SWFRect.h:65