The Viewbox is based conceptually on the SVG viewBox attribute. More...
#include <viewbox.h>
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< Viewbox > | pointer |
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 ®ion, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice=MEET) | |
virtual | ~Viewbox () |
Viewbox & | operator= (const Region &other) |
Viewbox & | operator= (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 ®ion, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice=MEET) |
Protected Attributes | |
ALIGN | m_align |
MEET_OR_SLICE | m_meet_or_slice |
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.
typedef enum Papyrus::Viewbox::ALIGN Papyrus::Viewbox::ALIGN |
typedef PapyrusPointer<Viewbox> Papyrus::Viewbox::pointer |
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] |
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.
Reimplemented from Papyrus::Region.
References m_align, m_meet_or_slice, and operator=().
Referenced by operator=().
bool Papyrus::Viewbox::operator== | ( | const Viewbox & | other | ) |
References m_align, m_meet_or_slice, and operator==().
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 | |||
) |
References m_align, m_meet_or_slice, and Papyrus::Region::m_signal_changed.
Returns the transformation matrix that will fit.
box | to this viewbox |
References ALIGN_NONE, ALIGN_XMAX_YMAX, ALIGN_XMAX_YMID, ALIGN_XMAX_YMIN, ALIGN_XMID_YMAX, ALIGN_XMID_YMID, ALIGN_XMID_YMIN, ALIGN_XMIN_YMAX, ALIGN_XMIN_YMID, Papyrus::Region::height(), m_align, Papyrus::Region::m_h, m_meet_or_slice, Papyrus::Region::m_w, Papyrus::Region::m_x, Papyrus::Region::m_y, MEET, Papyrus::Matrix::scale(), SLICE, Papyrus::Matrix::translate(), Papyrus::Region::width(), Papyrus::Region::x(), Papyrus::Region::xywh(), and Papyrus::Region::y().
ALIGN Papyrus::Viewbox::m_align [protected] |
Referenced by alignment(), operator=(), operator==(), set_preserve_aspect_ratio(), and transformation_matrix().
MEET_OR_SLICE Papyrus::Viewbox::m_meet_or_slice [protected] |
Referenced by meet_or_slice(), operator=(), operator==(), set_preserve_aspect_ratio(), and transformation_matrix().