sswf::SRectangle Class Reference

The SWF rectangle. More...

#include <libsswf.h>

List of all members.

Public Member Functions

bool IsEmpty (void) const
 Check whether a rectangle is empty.
void Reset (void)
 Resets the rectangle to all zeroes.
void Save (Data &data) const
 Save a rectangle in a data buffer.
void Set (long xmin, long xmax, long ymin, long ymax)
 Sets the coordinates of the rectangle.
void SetReorder (long xmin, long xmax, long ymin, long ymax)
 Set the coordinates of the rectangle ordering them as required.
 SRectangle (void)
 Initialize the rectangle to all zeroes.
long XMax (void) const
 Read the right side X coordinate.
long XMin (void) const
 Read the left side X coordinate.
long YMax (void) const
 Read the bottom side Y coordinate.
long YMin (void) const
 Read the top side Y coordinate.

Private Attributes

long f_xmax
long f_xmin
long f_ymax
long f_ymin


Detailed Description

The SWF format allows for compressed rectangles. These are saved with 5 bits representing the number of bits used for each coordinate followed by the coordinates.

The coordinates represent points. In other words, the rectangle is defined with two points (xmin, ymin) and (xmax, ymax).

If the rectangle is considered empty, the width and height are considered to be 0.

To compute the width, do XMax() - XMin().

To compute the height, do YMax() - YMin().

See also:
sswf::SRectangle::Reset(void)

sswf::SRectangle::Set(long xmin, long xmax, long ymin, long ymax)

sswf::SRectangle::SetReorder(long xmin, long xmax, long ymin, long ymax)

SWF Alexis' Reference—swf_rect


Constructor & Destructor Documentation

SRectangle::SRectangle ( void   ) 

By default a rectangle is an empty rectangle with all of its coordinates set to zero.

See also:
sswf::SRectangle::Reset(void)


Member Function Documentation

bool SRectangle::IsEmpty ( void   )  const

This function returns true if the rectangle is considered empty.

Some rectangles in SWF cannot be empty (especially the display screen!)

A rectangle is considered empty when xmin >= xmax or ymin >= ymax.

Returns:
true if the rectangle is empty
See also:
sswf::SRectangle::Reset(void)

void SRectangle::Reset ( void   ) 

This function resets the rectangle to all zeroes. In effect, the rectangle becomes the empty rectangle.

See also:
sswf::SRectangle::SRectangle(void)

void SRectangle::Save ( Data data  )  const

This function saves a rectangle in a data buffer as compressed as possible.

The function first determines the necessary number of bits to save all the coordinates, and then it saves them in the specified data buffer.

An empty rectangle is saved on 2 bytes.

Parameters:
[in] data The data buffer where the rectangle is saved.

void SRectangle::Set ( long  xmin,
long  xmax,
long  ymin,
long  ymax 
)

Sets the coordinates of the rectangle to the specified coordinates. If xmin >= xmax or ymin >= ymax then the rectangle is considered empty. You can also call the sswf::SRectangle::Reset() function to make the rectangle empty.

See also:
sswf::SRectangle::Reset(void)

sswf::SRectangle::SetReorder(long xmin, long xmax, long ymin, long ymax)

void SRectangle::SetReorder ( long  xmin,
long  xmax,
long  ymin,
long  ymax 
)

This function sets the coordinates of the rectangle. It will reorder the min/max is the right order. So if xmin > xmax, the horizontal coordinates are swapped. And if ymin > ymax, the vertical coodinates are swapped.

To create an empty rectangle, you need to set xmin equal to xmax or ymin equal to ymax or call the sswf::SRectangle::Reset() function.

See also:
sswf::SRectangle::Reset(void)

sswf::SRectangle::Set(long xmin, long xmax, long ymin, long ymax)

long SRectangle::XMax ( void   )  const

This function returns the maximum X coordinate.

Returns:
The xmax coordinate
See also:
sswf::SRectangle::XMin(void) const

long SRectangle::XMin ( void   )  const

This function returns the minimum X coordinate.

Returns:
The xmin coordinate
See also:
sswf::SRectangle::XMax(void) const

long SRectangle::YMax ( void   )  const

This function returns the maximum Y coordinate.

Returns:
The ymax coordinate
See also:
sswf::SRectangle::YMin(void) const

long SRectangle::YMin ( void   )  const

This function returns the minimum Y coordinate.

Returns:
The ymin coordinate
See also:
sswf::SRectangle::YMax(void) const


Member Data Documentation

long sswf::SRectangle::f_xmax [private]

long sswf::SRectangle::f_xmin [private]

long sswf::SRectangle::f_ymax [private]

long sswf::SRectangle::f_ymin [private]


The documentation for this class was generated from the following files:
Generated on Sun May 13 23:29:40 2007 for libsswf by  doxygen 1.4.7