1 /* Lasem
2  *
3  * Copyright © 2012 Emmanuel Pacaud
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author:
21  * 	Emmanuel Pacaud <emmanuel@gnome.org>
22  */
23 
24 #ifndef LSM_SVG_FILTER_SURFACE_H
25 #define LSM_SVG_FILTER_SURFACE_H
26 
27 #include <lsmtypes.h>
28 #include <lsmsvgtraits.h>
29 #include <cairo.h>
30 #include <gdk-pixbuf/gdk-pixbuf.h>
31 
32 G_BEGIN_DECLS
33 
34 typedef struct _LsmSvgFilterSurface LsmSvgFilterSurface;
35 
36 #define LSM_TYPE_FILTER_SURFACE (lsm_svg_filter_surface_get_type())
37 
38 GType lsm_svg_filter_surface_get_type (void);
39 
40 LsmSvgFilterSurface * 	lsm_svg_filter_surface_new 		(const char *name, unsigned int width, unsigned int height,
41 								 const LsmBox *subregion);
42 LsmSvgFilterSurface * 	lsm_svg_filter_surface_new_with_content	(const char *name, cairo_surface_t *surface, const LsmBox *subregion);
43 LsmSvgFilterSurface *	lsm_svg_filter_surface_new_similar	(const char *name, LsmSvgFilterSurface *model, const LsmBox *subregion);
44 
45 const char * 		lsm_svg_filter_surface_get_name 	(LsmSvgFilterSurface *surface);
46 cairo_surface_t *	lsm_svg_filter_surface_get_cairo_surface(LsmSvgFilterSurface *surface);
47 const LsmBox *		lsm_svg_filter_surface_get_subregion 	(LsmSvgFilterSurface *surface);
48 void 			lsm_svg_filter_surface_unref 		(LsmSvgFilterSurface *filter_surface);
49 LsmSvgFilterSurface *	lsm_svg_filter_surface_ref 		(LsmSvgFilterSurface *filter_surface);
50 
51 void 			lsm_svg_filter_surface_alpha 		(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output);
52 void 			lsm_svg_filter_surface_blend 		(LsmSvgFilterSurface *input_1,
53 								 LsmSvgFilterSurface *input_2,
54 								 LsmSvgFilterSurface *output,
55 								 int blending_mode);
56 void 			lsm_svg_filter_surface_blur 		(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output,
57 								 double sx, double sy);
58 void 			lsm_svg_filter_surface_flood 		(LsmSvgFilterSurface *surface,
59 								 double red, double green, double blue, double opacity);
60 void 			lsm_svg_filter_surface_offset 		(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output,
61 								 int dx, int dy);
62 void 			lsm_svg_filter_surface_merge 		(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output);
63 void 			lsm_svg_filter_surface_tile 		(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output);
64 void 			lsm_svg_filter_surface_color_matrix 	(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output,
65 								 LsmSvgColorFilterType type, unsigned n_values, const double *values);
66 void 			lsm_svg_filter_surface_convolve_matrix 	(LsmSvgFilterSurface *input, LsmSvgFilterSurface *output,
67 								 unsigned x_order, unsigned y_order,
68 								 unsigned n_values, const double *values,
69 								 double divisor, double bias, unsigned target_x, unsigned target_y,
70 								 LsmSvgEdgeMode edge_mode, gboolean preserve_alpha);
71 void			lsm_svg_filter_surface_displacement_map (LsmSvgFilterSurface *input_1,
72 								 LsmSvgFilterSurface *input_2,
73 								 LsmSvgFilterSurface *output,
74 								 double x_scale, double y_scale,
75 								 LsmSvgChannelSelector x_channel_selector,
76 								 LsmSvgChannelSelector y_channel_selector);
77 void			lsm_svg_filter_surface_image 		(LsmSvgFilterSurface *output, GdkPixbuf *pixbuf,
78 								 LsmSvgPreserveAspectRatio preserve_aspect_ratio);
79 void 			lsm_svg_filter_surface_morphology 	(LsmSvgFilterSurface *input_surface, LsmSvgFilterSurface *output_surface,
80 								 LsmSvgMorphologyOperator op, double rx, double ry);
81 void 			lsm_svg_filter_surface_specular_lighting(LsmSvgFilterSurface *output_surface,
82 								 double surface_scale, double specular_constant, double specular_exponent,
83 								 double dx, double dy);
84 void			lsm_svg_filter_surface_turbulence 	(LsmSvgFilterSurface *output_surface,
85 								 double base_frequency_x, double base_frequency_y,
86 								 int n_octaves, double seed,
87 								 LsmSvgStitchTiles stitch_tiles, LsmSvgTurbulenceType type,
88 								 const cairo_matrix_t *transform);
89 
90 G_END_DECLS
91 
92 #endif
93