Rectangle class, see swf defined rectangle record. More...
#include <SWFRect.h>
Public Member Functions | |
void | read (SWFStream &in) |
Read a bit-packed rectangle from an SWF stream. | |
SWFRect () | |
Construct a NULL rectangle. | |
SWFRect (int xmin, int ymin, int xmax, int ymax) | |
Construct a rectangle with given coordinates. | |
bool | is_null () const |
returns true if this is a NULL rectangle | |
void | set_null () |
set the rectangle to the NULL value | |
bool | is_world () const |
TODO: deprecate this 'world' concept. | |
void | set_world () |
set the rectangle to the WORLD value | |
boost::int32_t | width () const |
Return width of this rectangle in TWIPS. | |
boost::int32_t | height () const |
Return height of this rectangle in TWIPS. | |
boost::int32_t | get_x_min () const |
Get the x coordinate of the left-up corner. | |
boost::int32_t | get_x_max () const |
Get the x coordinate of the right-down corner. | |
boost::int32_t | get_y_min () const |
Get the y coordinate of the left-up corner. | |
boost::int32_t | get_y_max () const |
Get the y coordinate of the right-down corner. | |
bool | point_test (boost::int32_t x, boost::int32_t y) const |
Return true if the given point is inside this SWFRect. | |
void | set_to_point (boost::int32_t x, boost::int32_t y) |
Set ourself to bound the given point. | |
void | set_to_rect (boost::int32_t x1, boost::int32_t y1, boost::int32_t x2, boost::int32_t y2) |
void | expand_to_point (boost::int32_t x, boost::int32_t y) |
Expand this rectangle to enclose the given point. | |
void | enclose_transformed_rect (const SWFMatrix &m, const SWFRect &r) |
void | expand_to_circle (boost::int32_t x, boost::int32_t y, boost::int32_t radius) |
Expand this rectangle to enclose the given circle. | |
DSOEXPORT void | expand_to_transformed_rect (const SWFMatrix &m, const SWFRect &r) |
DSOEXPORT void | expand_to_rect (const SWFRect &r) |
Makes union of the given and the current SWFRect. | |
void | set_lerp (const SWFRect &a, const SWFRect &b, float t) |
void | clamp (geometry::Point2d &p) const |
Make sure that the given point falls in this rectangle, modifying it's coordinates if needed. | |
geometry::Range2d< boost::int32_t > | getRange () const |
Construct and return a Range2d object. | |
std::string | toString () const |
Return a string representation for this rectangle. | |
Static Public Attributes | |
static const boost::int32_t | rectNull = 0x80000000 |
static const boost::int32_t | rectMax = 0x7fffffff |
Friends | |
std::ostream & | operator<< (std::ostream &os, const SWFRect &SWFRect) |
Ouput operator. |
Rectangle class, see swf defined rectangle record.
gnash::SWFRect::SWFRect | ( | ) | [inline] |
Construct a NULL rectangle.
gnash::SWFRect::SWFRect | ( | int | xmin, | |
int | ymin, | |||
int | xmax, | |||
int | ymax | |||
) | [inline] |
Construct a rectangle with given coordinates.
void gnash::SWFRect::clamp | ( | geometry::Point2d & | p | ) | const |
Make sure that the given point falls in this rectangle, modifying it's coordinates if needed.
References is_null(), gnash::geometry::Point2d::x, and gnash::geometry::Point2d::y.
Set ourself to bound a rectangle that has been transformed by m. This is an axial bound of an oriented (and/or sheared, scaled, etc) box.
References get_x_max(), get_x_min(), get_y_max(), get_y_min(), set_to_point(), gnash::SWFMatrix::transform(), gnash::geometry::Point2d::x, and gnash::geometry::Point2d::y.
void gnash::SWFRect::expand_to_circle | ( | boost::int32_t | x, | |
boost::int32_t | y, | |||
boost::int32_t | radius | |||
) | [inline] |
Expand this rectangle to enclose the given circle.
References is_null().
Referenced by gnash::DynamicShape::curveTo(), gnash::Path::expandBounds(), and gnash::DynamicShape::lineTo().
void gnash::SWFRect::expand_to_point | ( | boost::int32_t | x, | |
boost::int32_t | y | |||
) | [inline] |
Expand this rectangle to enclose the given point.
References is_null(), and set_to_point().
Referenced by gnash::Path::expandBounds(), and gnash::SWFMatrix::transform().
void gnash::SWFRect::expand_to_rect | ( | const SWFRect & | r | ) |
Makes union of the given and the current SWFRect.
References get_x_max(), get_x_min(), get_y_max(), get_y_min(), and is_null().
Referenced by gnash::TextField::add_invalidated_bounds().
Same as enclose_transformed_rect but expanding the current SWFRect instead of replacing it.
References get_x_max(), get_x_min(), get_y_max(), get_y_min(), is_null(), set_to_point(), gnash::SWFMatrix::transform(), gnash::geometry::Point2d::x, and gnash::geometry::Point2d::y.
Referenced by gnash::DisplayObject::add_invalidated_bounds(), gnash::Button::getBounds(), and gnash::Video::setStream().
boost::int32_t gnash::SWFRect::get_x_max | ( | ) | const [inline] |
Get the x coordinate of the right-down corner.
References is_null().
Referenced by gnash::TextField::display(), enclose_transformed_rect(), expand_to_rect(), expand_to_transformed_rect(), gnash::operator<<(), set_lerp(), gnash::TextField::setHeight(), and gnash::SWFMatrix::transform().
boost::int32_t gnash::SWFRect::get_x_min | ( | ) | const [inline] |
Get the x coordinate of the left-up corner.
References is_null().
Referenced by gnash::TextField::display(), enclose_transformed_rect(), expand_to_rect(), expand_to_transformed_rect(), gnash::operator<<(), set_lerp(), gnash::TextField::setHeight(), gnash::TextField::setWidth(), and gnash::SWFMatrix::transform().
boost::int32_t gnash::SWFRect::get_y_max | ( | ) | const [inline] |
Get the y coordinate of the right-down corner.
References is_null().
Referenced by gnash::TextField::display(), enclose_transformed_rect(), expand_to_rect(), expand_to_transformed_rect(), gnash::operator<<(), set_lerp(), gnash::TextField::setWidth(), and gnash::SWFMatrix::transform().
boost::int32_t gnash::SWFRect::get_y_min | ( | ) | const [inline] |
Get the y coordinate of the left-up corner.
References is_null().
Referenced by gnash::TextField::display(), enclose_transformed_rect(), expand_to_rect(), expand_to_transformed_rect(), gnash::operator<<(), set_lerp(), gnash::TextField::setHeight(), gnash::TextField::setWidth(), and gnash::SWFMatrix::transform().
geometry::Range2d<boost::int32_t> gnash::SWFRect::getRange | ( | ) | const [inline] |
Construct and return a Range2d object.
References is_null(), and is_world().
Referenced by gnash::TextField::add_invalidated_bounds(), gnash::DisplayObject::add_invalidated_bounds(), gnash::Renderer::bounds_in_clipping_area(), gnash::DisplayObject::boundsInClippingArea(), and gnash::Video::setStream().
boost::int32_t gnash::SWFRect::height | ( | ) | const [inline] |
Return height of this rectangle in TWIPS.
Referenced by gnash::TextField::display(), gnash::SWFMovieDefinition::get_height_pixels(), gnash::DummyMovieDefinition::get_height_pixels(), gnash::BitmapMovieDefinition::get_height_pixels(), gnash::getHeight(), main(), and gnash::DisplayObject::setHeight().
bool gnash::SWFRect::is_null | ( | ) | const [inline] |
returns true if this is a NULL rectangle
References rectNull.
Referenced by clamp(), gnash::TextField::display(), expand_to_circle(), expand_to_point(), expand_to_rect(), expand_to_transformed_rect(), get_x_max(), get_x_min(), get_y_max(), get_y_min(), getRange(), gnash::operator<<(), point_test(), gnash::SWFMovieDefinition::readHeader(), set_lerp(), and gnash::SWFMatrix::transform().
bool gnash::SWFRect::is_world | ( | ) | const [inline] |
bool gnash::SWFRect::point_test | ( | boost::int32_t | x, | |
boost::int32_t | y | |||
) | const [inline] |
Return true if the given point is inside this SWFRect.
References is_null().
Referenced by gnash::DisplayObject::pointInBounds(), gnash::TextField::pointInShape(), and gnash::TextField::topmostMouseEntity().
void gnash::SWFRect::read | ( | SWFStream & | in | ) |
Read a bit-packed rectangle from an SWF stream.
Format of the bit-packed rectangle is:
bits | name | description ------+-------+------------------------- 5 | nbits | number of bits used in subsequent values nbits | xmin | minimum X value nbits | xmax | maximum X value nbits | ymin | minimum Y value nbits | ymax | maximum Y value
If max values are less then min values the SWF is malformed; in this case this method will raise an swf_error and set the rectangle to the NULL rectangle. See is_null().
References gnash::SWFStream::align(), gnash::SWFStream::ensureBits(), IF_VERBOSE_MALFORMED_SWF, gnash::SWFStream::read_sint(), gnash::SWFStream::read_uint(), and set_null().
Referenced by gnash::SWF::ShapeRecord::read(), and gnash::SWFMovieDefinition::readHeader().
References get_x_max(), get_x_min(), get_y_max(), get_y_min(), and is_null().
Referenced by gnash::SWF::ShapeRecord::setLerp().
void gnash::SWFRect::set_null | ( | ) | [inline] |
set the rectangle to the NULL value
References rectNull.
Referenced by gnash::SWF::ShapeRecord::clear(), read(), gnash::SWF::ShapeRecord::read(), and gnash::drag_state::reset().
void gnash::SWFRect::set_to_point | ( | boost::int32_t | x, | |
boost::int32_t | y | |||
) | [inline] |
Set ourself to bound the given point.
Referenced by enclose_transformed_rect(), expand_to_point(), expand_to_transformed_rect(), and gnash::SWFMatrix::transform().
void gnash::SWFRect::set_to_rect | ( | boost::int32_t | x1, | |
boost::int32_t | y1, | |||
boost::int32_t | x2, | |||
boost::int32_t | y2 | |||
) | [inline] |
Referenced by gnash::TextField::setHeight(), and gnash::TextField::setWidth().
void gnash::SWFRect::set_world | ( | ) | [inline] |
set the rectangle to the WORLD value
References rectMax.
Referenced by gnash::Gui::setInvalidatedRegions().
std::string gnash::SWFRect::toString | ( | ) | const |
Return a string representation for this rectangle.
Referenced by gnash::SWF::ShapeRecord::read().
boost::int32_t gnash::SWFRect::width | ( | ) | const [inline] |
Return width of this rectangle in TWIPS.
Referenced by gnash::SWFMovieDefinition::get_width_pixels(), gnash::DummyMovieDefinition::get_width_pixels(), gnash::BitmapMovieDefinition::get_width_pixels(), main(), and gnash::DisplayObject::setWidth().
std::ostream& operator<< | ( | std::ostream & | os, | |
const SWFRect & | SWFRect | |||
) | [friend] |
Ouput operator.
const boost::int32_t gnash::SWFRect::rectMax = 0x7fffffff [static] |
Referenced by is_world(), and set_world().
const boost::int32_t gnash::SWFRect::rectNull = 0x80000000 [static] |
Referenced by is_null(), and set_null().