home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / path_toolP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-09  |  4.3 KB  |  135 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 __PATH_TOOLP_H__
  19. #define __PATH_TOOLP_H__
  20.  
  21. #undef PATH_TOOL_DEBUG
  22.  
  23. #include "draw_core.h"
  24.  
  25. #ifdef PATH_TOOL_DEBUG
  26. #include <stdio.h>
  27. #endif
  28.  
  29. #define IMAGE_COORDS    1
  30. #define AA_IMAGE_COORDS 2
  31. #define SCREEN_COORDS   3
  32.  
  33. #define SEGMENT_ACTIVE  1
  34.  
  35. #define PATH_TOOL_DRAG  1
  36.  
  37. #define PATH_TOOL_REDRAW_ALL      1
  38. #define PATH_TOOL_REDRAW_ACTIVE   2
  39. #define PATH_TOOL_REDRAW_HANDLES  4
  40.  
  41. #define SUBDIVIDE  1000
  42.  
  43. typedef enum { SEGMENT_LINE=0, SEGMENT_BEZIER} SegmentType;
  44.  
  45. enum { ON_ANCHOR, ON_HANDLE, ON_CURVE, ON_CANVAS };
  46.  
  47. typedef struct _path_segment PathSegment;
  48. typedef struct _path_curve   PathCurve;
  49. typedef struct _path         Path;
  50.  
  51. typedef struct _path_tool    PathTool;
  52.  
  53. struct _path_segment
  54. {
  55.    SegmentType  type;         /* What type of segment */
  56.    gdouble      x, y;         /* location of starting-point in image space  */
  57.    gpointer     data;         /* Additional data, dependant of segment-type */
  58.    
  59.    guint32      flags;        /* Various Flags: Is the Segment active? */
  60.  
  61.    PathCurve   *parent;       /* the parent Curve */
  62.    PathSegment *next;         /* Next Segment or NULL */
  63.    PathSegment *prev;         /* Previous Segment or NULL */
  64.  
  65. };
  66.  
  67.  
  68. struct _path_curve
  69. {
  70.    PathSegment *segments;    /* The segments of the curve */
  71.    PathSegment *cur_segment; /* the current segment */
  72.    Path        *parent;      /* the parent Path */
  73.    PathCurve   *next;        /* Next Curve or NULL */
  74.    PathCurve   *prev;        /* Previous Curve or NULL */
  75. };
  76.  
  77.  
  78. struct _path
  79. {
  80.    PathCurve *curves;        /* the curves */
  81.    PathCurve *cur_curve;     /* the current curve */
  82.    GString   *name;          /* the name of the path */
  83.    guint32    state;         /* is the path locked? */
  84.    PathTool  *path_tool;     /* The parent Path Tool */
  85. };
  86.  
  87.  
  88. struct _path_tool
  89. {
  90.    gint         click_type;      /* where did the user click?         */
  91.    gint         click_x;         /* X-coordinate of the click         */
  92.    gint         click_y;         /* Y-coordinate of the click         */
  93.    gint         click_halfwidth;
  94.    guint        click_modifier;  /* what modifiers were pressed?      */
  95.    Path        *click_path;      /* On which Path/Curve/Segment       */
  96.    PathCurve   *click_curve;     /* was the click?                    */
  97.    PathSegment *click_segment;
  98.    gdouble      click_position;  /* The position on the segment       */
  99.    gint         click_handle_id; /* The handle ID of the segment      */
  100.  
  101.    gint         active_count;    /* How many segments are active?     */
  102.    /*
  103.     * WARNING: single_active_segment may contain non NULL Values
  104.     * which point to the nirvana. But they are important!
  105.     * The pointer is garantueed to be valid, when active_count==1
  106.     */
  107.    PathSegment *single_active_segment;  /* The only active segment    */
  108.  
  109.    gint         state;           /* state of tool                     */
  110.    gint         draw;            /* all or part                       */
  111.    DrawCore    *core;            /* Core drawing object               */
  112.    Path        *cur_path;        /* the current active path           */
  113.    GSList     **scanlines;       /* used in converting a path         */
  114. };
  115.  
  116. typedef void
  117. (*PathTraverseFunc)    (Path *,
  118.             PathCurve *,
  119.             gpointer);
  120. typedef void
  121. (*CurveTraverseFunc)   (Path *,
  122.             PathCurve *,
  123.             PathSegment *,
  124.             gpointer);
  125. typedef void
  126. (*SegmentTraverseFunc) (Path *,
  127.             PathCurve *,
  128.             PathSegment *,
  129.             gint,
  130.             gint,
  131.             gpointer);
  132.  
  133. #endif /* __PATH_TOOLP_H__ */
  134.  
  135.