Public Member Functions | Static Public Attributes | Friends

gnash::SWFRect Class Reference

Rectangle class, see swf defined rectangle record. More...

#include <SWFRect.h>

List of all members.

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.

Detailed Description

Rectangle class, see swf defined rectangle record.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

void gnash::SWFRect::enclose_transformed_rect ( const SWFMatrix m,
const SWFRect r 
)

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().

void gnash::SWFRect::expand_to_transformed_rect ( const SWFMatrix m,
const SWFRect r 
)
boost::int32_t gnash::SWFRect::get_x_max (  )  const [inline]
boost::int32_t gnash::SWFRect::get_x_min (  )  const [inline]
boost::int32_t gnash::SWFRect::get_y_max (  )  const [inline]
boost::int32_t gnash::SWFRect::get_y_min (  )  const [inline]
geometry::Range2d<boost::int32_t> gnash::SWFRect::getRange (  )  const [inline]
boost::int32_t gnash::SWFRect::height (  )  const [inline]
bool gnash::SWFRect::is_null (  )  const [inline]
bool gnash::SWFRect::is_world (  )  const [inline]

TODO: deprecate this 'world' concept.

References rectMax.

Referenced by getRange().

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().

void gnash::SWFRect::set_lerp ( const SWFRect a,
const SWFRect b,
float  t 
)
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]
void gnash::SWFRect::set_to_rect ( boost::int32_t  x1,
boost::int32_t  y1,
boost::int32_t  x2,
boost::int32_t  y2 
) [inline]
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]

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SWFRect SWFRect 
) [friend]

Ouput operator.


Member Data Documentation

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().


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