1 /* Libart_LGPL - library of basic graphic primitives 2 * Copyright (C) 1998 Raph Levien 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 20 #ifndef __ART_AFFINE_H__ 21 #define __ART_AFFINE_H__ 22 23 #ifdef LIBART_COMPILATION 24 #include "art_point.h" 25 #else 26 #include <libart_lgpl/art_point.h> 27 #endif 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif /* __cplusplus */ 32 33 void 34 art_affine_point (ArtPoint *dst, const ArtPoint *src, 35 const double affine[6]); 36 37 void 38 art_affine_invert (double dst_affine[6], const double src_affine[6]); 39 40 /* flip the matrix, FALSE, FALSE is a simple copy operation, and 41 TRUE, TRUE equals a rotation by 180 degrees */ 42 void 43 art_affine_flip (double dst_affine[6], const double src_affine[6], 44 int horz, int vert); 45 46 void 47 art_affine_to_string (char str[128], const double src[6]); 48 49 void 50 art_affine_multiply (double dst[6], 51 const double src1[6], const double src2[6]); 52 53 /* set up the identity matrix */ 54 void 55 art_affine_identity (double dst[6]); 56 57 /* set up a scaling matrix */ 58 void 59 art_affine_scale (double dst[6], double sx, double sy); 60 61 /* set up a rotation matrix; theta is given in degrees */ 62 void 63 art_affine_rotate (double dst[6], double theta); 64 65 /* set up a shearing matrix; theta is given in degrees */ 66 void 67 art_affine_shear (double dst[6], double theta); 68 69 /* set up a translation matrix */ 70 void 71 art_affine_translate (double dst[6], double tx, double ty); 72 73 74 /* find the affine's "expansion factor", i.e. the scale amount */ 75 double 76 art_affine_expansion (const double src[6]); 77 78 /* Determine whether the affine transformation is rectilinear, 79 i.e. whether a rectangle aligned to the grid is transformed into 80 another rectangle aligned to the grid. */ 81 int 82 art_affine_rectilinear (const double src[6]); 83 84 /* Determine whether two affine transformations are equal within grid allignment */ 85 int 86 art_affine_equal (double matrix1[6], double matrix2[6]); 87 88 89 #ifdef __cplusplus 90 } 91 #endif /* __cplusplus */ 92 93 #endif /* __ART_AFFINE_H__ */ 94