1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* IfsCompose is a interface for creating IFS fractals by
* direct manipulation.
* Copyright (C) 1997 Owen Taylor
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
typedef struct {
gdouble a11,a12,a21,a22,b1,b2;
} Aff2;
typedef struct {
gdouble vals[3][4];
} Aff3;
typedef struct {
GdkPoint *points;
gint npoints;
} IPolygon;
typedef struct {
gdouble x, y;
gdouble theta;
gdouble scale;
gdouble asym;
gdouble shear;
gint flip;
GimpRGB red_color;
GimpRGB green_color;
GimpRGB blue_color;
GimpRGB black_color;
GimpRGB target_color;
gdouble hue_scale;
gdouble value_scale;
gint simple_color;
gdouble prob;
} AffElementVals;
typedef struct
{
gint num_elements;
gint iterations;
gint max_memory;
gint subdivide;
gdouble radius;
gdouble aspect_ratio;
gdouble center_x;
gdouble center_y;
} IfsComposeVals;
typedef struct {
AffElementVals v;
Aff2 trans;
Aff3 color_trans;
gchar *name;
IPolygon *click_boundary;
IPolygon *draw_boundary;
} AffElement;
/* manipulation of affine transforms */
void aff2_translate (Aff2 *naff,
gdouble x,
gdouble y);
void aff2_rotate (Aff2 *naff,
gdouble theta);
void aff2_scale (Aff2 *naff,
gdouble s,
gint flip);
void aff2_distort (Aff2 *naff,
gdouble asym,
gdouble shear);
void aff2_compute_stretch (Aff2 *naff,
gdouble xo,
gdouble yo,
gdouble xn,
gdouble yn);
void aff2_compute_distort (Aff2 *naff,
gdouble xo,
gdouble yo,
gdouble xn,
gdouble yn);
void aff2_compose (Aff2 *naff,
Aff2 *aff1,
Aff2 *aff2);
void aff2_invert (Aff2 *naff,
Aff2 *aff);
void aff2_apply (Aff2 *aff,
gdouble x,
gdouble y,
gdouble *xf,
gdouble *yf);
void aff2_fixed_point (Aff2 *aff,
gdouble *xf,
gdouble *yf);
void aff3_apply (Aff3 *t,
gdouble x,
gdouble y,
gdouble z,
gdouble *xf,
gdouble *yf,
gdouble *zf);
/* manipulation of polygons */
IPolygon *ipolygon_convex_hull (IPolygon *poly);
gint ipolygon_contains (IPolygon *poly,
gint xt,
gint yt);
/* manipulation of composite transforms */
AffElement *aff_element_new (gdouble x,
gdouble y,
GimpRGB *color,
gint count);
void aff_element_free (AffElement *elem);
void aff_element_compute_trans (AffElement *elem,
gdouble width,
gdouble height,
gdouble center_x,
gdouble center_y);
void aff_element_compute_color_trans (AffElement *elem);
void aff_element_decompose_trans (AffElement *elem,
Aff2 *aff,
gdouble width,
gdouble height,
gdouble center_x,
gdouble center_y);
void aff_element_compute_boundary (AffElement *elem,
gint width,
gint height,
AffElement **elements,
gint num_elements);
void aff_element_draw (AffElement *elem,
gint selected,
gint width,
gint height,
cairo_t *cr,
GdkColor *color,
PangoLayout *layout);
void ifs_render (AffElement **elements,
gint num_elements,
gint width,
gint height,
gint nsteps,
IfsComposeVals *vals,
gint band_y,
gint band_height,
guchar *data,
guchar *mask,
guchar *nhits,
gboolean preview);
gchar * ifsvals_stringify (IfsComposeVals *vals,
AffElement **elements);
gboolean ifsvals_parse_string (const gchar *str,
IfsComposeVals *vals,
AffElement ***elements);
|