示例#1
0
/**
 * graphene_matrix_to_2d:
 * @m: a #graphene_matrix_t
 * @xx: (out): return location for the xx member
 * @yx: (out): return location for the yx member
 * @xy: (out): return location for the xy member
 * @yy: (out): return location for the yy member
 * @x_0: (out): return location for the x0 member
 * @y_0: (out): return location for the y0 member
 *
 * Converts a #graphene_matrix_t to an affine transformation
 * matrix, if the given matrix is compatible.
 *
 * The returned values have the following layout:
 *
 * |[
 *   | xx yx |   |  a  b  0 |
 *   | xy yy | = |  c  d  0 |
 *   | x0 y0 |   | tx ty  1 |
 * ]|
 *
 * This function can be used to convert between a #graphene_matrix_t
 * and a matrix type from other libraries.
 *
 * Returns: %true if the matrix is compatible with an affine
 *   transformation matrix
 *
 * Since: 1.0
 */
bool
graphene_matrix_to_2d (const graphene_matrix_t *m,
                       double                  *xx,
                       double                  *yx,
                       double                  *xy,
                       double                  *yy,
                       double                  *x_0,
                       double                  *y_0)
{
  if (!graphene_simd4x4f_is_2d (&m->value))
    return false;

  if (xx != NULL)
    *xx = graphene_matrix_get_value (m, 0, 0);
  if (yx != NULL)
    *yx = graphene_matrix_get_value (m, 0, 1);
  if (xy != NULL)
    *xy = graphene_matrix_get_value (m, 1, 0);
  if (yy != NULL)
    *yy = graphene_matrix_get_value (m, 1, 1);
  if (x_0 != NULL)
    *x_0 = graphene_matrix_get_value (m, 3, 0);
  if (y_0 != NULL)
    *y_0 = graphene_matrix_get_value (m, 3, 1);

  return true;
}
示例#2
0
gboolean
graphene_matrix_is_2d (const graphene_matrix_t *m)
{
  g_return_val_if_fail (m != NULL, FALSE);

  return graphene_simd4x4f_is_2d (&m->value);
}
示例#3
0
/**
 * graphene_matrix_is_2d:
 * @m: a #graphene_matrix_t
 *
 * Checks whether the given #graphene_matrix_t is compatible with an
 * a 2D affine transformation matrix.
 *
 * Returns: %true if the matrix is compatible with an affine
 *   transformation matrix
 *
 * Since: 1.0
 */
bool
graphene_matrix_is_2d (const graphene_matrix_t *m)
{
  return graphene_simd4x4f_is_2d (&m->value);
}