papyrus logo

Papyrus::Viewbox Class Reference

The Viewbox is based conceptually on the SVG viewBox attribute. More...

#include <viewbox.h>

Inheritance diagram for Papyrus::Viewbox:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ALIGN {
  ALIGN_NONE, ALIGN_XMIN_YMIN, ALIGN_XMID_YMIN, ALIGN_XMAX_YMIN,
  ALIGN_XMIN_YMID, ALIGN_XMID_YMID, ALIGN_XMAX_YMID, ALIGN_XMIN_YMAX,
  ALIGN_XMID_YMAX, ALIGN_XMAX_YMAX
}
enum  MEET_OR_SLICE { MEET, SLICE }
typedef enum
Papyrus::Viewbox::ALIGN 
ALIGN
typedef enum
Papyrus::Viewbox::MEET_OR_SLICE 
MEET_OR_SLICE
typedef PapyrusPointer< Viewboxpointer

Public Member Functions

 Viewbox (double x=0.0, double y=0.0, double w=0.0, double h=0.0, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice=MEET)
 Viewbox (const Region &region, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice=MEET)
virtual ~Viewbox ()
Viewboxoperator= (const Region &other)
Viewboxoperator= (const Viewbox &other)
bool operator== (const Region &other)
bool operator== (const Viewbox &other)
void set_preserve_aspect_ratio (ALIGN align, MEET_OR_SLICE meet_or_slice=MEET)
ALIGN alignment () const
MEET_OR_SLICE meet_or_slice () const
Matrix transformation_matrix (const Region &box) const
 Returns the transformation matrix that will fit.

Static Public Member Functions

static pointer create (double x=0.0, double y=0.0, double w=0.0, double h=0.0, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice=MEET)
static pointer create (const Region &region, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice=MEET)

Protected Attributes

ALIGN m_align
MEET_OR_SLICE m_meet_or_slice

Detailed Description

The Viewbox is based conceptually on the SVG viewBox attribute.

This class also incorporates the SVG preserveAspectRatio attribute.

Combined, these attributes allow a Papyrus::Drawable to be confined to a specific bounded area. The aspect ratio setting control how the Papyrus::Drawable will be adapted to fit inside the specified area.

The meaning of the ALIGN and MEET_OR_SLICE aspects is identical to the same concepts in the SVG specification.

The MEET_OR_SLICE slice setting controls whether the shape is scaled to fit entirely inside the Viewbox (MEET), or whether the shape is scaled to precisely fit one dimension (x or y) and sliced to fit the other dimension (SLICE).

The ALIGN setting controls where inside the Viewbox the Papyrus::Drawable is placed. The XMIN* settings will align the Drawable with the left X boundary, XMID* will align the Drawable in the center of the Viewbox, and XMAX* will align the Drawable on the right X boundary. Similarly the YMIN*, YMID* and YMAX* aspects will align the Drawable in the Y dimension.

Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>

Member Typedef Documentation

typedef PapyrusPointer<Viewbox> Papyrus::Viewbox::pointer

Member Enumeration Documentation

Enumerator:
ALIGN_NONE 
ALIGN_XMIN_YMIN 
ALIGN_XMID_YMIN 
ALIGN_XMAX_YMIN 
ALIGN_XMIN_YMID 
ALIGN_XMID_YMID 
ALIGN_XMAX_YMID 
ALIGN_XMIN_YMAX 
ALIGN_XMID_YMAX 
ALIGN_XMAX_YMAX 
Enumerator:
MEET 
SLICE 

Constructor & Destructor Documentation

Papyrus::Viewbox::Viewbox ( double  x = 0.0,
double  y = 0.0,
double  w = 0.0,
double  h = 0.0,
ALIGN  align = ALIGN_NONE,
MEET_OR_SLICE  meet_or_slice = MEET 
)

Referenced by create().

Papyrus::Viewbox::Viewbox ( const Region region,
ALIGN  align = ALIGN_NONE,
MEET_OR_SLICE  meet_or_slice = MEET 
)
Papyrus::Viewbox::~Viewbox (  )  [virtual]

Member Function Documentation

Viewbox::ALIGN Papyrus::Viewbox::alignment (  )  const

References m_align.

Viewbox::pointer Papyrus::Viewbox::create ( const Region region,
ALIGN  align = ALIGN_NONE,
MEET_OR_SLICE  meet_or_slice = MEET 
) [static]

References Viewbox().

Viewbox::pointer Papyrus::Viewbox::create ( double  x = 0.0,
double  y = 0.0,
double  w = 0.0,
double  h = 0.0,
ALIGN  align = ALIGN_NONE,
MEET_OR_SLICE  meet_or_slice = MEET 
) [static]

References Viewbox().

Referenced by Papyrus::Drawable::set_viewbox().

Viewbox::MEET_OR_SLICE Papyrus::Viewbox::meet_or_slice (  )  const

References m_meet_or_slice.

Viewbox & Papyrus::Viewbox::operator= ( const Viewbox other  ) 

Reimplemented from Papyrus::Region.

References m_align, m_meet_or_slice, and operator=().

Viewbox & Papyrus::Viewbox::operator= ( const Region other  ) 

Referenced by operator=().

bool Papyrus::Viewbox::operator== ( const Viewbox other  ) 
bool Papyrus::Viewbox::operator== ( const Region other  ) 

Referenced by operator==().

void Papyrus::Viewbox::set_preserve_aspect_ratio ( ALIGN  align,
MEET_OR_SLICE  meet_or_slice = MEET 
)
Matrix Papyrus::Viewbox::transformation_matrix ( const Region box  )  const

Member Data Documentation


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

Generated on Fri Apr 16 12:41:10 2010 for papyrus by doxygen 1.6.1