home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / airbrush_blob.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-14  |  3.5 KB  |  154 lines

  1. /* airbrush_blob.h: routines for manipulating scan converted convex
  2.  *         polygons.
  3.  *  
  4.  * Copyright 1998, Owen Taylor <otaylor@gtk.org>
  5.  *
  6.  * > Please contact the above author before modifying the copy <
  7.  * > of this file in the GIMP distribution. Thanks.            <
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22.  *
  23. */
  24.  
  25. #ifndef __AIRBRUSHBLOB_H__
  26. #define __AIRBRUSHBLOB_H__
  27.  
  28. typedef enum {
  29.   CROSS = 0,
  30.   CROSS_LEFT = 1,
  31.   CROSS_RIGHT = 2,
  32.   CROSS_WHOLE_LINE = 3,
  33.   CROSS_NORMAL = 4
  34. } CrossType;
  35.  
  36. typedef enum {
  37.   RIGHT_LEFT = 0,
  38.   LEFT_RIGHT = 1,
  39.   TOP_BOT = 2,
  40.   BOT_TOP = 3,
  41.   NONE = 4
  42. } MoveType;
  43.  
  44. /* The AirBlob, which is a abstract of a real AirBrushBlob */
  45.  
  46. typedef struct _AirBlob AirBlob;
  47. typedef struct _AirPoint AirPoint;
  48. typedef struct _SupportLine SupportLine;
  49.  
  50.  
  51. struct _AirPoint {
  52.   int x;
  53.   int y;
  54. };
  55.  
  56. struct _SupportLine {
  57.   double size;
  58.   double dist;
  59. };
  60.  
  61. struct _AirBlob {
  62.   double direction_abs;
  63.   double direction;
  64.   double ycenter;
  65.   double xcenter;
  66.   SupportLine main_line;
  67.   SupportLine minor_line;
  68.   SupportLine maincross_line;
  69.   SupportLine minorcross_line;
  70. }; 
  71.  
  72.  
  73. /* The AirLine is a reslut of a AirBlob */
  74. typedef struct _AirLine AirLine;
  75.  
  76. struct _AirLine {
  77.   int xcenter;
  78.   int ycenter;
  79.   AirPoint line[16];
  80.   int min_x, min_y;
  81.   int max_x, max_y;
  82.   int width, height;
  83.   int nlines;
  84. };
  85.  
  86.  
  87. typedef struct _AirBrushBlobPoint AirBrushBlobPoint;
  88. typedef struct _AirBrushBlobSpan AirBrushBlobSpan;
  89. typedef struct _AirBrushBlob AirBrushBlob;
  90.  
  91. struct _AirBrushBlobPoint {
  92.   int x;
  93.   int y;
  94. };
  95.  
  96. struct _AirBrushBlobSpan {
  97.   int left;    
  98.   double angle_left;  
  99.   double angle_left_abs;
  100.   double dist_left;
  101.   int right;
  102.   double angle_right; 
  103.   double angle_right_abs;
  104.   double dist_right;
  105.  
  106.   CrossType cross_type;
  107.   int x_cross;
  108.  
  109.   int center;
  110.   double dist;
  111.  
  112. };
  113.  
  114. struct _AirBrushBlob {
  115.   int y;
  116.   int height;
  117.   int width;
  118.   int min_x;
  119.   int max_x;
  120.   MoveType move;
  121.   double direction_abs;
  122.   double direction;
  123.   CrossType cross;
  124.   AirBrushBlobSpan data[1];
  125. };
  126.  
  127.  
  128. typedef struct _AirBrush AirBrush;
  129.  
  130. struct _AirBrush {
  131.   AirBrushBlob airbrush_blob;
  132.   AirBlob airblob;
  133. };
  134.  
  135.  
  136.  
  137.  
  138. AirBlob *create_air_blob (double xc, double yc, double xt, double yt, double xr, double yr, double xb, double yb, double xl, double yl, double direction_abs, double direction);
  139. AirBlob *trans_air_blob(AirBlob *airblob_last, AirBlob *airblob_present, double dist, int xc, int yc);
  140. AirLine *create_air_line(AirBlob *airblob);
  141.  
  142.  
  143.  
  144.  
  145.  
  146. AirBrushBlob *airbrush_blob_convex_union (AirBrushBlob *b1, AirBrushBlob *b2);
  147. AirBrushBlob *airbrush_blob_ellipse (double xc, double yc, double xt, double yt, double xr, double yr, double xb, double yb, double xl, double yl);
  148. void          airbrush_blob_bounds  (AirBrushBlob *b, int *x, int *y, int *width, int *height);
  149.  
  150.  
  151.  
  152.  
  153. #endif /* __AIRBRUSHBLOB_H__ */
  154.