papyrus logo

Papyrus::AffineController Class Reference

#include <affinecontroller.h>

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

List of all members.

Public Types

typedef PapyrusPointer
< AffineController
pointer

Public Member Functions

 ~AffineController ()
double get_translate_x ()
 X position.
double get_translate_y ()
 Y position.
void get_translate (double &tx, double &ty)
 (X,Y) position
void set_translate_x (double tx)
 Sets the X position.
void set_translate_y (double ty)
 Sets the Y position.
void set_translate (double tx, double ty)
 Sets position to (X,Y).
void translate (double x, double y)
void get_scale (double &sx, double &sy)
 convenience method to get scaling in x and y dimensions with a single function call
void set_scale_x (double scale_x)
 sets scaling in the x dimension and emits changed signal
void set_scale_y (double scale_y)
 sets scaling in the y dimension and emits changed signal
void set_scale (double scale_x, double scale_y)
 sets scaling in the x and y dimensions and emits changed signal
void set_scale (double s)
 sets scaling in the x and y dimensions and emits changed signal
void scale (double x, double y)
void scale (double s)
double get_rotation (DegRad unit=RADIANS)
 Get rotation r in the specified units.
void set_rotation (double r, DegRad unit=RADIANS)
 Rotate to r as the specified units.
void rotate (double r, DegRad unit=RADIANS)
 Rotate by r as the specified units.
void get_skew (double &skewx, double &skewy, DegRad unit=RADIANS)
 Get the x and y skewing angles.
void set_skew_x (double skewx, DegRad unit=RADIANS)
 Set the x skewing angle.
void set_skew_y (double skewy, DegRad unit=RADIANS)
 Set the y skewing angle.
void set_skew (double skewx, double skewy, DegRad unit=RADIANS)
 Set the x and y skewing angles.
void set_skew (double s, DegRad unit=RADIANS)
 Set the x and y skewing angles to a single value.
void skew (double x, double y, DegRad unit=RADIANS)
 Skew the x and y angles independently.
void skew (double s, DegRad unit=RADIANS)
 Skew the x and y angles uniformly.
double centroid_x ()
 Get centroid x position about which the Drawable is rotated.
void set_centroid_x (double centroid_x)
 Set the x value of the centroid about which the Drawable will be rotated.
double centroid_y ()
 Get centroid y position about which the Drawable is rotated.
void set_centroid_y (double centroid_y)
 Set the y value of the centroid about which the Drawable will be rotated.
void get_centroid (double &centroid_x, double &centroid_y)
 Get the (x,y) centroid about which the Drawable will be rotated.
void set_centroid (double centroid_x, double centroid_y)
 Set the (x,y) centroid about which the Drawable will be rotated.
Matrixmatrix ()
 Return the matrix of this controller.
const Matrixmatrix () const
 Return the matrix of this controller.
int matrix_level () const
void set_matrix_level (int level)
void reset_position ()
 Reset position to default values of xy = (0,0), scale = (1,1), rotation = 0, and shear xy = (0,0).
sigc::signal< void > signal_xy ()
 Signal emitted when the xy position is changed.
sigc::signal< void > signal_scale ()
 Signal emitted when the scale is changed.
sigc::signal< void > signal_rotation ()
 Signal emitted when the rotation value is changed.
sigc::signal< void > signal_skew ()
 Signal emitted when the skew is changed.
sigc::signal< void > signal_centroid ()
 Signal emitted when the centroid is changed.

Static Public Member Functions

static pointer create (const Glib::ustring &id, double tx=0.0, double ty=0.0, double sx=1.0, double sy=1.0, double r=0.0)
static pointer create (const Glib::ustring &id, DrawableSet::pointer drawables, double tx=0.0, double ty=0.0, double sx=1.0, double sy=1.0, double r=0.0)
static pointer create (double tx=0.0, double ty=0.0, double sx=1.0, double sy=1.0, double r=0.0)
static pointer create (DrawableSet::pointer drawables, double tx=0.0, double ty=0.0, double sx=1.0, double sy=1.0, double r=0.0)

Protected Member Functions

 AffineController (const Glib::ustring &id, DrawableSet::pointer drawables, double tx=0.0, double ty=0.0, double sx=1.0, double sy=1.0, double r=0.0)
 Constructor that sets initial transforms.
void recalculate_matrix ()
 Recalculates m_matrix if m_regenerate_matrix is true and sets m_regenerate_matrix to false; does nothing if m_regenerate_matrix is false.
virtual void on_drawable_added (Drawable::pointer d)
virtual void on_drawable_removed (Drawable::pointer d)

Protected Attributes

double m_tx
 x translation value
double m_ty
 y translation value
double m_sx
 x scaling value
double m_sy
 y scaling value
double m_r
 rotation value in radians
double m_skewx
 skew x angle in radians
double m_skewy
 skew y angle in radians
double m_centroid_x
 x centroid value
double m_centroid_y
 y centroid value
Matrix::pointer m_matrix
 The cairo matrix returned from matrix and used in rendering.
int m_matrix_level
sigc::signal< void > m_signal_xy
 Signal emitted when the xy position is changed.
sigc::signal< void > m_signal_scale
 Signal emitted when the scale is changed.
sigc::signal< void > m_signal_rotation
 Signal emitted when the rotation value is changed.
sigc::signal< void > m_signal_skew
 Signal emitted when the skew is changed.
sigc::signal< void > m_signal_centroid
 Signal emitted when the centroid is changed.

Detailed Description

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

Member Typedef Documentation


Constructor & Destructor Documentation

Papyrus::AffineController::AffineController ( const Glib::ustring &  id,
DrawableSet::pointer  drawables,
double  tx = 0.0,
double  ty = 0.0,
double  sx = 1.0,
double  sy = 1.0,
double  r = 0.0 
) [protected]

Constructor that sets initial transforms.

If no parameters are specified, initial values set translation to (0,0) with a (1,1) scale ratio and no rotation or shearing.

If either scale parameter < 0.0, the parameter will be reset to 1.0.

References create(), Papyrus::DrawableSet::m_drawables, m_matrix, m_sx, m_sy, on_drawable_added(), and recalculate_matrix().

Papyrus::AffineController::~AffineController (  ) 

Member Function Documentation

double Papyrus::AffineController::centroid_x (  ) 

Get centroid x position about which the Drawable is rotated.

References m_centroid_x.

double Papyrus::AffineController::centroid_y (  ) 

Get centroid y position about which the Drawable is rotated.

References m_centroid_y.

AffineController::pointer Papyrus::AffineController::create ( DrawableSet::pointer  drawables,
double  tx = 0.0,
double  ty = 0.0,
double  sx = 1.0,
double  sy = 1.0,
double  r = 0.0 
) [static]

References PAPYRUS_CREATE.

AffineController::pointer Papyrus::AffineController::create ( double  tx = 0.0,
double  ty = 0.0,
double  sx = 1.0,
double  sy = 1.0,
double  r = 0.0 
) [static]

References PAPYRUS_CREATE.

AffineController::pointer Papyrus::AffineController::create ( const Glib::ustring &  id,
DrawableSet::pointer  drawables,
double  tx = 0.0,
double  ty = 0.0,
double  sx = 1.0,
double  sy = 1.0,
double  r = 0.0 
) [static]

References PAPYRUS_CREATE.

AffineController::pointer Papyrus::AffineController::create ( const Glib::ustring &  id,
double  tx = 0.0,
double  ty = 0.0,
double  sx = 1.0,
double  sy = 1.0,
double  r = 0.0 
) [static]

References PAPYRUS_CREATE.

Referenced by AffineController().

void Papyrus::AffineController::get_centroid ( double &  centroid_x,
double &  centroid_y 
)

Get the (x,y) centroid about which the Drawable will be rotated.

References m_centroid_x, and m_centroid_y.

double Papyrus::AffineController::get_rotation ( DegRad  unit = RADIANS  ) 

Get rotation r in the specified units.

References Papyrus::DEGREES, and m_r.

void Papyrus::AffineController::get_scale ( double &  sx,
double &  sy 
)

convenience method to get scaling in x and y dimensions with a single function call

References m_sx, and m_sy.

void Papyrus::AffineController::get_skew ( double &  skewx,
double &  skewy,
DegRad  unit = RADIANS 
)

Get the x and y skewing angles.

References Papyrus::DEGREES, m_skewx, m_skewy, and Papyrus::RADIANS.

void Papyrus::AffineController::get_translate ( double &  tx,
double &  ty 
)

(X,Y) position

References m_tx, and m_ty.

double Papyrus::AffineController::get_translate_x (  ) 

X position.

References m_tx.

double Papyrus::AffineController::get_translate_y (  ) 

Y position.

References m_ty.

const Matrix & Papyrus::AffineController::matrix (  )  const

Return the matrix of this controller.

References m_matrix.

Matrix & Papyrus::AffineController::matrix (  ) 

Return the matrix of this controller.

References m_matrix.

int Papyrus::AffineController::matrix_level (  )  const

References m_matrix_level.

void Papyrus::AffineController::on_drawable_added ( Drawable::pointer  d  )  [protected, virtual]

Reimplemented from Papyrus::DrawableController.

References m_matrix, and m_matrix_level.

Referenced by AffineController().

void Papyrus::AffineController::on_drawable_removed ( Drawable::pointer  d  )  [protected, virtual]

Reimplemented from Papyrus::DrawableController.

References m_matrix.

void Papyrus::AffineController::recalculate_matrix (  )  [protected]
void Papyrus::AffineController::reset_position (  ) 

Reset position to default values of xy = (0,0), scale = (1,1), rotation = 0, and shear xy = (0,0).

References m_centroid_x, m_centroid_y, m_r, m_signal_centroid, m_signal_rotation, m_signal_scale, m_signal_skew, m_signal_xy, m_skewx, m_skewy, m_sx, m_sy, m_tx, m_ty, and recalculate_matrix().

void Papyrus::AffineController::rotate ( double  r,
DegRad  unit = RADIANS 
)

Rotate by r as the specified units.

If previous rotation was pr then new rotation is pr+r

References Papyrus::DEGREES, m_r, m_signal_rotation, and recalculate_matrix().

Referenced by Papyrus::Rotator::on_motion().

void Papyrus::AffineController::scale ( double  s  ) 
void Papyrus::AffineController::scale ( double  x,
double  y 
)
void Papyrus::AffineController::set_centroid ( double  centroid_x,
double  centroid_y 
)

Set the (x,y) centroid about which the Drawable will be rotated.

References m_centroid_x, m_centroid_y, m_signal_centroid, and recalculate_matrix().

void Papyrus::AffineController::set_centroid_x ( double  centroid_x  ) 

Set the x value of the centroid about which the Drawable will be rotated.

References m_centroid_x, m_signal_centroid, and recalculate_matrix().

void Papyrus::AffineController::set_centroid_y ( double  centroid_y  ) 

Set the y value of the centroid about which the Drawable will be rotated.

References m_centroid_y, m_signal_centroid, and recalculate_matrix().

void Papyrus::AffineController::set_matrix_level ( int  level  ) 
void Papyrus::AffineController::set_rotation ( double  r,
DegRad  unit = RADIANS 
)

Rotate to r as the specified units.

References Papyrus::DEGREES, m_r, m_signal_rotation, and recalculate_matrix().

void Papyrus::AffineController::set_scale ( double  s  ) 

sets scaling in the x and y dimensions and emits changed signal

Parameters:
s The amount to scale the x and y dimensions by; must be > 0.0 or no change will occur

References m_signal_scale, m_sx, m_sy, and recalculate_matrix().

void Papyrus::AffineController::set_scale ( double  scale_x,
double  scale_y 
)

sets scaling in the x and y dimensions and emits changed signal

Parameters:
scale_x The new x dimension scaling; must be > 0.0 or no change to x scaling will occur
scale_y The new y dimension scaling; must be > 0.0 or no change to y scaling will occur

References m_signal_scale, m_sx, m_sy, and recalculate_matrix().

void Papyrus::AffineController::set_scale_x ( double  scale_x  ) 

sets scaling in the x dimension and emits changed signal

Parameters:
scale_x The new x dimension scaling; must be > 0.0 or no change to x scaling will occur

References m_signal_scale, m_sx, and recalculate_matrix().

void Papyrus::AffineController::set_scale_y ( double  scale_y  ) 

sets scaling in the y dimension and emits changed signal

Parameters:
scale_y The new y dimension scaling; must be > 0.0 or no change to y scaling will occur

References m_signal_scale, m_sy, and recalculate_matrix().

void Papyrus::AffineController::set_skew ( double  s,
DegRad  unit = RADIANS 
)

Set the x and y skewing angles to a single value.

References Papyrus::DEGREES, m_signal_skew, m_skewx, m_skewy, Papyrus::RADIANS, and recalculate_matrix().

void Papyrus::AffineController::set_skew ( double  skewx,
double  skewy,
DegRad  unit = RADIANS 
)

Set the x and y skewing angles.

References Papyrus::DEGREES, m_signal_skew, m_skewx, m_skewy, Papyrus::RADIANS, and recalculate_matrix().

void Papyrus::AffineController::set_skew_x ( double  skewx,
DegRad  unit = RADIANS 
)

Set the x skewing angle.

References Papyrus::DEGREES, m_signal_skew, m_skewx, Papyrus::RADIANS, and recalculate_matrix().

void Papyrus::AffineController::set_skew_y ( double  skewy,
DegRad  unit = RADIANS 
)

Set the y skewing angle.

References Papyrus::DEGREES, m_signal_skew, m_skewy, Papyrus::RADIANS, and recalculate_matrix().

void Papyrus::AffineController::set_translate ( double  tx,
double  ty 
)

Sets position to (X,Y).

Absolute move to (tx,ty).

References m_signal_xy, m_tx, m_ty, and recalculate_matrix().

void Papyrus::AffineController::set_translate_x ( double  tx  ) 

Sets the X position.

If previous position was (px,py) new position is (tx,py).

References m_signal_xy, m_tx, and recalculate_matrix().

void Papyrus::AffineController::set_translate_y ( double  ty  ) 

Sets the Y position.

If previous position was (px,py) new position is (px,ty).

References m_signal_xy, m_ty, and recalculate_matrix().

sigc::signal< void > Papyrus::AffineController::signal_centroid (  ) 

Signal emitted when the centroid is changed.

References m_signal_centroid.

sigc::signal< void > Papyrus::AffineController::signal_rotation (  ) 

Signal emitted when the rotation value is changed.

References m_signal_rotation.

sigc::signal< void > Papyrus::AffineController::signal_scale (  ) 

Signal emitted when the scale is changed.

References m_signal_scale.

sigc::signal< void > Papyrus::AffineController::signal_skew (  ) 

Signal emitted when the skew is changed.

References m_signal_skew.

sigc::signal< void > Papyrus::AffineController::signal_xy (  ) 

Signal emitted when the xy position is changed.

References m_signal_xy.

void Papyrus::AffineController::skew ( double  s,
DegRad  unit = RADIANS 
)

Skew the x and y angles uniformly.

References Papyrus::DEGREES, m_signal_skew, m_skewx, m_skewy, Papyrus::RADIANS, and recalculate_matrix().

void Papyrus::AffineController::skew ( double  x,
double  y,
DegRad  unit = RADIANS 
)

Skew the x and y angles independently.

References Papyrus::DEGREES, m_signal_skew, m_skewx, m_skewy, Papyrus::RADIANS, and recalculate_matrix().

void Papyrus::AffineController::translate ( double  x,
double  y 
)

Member Data Documentation

The cairo matrix returned from matrix and used in rendering.

Referenced by AffineController(), matrix(), on_drawable_added(), on_drawable_removed(), recalculate_matrix(), and set_matrix_level().

double Papyrus::AffineController::m_r [protected]

rotation value in radians

Referenced by get_rotation(), recalculate_matrix(), reset_position(), rotate(), and set_rotation().

sigc::signal<void> Papyrus::AffineController::m_signal_centroid [protected]

Signal emitted when the centroid is changed.

Referenced by reset_position(), set_centroid(), set_centroid_x(), set_centroid_y(), and signal_centroid().

sigc::signal<void> Papyrus::AffineController::m_signal_rotation [protected]

Signal emitted when the rotation value is changed.

Referenced by reset_position(), rotate(), set_rotation(), and signal_rotation().

sigc::signal<void> Papyrus::AffineController::m_signal_scale [protected]

Signal emitted when the scale is changed.

Referenced by reset_position(), scale(), set_scale(), set_scale_x(), set_scale_y(), and signal_scale().

sigc::signal<void> Papyrus::AffineController::m_signal_skew [protected]

Signal emitted when the skew is changed.

Referenced by reset_position(), set_skew(), set_skew_x(), set_skew_y(), signal_skew(), and skew().

sigc::signal<void> Papyrus::AffineController::m_signal_xy [protected]

Signal emitted when the xy position is changed.

Referenced by reset_position(), set_translate(), set_translate_x(), set_translate_y(), signal_xy(), and translate().

skew x angle in radians

Referenced by get_skew(), recalculate_matrix(), reset_position(), set_skew(), set_skew_x(), and skew().

skew y angle in radians

Referenced by get_skew(), recalculate_matrix(), reset_position(), set_skew(), set_skew_y(), and skew().

double Papyrus::AffineController::m_sx [protected]
double Papyrus::AffineController::m_sy [protected]
double Papyrus::AffineController::m_tx [protected]
double Papyrus::AffineController::m_ty [protected]

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

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