mirror of https://github.com/GNOME/gimp.git
cosmetic changes.
2005-03-20 Sven Neumann <sven@gimp.org> * app/core/gimp-transform-utils.c (gimp_transform_matrix_perspective): cosmetic changes. * libgimpmath/gimpmatrix.[ch] * libgimpmath/gimpmath.def: added gimp_matrix_is_affine().
This commit is contained in:
parent
7cbe447c79
commit
a974e4ba79
|
@ -1,3 +1,11 @@
|
|||
2005-03-20 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimp-transform-utils.c (gimp_transform_matrix_perspective):
|
||||
cosmetic changes.
|
||||
|
||||
* libgimpmath/gimpmatrix.[ch]
|
||||
* libgimpmath/gimpmath.def: added gimp_matrix_is_affine().
|
||||
|
||||
2005-03-19 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpimage-sample-points.c
|
||||
|
|
|
@ -232,26 +232,12 @@ gimp_transform_matrix_perspective (gint x,
|
|||
matrix.coeff[1][2] = t_y1;
|
||||
matrix.coeff[2][0] = 0.0;
|
||||
matrix.coeff[2][1] = 0.0;
|
||||
matrix.coeff[2][2] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gdouble det1, det2;
|
||||
|
||||
det1 = dx3 * dy2 - dy3 * dx2;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
|
||||
if (det1 == 0.0 && det2 == 0.0)
|
||||
matrix.coeff[2][0] = 1.0;
|
||||
else
|
||||
matrix.coeff[2][0] = det1 / det2;
|
||||
|
||||
det1 = dx1 * dy3 - dy1 * dx3;
|
||||
|
||||
if (det1 == 0.0 && det2 == 0.0)
|
||||
matrix.coeff[2][1] = 1.0;
|
||||
else
|
||||
matrix.coeff[2][1] = det1 / det2;
|
||||
|
||||
matrix.coeff[0][0] = t_x2 - t_x1 + matrix.coeff[2][0] * t_x2;
|
||||
matrix.coeff[0][1] = t_x3 - t_x1 + matrix.coeff[2][1] * t_x3;
|
||||
matrix.coeff[0][2] = t_x1;
|
||||
|
@ -259,9 +245,18 @@ gimp_transform_matrix_perspective (gint x,
|
|||
matrix.coeff[1][0] = t_y2 - t_y1 + matrix.coeff[2][0] * t_y2;
|
||||
matrix.coeff[1][1] = t_y3 - t_y1 + matrix.coeff[2][1] * t_y3;
|
||||
matrix.coeff[1][2] = t_y1;
|
||||
}
|
||||
|
||||
matrix.coeff[2][2] = 1.0;
|
||||
det1 = dx3 * dy2 - dy3 * dx2;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
|
||||
matrix.coeff[2][0] = (det2 == 0.0) ? 1.0 : det1 / det2;
|
||||
|
||||
det1 = dx1 * dy3 - dy1 * dx3;
|
||||
|
||||
matrix.coeff[2][1] = (det2 == 0.0) ? 1.0 : det1 / det2;
|
||||
|
||||
matrix.coeff[2][2] = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_matrix3_identity (result);
|
||||
|
|
|
@ -35,8 +35,9 @@ gimp_matrix3_affine
|
|||
gimp_matrix3_transform_point
|
||||
gimp_matrix3_determinant
|
||||
gimp_matrix3_invert
|
||||
gimp_matrix3_is_diagonal
|
||||
gimp_matrix3_is_identity
|
||||
gimp_matrix3_is_diagonal
|
||||
gimp_matrix3_is_affine
|
||||
gimp_matrix3_is_simple
|
||||
gimp_matrix4_to_deg
|
||||
GIMP_TYPE_MATRIX2
|
||||
|
|
|
@ -169,6 +169,15 @@ A four by four matrix.
|
|||
@matrix:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_matrix3_is_identity ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@matrix:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_matrix3_is_diagonal ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -178,7 +187,7 @@ A four by four matrix.
|
|||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_matrix3_is_identity ##### -->
|
||||
<!-- ##### FUNCTION gimp_matrix3_is_affine ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
|
|
@ -6,6 +6,7 @@ EXPORTS
|
|||
gimp_matrix3_determinant
|
||||
gimp_matrix3_identity
|
||||
gimp_matrix3_invert
|
||||
gimp_matrix3_is_affine
|
||||
gimp_matrix3_is_diagonal
|
||||
gimp_matrix3_is_identity
|
||||
gimp_matrix3_is_simple
|
||||
|
|
|
@ -443,7 +443,6 @@ gimp_matrix3_yshear (GimpMatrix3 *matrix,
|
|||
matrix->coeff[1][2] += amount * matrix->coeff[0][2];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_matrix3_affine:
|
||||
* @matrix: The input matrix.
|
||||
|
@ -488,7 +487,6 @@ gimp_matrix3_affine (GimpMatrix3 *matrix,
|
|||
gimp_matrix3_mult (&affine, matrix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_matrix3_determinant:
|
||||
* @matrix: The input matrix.
|
||||
|
@ -567,39 +565,13 @@ gimp_matrix3_invert (GimpMatrix3 *matrix)
|
|||
|
||||
/* functions to test for matrix properties */
|
||||
|
||||
|
||||
/**
|
||||
* gimp_matrix3_is_diagonal:
|
||||
* @matrix: The matrix that is to be tested.
|
||||
*
|
||||
* Checks if the given matrix is diagonal.
|
||||
*
|
||||
* Returns: TRUE if the matrix is diagonal.
|
||||
*/
|
||||
gboolean
|
||||
gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (i != j && fabs (matrix->coeff[i][j]) > EPSILON)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_matrix3_is_identity:
|
||||
* @matrix: The matrix that is to be tested.
|
||||
*
|
||||
* Checks if the given matrix is the identity matrix.
|
||||
*
|
||||
* Returns: TRUE if the matrix is the identity matrix.
|
||||
* Returns: %TRUE if the matrix is the identity matrix, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gimp_matrix3_is_identity (const GimpMatrix3 *matrix)
|
||||
|
@ -626,11 +598,49 @@ gimp_matrix3_is_identity (const GimpMatrix3 *matrix)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Check if we'll need to interpolate when applying this matrix.
|
||||
This function returns TRUE if all entries of the upper left
|
||||
2x2 matrix are either 0 or 1
|
||||
/**
|
||||
* gimp_matrix3_is_diagonal:
|
||||
* @matrix: The matrix that is to be tested.
|
||||
*
|
||||
* Checks if the given matrix is diagonal.
|
||||
*
|
||||
* Returns: %TRUE if the matrix is diagonal, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (i != j && fabs (matrix->coeff[i][j]) > EPSILON)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_matrix3_is_affine:
|
||||
* @matrix: The matrix that is to be tested.
|
||||
*
|
||||
* Checks if the given matrix defines an affine transformation.
|
||||
*
|
||||
* Returns: %TRUE if the matrix defines an affine transformation,
|
||||
* %FALSE otherwise
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gboolean
|
||||
gimp_matrix3_is_affine (const GimpMatrix3 *matrix)
|
||||
{
|
||||
return (fabs (matrix->coeff[2][0]) < EPSILON &&
|
||||
fabs (matrix->coeff[2][1]) < EPSILON &&
|
||||
fabs (matrix->coeff[2][2] - 1.0) < EPSILON);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_matrix3_is_simple:
|
||||
|
@ -639,8 +649,8 @@ gimp_matrix3_is_identity (const GimpMatrix3 *matrix)
|
|||
* Checks if we'll need to interpolate when applying this matrix as
|
||||
* a transformation.
|
||||
*
|
||||
* Returns: TRUE if all entries of the upper left 2x2 matrix are either
|
||||
* 0 or 1
|
||||
* Returns: %TRUE if all entries of the upper left 2x2 matrix are
|
||||
* either 0 or 1, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gimp_matrix3_is_simple (const GimpMatrix3 *matrix)
|
||||
|
|
|
@ -90,8 +90,9 @@ void gimp_matrix3_affine (GimpMatrix3 *matrix,
|
|||
gdouble gimp_matrix3_determinant (const GimpMatrix3 *matrix);
|
||||
void gimp_matrix3_invert (GimpMatrix3 *matrix);
|
||||
|
||||
gboolean gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix);
|
||||
gboolean gimp_matrix3_is_identity (const GimpMatrix3 *matrix);
|
||||
gboolean gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix);
|
||||
gboolean gimp_matrix3_is_affine (const GimpMatrix3 *matrix);
|
||||
gboolean gimp_matrix3_is_simple (const GimpMatrix3 *matrix);
|
||||
|
||||
void gimp_matrix3_transform_point (const GimpMatrix3 *matrix,
|
||||
|
|
Loading…
Reference in New Issue