Rename GP_Context -> GP_Pixmap
[gfxprim.git] / include / filters / GP_Rotate.h
blob8d315e9bcd54a8320fc7c0719f40c741f9fd18d7
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim 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 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2013 Cyril Hrubis <metan@ucw.cz> *
20 * *
21 *****************************************************************************/
25 GP_Pixmap rotations and mirroring.
29 #ifndef FILTERS_GP_ROTATE_H
30 #define FILTERS_GP_ROTATE_H
32 #include "core/GP_Pixmap.h"
33 #include "GP_Filter.h"
36 * Mirrors bitmap horizontally.
38 * The dst must be at least as big as source.
40 * The filter works 'in-place' which means that src and dst
41 * may be very same pixmap. Note that when aborting in-place operation
42 * the image buffer gets into an inconsistent state.
44 * Returns zero on success, non-zero if operation was aborted.
46 int GP_FilterMirrorH(const GP_Pixmap *src, GP_Pixmap *dst,
47 GP_ProgressCallback *callback);
50 * Mirrors bitmap horizontally.
52 * Returns pointer to newly allocated pixmap, or NULL if malloc() has failed
53 * or operation was aborted from withing a callback.
55 GP_Pixmap *GP_FilterMirrorHAlloc(const GP_Pixmap *src,
56 GP_ProgressCallback *callback);
59 * Mirrors bitmap vertically.
61 * The dst must be at least as big as source.
63 * The filter works 'in-place' which means that src and dst
64 * may be very same pixmap. Note that when aborting in-place operation
65 * the image buffer gets into an inconsistent state.
67 * Returns zero on success, non-zero if operation was aborted.
69 int GP_FilterMirrorV(const GP_Pixmap *src, GP_Pixmap *dst,
70 GP_ProgressCallback *callback);
73 * Mirrors bitmap vertically.
75 * Returns pointer to newly allocated pixmap, or NULL if malloc() has failed
76 * or operation was aborted from withing a callback.
78 GP_Pixmap *GP_FilterMirrorVAlloc(const GP_Pixmap *src,
79 GP_ProgressCallback *callback);
82 * Rotate the pixmap by 90, 180, 270.
84 * Returns pointer to destination bitmap or NULL if allocation failed.
86 int GP_FilterRotate90(const GP_Pixmap *src, GP_Pixmap *dst,
87 GP_ProgressCallback *callback);
89 GP_Pixmap *GP_FilterRotate90Alloc(const GP_Pixmap *src,
90 GP_ProgressCallback *callback);
92 int GP_FilterRotate180(const GP_Pixmap *src, GP_Pixmap *dst,
93 GP_ProgressCallback *callback);
95 GP_Pixmap *GP_FilterRotate180Alloc(const GP_Pixmap *src,
96 GP_ProgressCallback *callback);
98 int GP_FilterRotate270(const GP_Pixmap *src, GP_Pixmap *dst,
99 GP_ProgressCallback *callback);
101 GP_Pixmap *GP_FilterRotate270Alloc(const GP_Pixmap *src,
102 GP_ProgressCallback *callback);
105 * Calls a symmetry filter on bitmap.
107 * If dst is NULL, new bitmap is allocated.
109 * Returns pointer to destination bitmap or NULL if allocation failed.
111 typedef enum GP_FilterSymmetries {
112 GP_ROTATE_90 = 0,
113 GP_ROTATE_CW = GP_ROTATE_90,
114 GP_ROTATE_180,
115 GP_ROTATE_270,
116 GP_ROTATE_CCW = GP_ROTATE_270,
117 GP_MIRROR_H,
118 GP_MIRROR_V,
119 } GP_FilterSymmetries;
122 * NULL-terminated array of symmetry names (C strings).
124 extern const char **GP_FilterSymmetryNames;
127 * Symmetry by name (as defined in GP_FilerSymmetryNames).
129 * Returns either one of the GP_FilterSymmetries enums or -1 in case of
130 * failure.
132 int GP_FilterSymmetryByName(const char *symmetry);
134 int GP_FilterSymmetry(const GP_Pixmap *src, GP_Pixmap *dst,
135 GP_FilterSymmetries symmetry,
136 GP_ProgressCallback *callback);
138 GP_Pixmap *GP_FilterSymmetryAlloc(const GP_Pixmap *src,
139 GP_FilterSymmetries symmetry,
140 GP_ProgressCallback *callback);
142 #endif /* FILTERS_GP_ROTATE_H */