|
Packit |
bc1512 |
/* This file is part of GEGL
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* GEGL is free software; you can redistribute it and/or
|
|
Packit |
bc1512 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
bc1512 |
* License as published by the Free Software Foundation; either
|
|
Packit |
bc1512 |
* version 3 of the License, or (at your option) any later version.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* GEGL is distributed in the hope that it will be useful,
|
|
Packit |
bc1512 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
bc1512 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
bc1512 |
* Lesser General Public License for more details.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
bc1512 |
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Copyright 2006 Philip Lafleur
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#include "config.h"
|
|
Packit |
bc1512 |
#include <glib/gi18n-lib.h>
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#ifdef GEGL_CHANT_PROPERTIES
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
gegl_chant_double (degrees, -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
|
|
Packit |
bc1512 |
_("Angle to rotate (clockwise)"))
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#else
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#define GEGL_CHANT_NAME rotate
|
|
Packit |
bc1512 |
#define GEGL_CHANT_DESCRIPTION _("Rotate the buffer around the specified origin.")
|
|
Packit |
bc1512 |
#define GEGL_CHANT_SELF "rotate.c"
|
|
Packit |
bc1512 |
#include "chant.h"
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#include <math.h>
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
static void
|
|
Packit |
bc1512 |
create_matrix (OpTransform *op,
|
|
Packit |
bc1512 |
GeglMatrix3 *matrix)
|
|
Packit |
bc1512 |
{
|
|
Packit |
bc1512 |
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
|
|
Packit |
bc1512 |
gdouble radians = chant->degrees * (2 * G_PI / 360.0);
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
matrix->coeff [0][0] = matrix->coeff [1][1] = cos (radians);
|
|
Packit |
bc1512 |
matrix->coeff [0][1] = sin (radians);
|
|
Packit |
bc1512 |
matrix->coeff [1][0] = - matrix->coeff [0][1];
|
|
Packit |
bc1512 |
}
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#endif
|