gboolean gegl_matrix3_is_identity (GeglMatrix3 *matrix) { GeglMatrix3 identity; gegl_matrix3_identity (&identity); return gegl_matrix3_equal (&identity, matrix); }
static void gegl_affine_create_matrix (OpAffine *affine, GeglMatrix3 *matrix) { gegl_matrix3_identity (matrix); if (OP_AFFINE_GET_CLASS (affine)) OP_AFFINE_GET_CLASS (affine)->create_matrix (affine, matrix); }
void gegl_matrix3_parse_string (GeglMatrix3 *matrix, const gchar *string) { gegl_matrix3_identity (matrix); if (strstr (string, "translate")) { gchar *p = strchr (string, '('); gfloat a; gfloat b; if (!p) return; p++; a = strtod(p, &p); if (!p) return; p = strchr (string, ','); if (!p) return; p++; b = strtod (p, &p); if (!p) return; matrix->coeff [0][2] = a; matrix->coeff [1][2] = b; } else if (strstr (string, "matrix")) { gchar *p = strchr (string, '('); gfloat a; gint i,j; if (!p) return; p++; for (i=0;i<3;i++) for (j=0;j<3;j++) { a = strtod(p, &p); matrix->coeff [j][i] = a; if (!p) return; p = strchr (p, ','); if (!p) return; p++; } } }