home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / bezier_selectP.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-03-30  |  4.0 KB  |  113 lines

  1. /* The GIMP -- an image manipulation program
  2.  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3.  *
  4.  * This program is free software; you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation; either version 2 of the License, or
  7.  * (at your option) any later version.
  8.  *
  9.  * This program 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
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17.  */
  18. #ifndef __BEZIER_SELECTP_H__
  19. #define __BEZIER_SELECTP_H__
  20.  
  21. #include "draw_core.h"
  22.  
  23. #define BEZIER_START     1
  24. #define BEZIER_ADD       2
  25. #define BEZIER_EDIT      4
  26. #define BEZIER_DRAG      8
  27.  
  28. #define BEZIER_ANCHOR    1
  29. #define BEZIER_CONTROL   2
  30. #define BEZIER_MOVE      3
  31.  
  32. #define IMAGE_COORDS    1
  33. #define AA_IMAGE_COORDS 2
  34. #define SCREEN_COORDS   3
  35.  
  36. #define SUBDIVIDE  1000
  37.  
  38. enum { EXTEND_EDIT, EXTEND_ADD, EXTEND_REMOVE, EXTEND_NEW };
  39.  
  40. struct _BezierPoint
  41. {
  42.   gint         type;          /* type of point (anchor/control/move) */
  43.   gdouble      x, y;          /* location of point in image space  */
  44.   gint         sx, sy;        /* location of point in screen space */
  45.   BezierPoint *next;          /* next point on curve               */
  46.   BezierPoint *prev;          /* prev point on curve               */
  47.   BezierPoint *next_curve;    /* Next curve segment                */
  48.   gint         pointflags;    /* Status of point 0 = not selected 
  49.                    * 1 = selected 
  50.                    */ 
  51. };
  52.  
  53. struct _BezierSelect
  54. {
  55.   gint          state;        /* start, add, edit or drag          */
  56.   gint          draw;         /* all or part                       */
  57.   gint          closed;       /* is the last curve closed          */
  58.   DrawCore     *core;         /* Core drawing object               */
  59.   BezierPoint  *points;       /* the curve                         */
  60.   BezierPoint  *cur_anchor;   /* the current active anchor point   */
  61.   BezierPoint  *cur_control;  /* the current active control point  */
  62.   BezierPoint  *last_point;   /* the last point on the curve       */
  63.   gint          num_points;   /* number of points in the curve     */
  64.   Channel      *mask;         /* null if the curve is open         */
  65.   GSList      **scanlines;    /* used in converting a curve        */
  66. };
  67.  
  68. /* All udata that are passed to the bezier_draw_curve must
  69.  * have this structure as the first element.
  70.  */
  71.  
  72. typedef struct
  73. {
  74.   gint count;
  75. } CountCurves;
  76.  
  77. typedef void (* BezierPointsFunc) (BezierSelect *, GdkPoint *, int,gpointer);
  78.  
  79. /*  Functions  */
  80. int   bezier_select_load                   (void *,
  81.                         BezierPoint *,
  82.                         gint,
  83.                         gint);
  84. void  bezier_draw_curve                    (BezierSelect *,
  85.                         BezierPointsFunc,
  86.                         gint,
  87.                         gpointer);
  88. void  bezier_select_reset                  (BezierSelect *bezier_sel);
  89. void  bezier_select_free                   (BezierSelect *bezier_sel);
  90. void  bezier_add_point                     (BezierSelect *,
  91.                         gint,
  92.                         gdouble,
  93.                         gdouble);
  94. void  bezier_paste_bezierselect_to_current (GDisplay     *gdisp,
  95.                         BezierSelect *bezier_sel);
  96. void  bezier_select_mode                   (gint);
  97. void  bezier_stroke                    (BezierSelect *bezier_sel,
  98.                         GDisplay     *gdisp,
  99.                         gint,
  100.                         gint);
  101. void  bezier_to_selection                  (BezierSelect *bezier_sel,
  102.                         GDisplay     *gdisp);
  103. gint  bezier_distance_along                (BezierSelect *bezier_sel,
  104.                         gint,
  105.                         gdouble,
  106.                         gint *,
  107.                         gint *,
  108.                         gdouble *);
  109. void  bezier_draw                          (GDisplay     *gdisp,
  110.                         BezierSelect *bezier_sel);
  111.  
  112. #endif /* __BEZIER_SELECTP_H__ */
  113.