Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Pango::Matrix Class Reference

A PangoMatrix C++ wrapper class. More...

`#include <xfc/pango/types.hh>`

Inheritance diagram for Xfc::Pango::Matrix:

List of all members.

## Public Member Functions

Constructors

- Matrix ()
    Creates a new Matrix initialized to the identity transform.
- Matrix (double xx, double xy, double yx, double yy, double x0=0.0, double y0=0.0)
    Creates a new Matrix initialized with the specified values.
- Matrix (PangoMatrix *matrix)
    Construct a new matrix from an existing PangoMatrix.
- Matrix (PangoMatrix *matrix, bool copy)
    Construct a new matrix from an existing PangoMatrix.
- Matrix (const Matrix &src)
    Copy constructor.
- ~Matrix ()
    Destructor.
- Matrix & operator= (const Matrix &src)
    Assignment operator.

Accessors

- PangoMatrix * pango_matrix () const
    Get a pointer to the PangoMatrix structure.
- operator PangoMatrix * () const
    Conversion operator; safely converts a Matrix to a PangoMatrix pointer.
- double xx () const
    Gets the first component of the transformation matrix.
- double xy () const
    Gets the second component of the transformation matrix.
- double yx () const
    Gets the third component of the transformation matrix.
- double yy () const
    Gets the fourth component of the transformation matrix.
- double x0 () const
    Gets the x translation.
- double y0 () const
    Gets the y translation.

Methods

- void set (double xx, double xy, double yx, double yy, double x0=0.0, double y0=0.0)
    Initializes the matrix with the specified values.
- void set_x0 (double x0)
    Sets the x translation.
- void set_y0 (double y0)
    Sets the y translation.
- void set_translation (double x0, double y0)
    Sets the x and y translation.
- void translate (double tx, double ty)
    Changes the transformation represented by matrix to be the transformation given by first translating by (tx, ty) then applying the original transformation.
- void scale (double scale_x, double scale_y)
    Changes the transformation represented by matrix to be the transformation given by first scaling by sx in the X direction and sy in the Y direction then applying the original transformation.
- void rotate (double degrees)
    Changes the transformation represented by matrix to be the transformation given by first rotating by degrees degrees counter-clokwise then applying the original transformation.
- void concat (const Matrix &new_matrix)
    Changes the transformation represented by matrix to be the transformation given by first applying transformation given by new_matrix then applying the original transformation.

## Detailed Description

A PangoMatrix C++ wrapper class.

Matrix specifies a transformation between user-space coordinates and device coordinates. The transformation is given by:

        x_device = x_user * matrix->xx() + y_user * matrix->xy() + matrix->x0();
        y_device = x_user * matrix->yx() + y_user * matrix->yy() + matrix->y0();

## Constructor & Destructor Documentation

Xfc::Pango::Matrix::Matrix | ( |  | ) |

Creates a new Matrix initialized to the identity transform.

                 Pango::Matrix matrix;
                 matrix.rotate(45.);

Xfc::Pango::Matrix::Matrix | ( | double | xx,
|  | double | xy,
|  | double | yx,
|  | double | yy,
|  | double | x0 = `0.0`,
|  | double | y0 = `0.0`
| ) |

Creates a new Matrix initialized with the specified values.

Parameters:

  | xx | The first component of the transformation matrix.
  | xy | The second component of the transformation matrix.
  | yx | The third component of the transformation matrix.
  | yy | The fourth component of the transformation matrix.
  | x0 | The x translation.
  | y0 | The y translation.

Xfc::Pango::Matrix::Matrix | ( | PangoMatrix * | matrix | ) | `[explicit]`

Construct a new matrix from an existing PangoMatrix.

Parameters:

  | matrix | A pointer to a PangoMatrix.

The matrix can be a newly created PangoMatrix or an existing PangoMatrix. The Matrix object created is a temporary object. It doesn't take over the ownership of PangoMatrix and PangoMatrix is not freed by the destructor. Matrix is created with a reference count of 1 that the caller owns.

Xfc::Pango::Matrix::Matrix | ( | PangoMatrix * | matrix,
|  | bool | copy
| ) |

Construct a new matrix from an existing PangoMatrix.

Parameters:

  | matrix | A pointer to a PangoMatrix.
  | copy | Whether the Matrix object should make a copy of PangoMatrix or not.

The matrix can be a newly created PangoMatrix or an existing PangoMatrix. If copy is true Matrix will make a copy of PangoMatrix. If copy is false Matrix wont make a copy but instead takes over the ownership of PangoMatrix. Either way, the destructor will free PangoMatrix when the Matrix object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoMatrix objects in a C++ wrapper. Matrix is created with a reference count of 1 that the caller owns.

Xfc::Pango::Matrix::Matrix | ( | const Matrix & | src | ) |

Copy constructor.

Parameters:

  | src | The source matrix.

## Member Function Documentation

void Xfc::Pango::Matrix::concat | ( | const Matrix & | new_matrix | ) |

Changes the transformation represented by matrix to be the transformation given by first applying transformation given by new_matrix then applying the original transformation.

Parameters:

  | new_matrix | A Pango::Matrix.

Matrix& Xfc::Pango::Matrix::operator= | ( | const Matrix & | src | ) |

Assignment operator.

Parameters:

  | src | The source matrix.

void Xfc::Pango::Matrix::rotate | ( | double | degrees | ) |

Changes the transformation represented by matrix to be the transformation given by first rotating by degrees degrees counter-clokwise then applying the original transformation.

Parameters:

  | degrees | The degrees to rotate counter-clockwise.

void Xfc::Pango::Matrix::scale | ( | double | scale_x,
|  | double | scale_y
| ) |

Changes the transformation represented by matrix to be the transformation given by first scaling by sx in the X direction and sy in the Y direction then applying the original transformation.

Parameters:

  | scale_x | The amount to scale by in X direction.
  | scale_y | The amount to scale by in Y direction.

void Xfc::Pango::Matrix::set | ( | double | xx,
|  | double | xy,
|  | double | yx,
|  | double | yy,
|  | double | x0 = `0.0`,
|  | double | y0 = `0.0`
| ) |

Initializes the matrix with the specified values.

Parameters:

  | xx | The first component of the transformation matrix.
  | xy | The second component of the transformation matrix.
  | yx | The third component of the transformation matrix.
  | yy | The fourth component of the transformation matrix.
  | x0 | The x translation.
  | y0 | The y translation.

void Xfc::Pango::Matrix::set_translation | ( | double | x0,
|  | double | y0
| ) |

Sets the x and y translation.

Parameters:

  | x0 | The x translation.
  | y0 | The y translation.

void Xfc::Pango::Matrix::set_x0 | ( | double | x0 | ) |

Sets the x translation.

Parameters:

  | x0 | The x translation.

void Xfc::Pango::Matrix::set_y0 | ( | double | y0 | ) |

Sets the y translation.

Parameters:

  | y0 | The y translation.

void Xfc::Pango::Matrix::translate | ( | double | tx,
|  | double | ty
| ) |

Changes the transformation represented by matrix to be the transformation given by first translating by (tx, ty) then applying the original transformation.

Parameters:

  | tx | The amount to translate in the X direction.
  | ty | The amount to translate in the Y direction.

double Xfc::Pango::Matrix::x0 | ( |  | ) | const

Gets the x translation.

Returns:
  The x translation.

double Xfc::Pango::Matrix::xx | ( |  | ) | const

Gets the first component of the transformation matrix.

Returns:
  The first component.

double Xfc::Pango::Matrix::xy | ( |  | ) | const

Gets the second component of the transformation matrix.

Returns:
  The second component.

double Xfc::Pango::Matrix::y0 | ( |  | ) | const

Gets the y translation.

Returns:
  The y translation.

double Xfc::Pango::Matrix::yx | ( |  | ) | const

Gets the third component of the transformation matrix.

Returns:
  The third component.

double Xfc::Pango::Matrix::yy | ( |  | ) | const

Gets the fourth component of the transformation matrix.

Returns:
  The fourth component.

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

- pango/types.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3