home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / plug-ins / ifscompose / ifscompose.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-27  |  4.2 KB  |  144 lines

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