home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / gimpimage.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-12-17  |  11.7 KB  |  296 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.  
  19. #ifndef __GIMPIMAGE_H__
  20. #define __GIMPIMAGE_H__
  21.  
  22. #include "apptypes.h"
  23. #include "procedural_db.h"
  24. #include "boundary.h"
  25. #include "drawable.h"
  26. #include "channel.h"
  27. #include "layer.h"
  28. #include "plug_in.h"
  29. #include "temp_buf.h"
  30. #include "tile_manager.h"
  31. #include "path.h"
  32.  
  33. #include "libgimp/gimpparasite.h"
  34. #include "libgimp/gimpunit.h"
  35.  
  36.  
  37. #define GIMP_TYPE_IMAGE    gimp_image_get_type()
  38. #define GIMP_IMAGE(obj)    GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
  39. #define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
  40.      
  41. #define GIMP_IMAGE_TYPE_HAS_ALPHA(t)  ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
  42.  
  43. #define GRAY_PIX         0
  44. #define ALPHA_G_PIX      1
  45. #define RED_PIX          0
  46. #define GREEN_PIX        1
  47. #define BLUE_PIX         2
  48. #define ALPHA_PIX        3
  49. #define INDEXED_PIX      0
  50. #define ALPHA_I_PIX      1
  51.  
  52. #define COLORMAP_SIZE    768
  53.  
  54. typedef enum /*< skip >*/
  55.   ORIENTATION_UNKNOWN,
  56.   ORIENTATION_HORIZONTAL,
  57.   ORIENTATION_VERTICAL
  58. } InternalOrientationType;
  59.  
  60. typedef enum
  61. {
  62.   HORIZONTAL,
  63.   VERTICAL,
  64.   UNKNOWN
  65. } OrientationType;
  66.  
  67. typedef enum
  68. {
  69.   RED_CHANNEL,
  70.   GREEN_CHANNEL,
  71.   BLUE_CHANNEL,
  72.   GRAY_CHANNEL,
  73.   INDEXED_CHANNEL,
  74.   AUXILLARY_CHANNEL
  75. } ChannelType;
  76.  
  77. typedef enum
  78. {
  79.   EXPAND_AS_NECESSARY,
  80.   CLIP_TO_IMAGE,
  81.   CLIP_TO_BOTTOM_LAYER,
  82.   FLATTEN_IMAGE
  83. } MergeType;
  84.  
  85.  
  86. /* Ugly! Move this someplace else! Prolly to gdisplay.. */
  87.  
  88. struct _Guide
  89. {
  90.   int ref_count;
  91.   int position;
  92.   int orientation;
  93.   guint32 guide_ID;
  94. };
  95.  
  96.  
  97. typedef struct _GimpImageRepaintArg
  98. {
  99.   Layer *layer;
  100.   guint  x;
  101.   guint  y;
  102.   guint  width;
  103.   guint  height;
  104. } GimpImageRepaintArg;
  105.     
  106.     
  107. GtkType gimp_image_get_type (void);
  108.  
  109.  
  110. /* function declarations */
  111.  
  112. GimpImage *     gimp_image_new                    (gint, gint,
  113.                            GimpImageBaseType);
  114. void            gimp_image_set_filename           (GimpImage *, gchar *);
  115. void            gimp_image_set_resolution         (GimpImage *,
  116.                            gdouble, gdouble);
  117. void            gimp_image_get_resolution         (GimpImage *,
  118.                            gdouble *, gdouble *);
  119. void            gimp_image_set_unit               (GimpImage *, GimpUnit);
  120. GimpUnit        gimp_image_get_unit               (GimpImage *);
  121. void            gimp_image_set_save_proc      (GimpImage *,
  122.                            PlugInProcDef *);
  123. PlugInProcDef * gimp_image_get_save_proc      (GimpImage *);
  124. gint        gimp_image_get_width          (const GimpImage *);
  125. gint        gimp_image_get_height          (const GimpImage *);
  126. void            gimp_image_resize                 (GimpImage *,
  127.                            gint, gint, gint, gint);
  128. void            gimp_image_scale                  (GimpImage *, gint, gint);
  129. GimpImage *     gimp_image_get_named              (gchar *);
  130. GimpImage *     gimp_image_get_ID                 (gint);
  131. TileManager *   gimp_image_shadow                 (GimpImage *,
  132.                            gint, gint, gint);
  133. void            gimp_image_free_shadow            (GimpImage *);
  134. void            gimp_image_apply_image            (GimpImage *, GimpDrawable *,
  135.                            PixelRegion *, gint,
  136.                            gint,
  137.                            LayerModeEffects,
  138.                            TileManager *, gint, gint);
  139. void            gimp_image_replace_image          (GimpImage *, GimpDrawable *,
  140.                            PixelRegion *, gint, gint,
  141.                            PixelRegion *, gint, gint);
  142. void            gimp_image_get_foreground         (GimpImage *, GimpDrawable *,
  143.                            guchar *);
  144. void            gimp_image_get_background         (GimpImage *, GimpDrawable *,
  145.                            guchar *);
  146. guchar *        gimp_image_get_color_at           (GimpImage *, gint, gint);
  147.                            
  148. void            gimp_image_get_color              (GimpImage *,
  149.                            GimpImageType,
  150.                            guchar *,
  151.                            guchar *);
  152. void            gimp_image_transform_color        (GimpImage *,
  153.                            GimpDrawable *,
  154.                            guchar *,
  155.                            guchar *,
  156.                            GimpImageBaseType);
  157. Guide*          gimp_image_add_hguide             (GimpImage *);
  158. Guide*          gimp_image_add_vguide             (GimpImage *);
  159. void            gimp_image_add_guide              (GimpImage *, Guide *);
  160. void            gimp_image_remove_guide           (GimpImage *, Guide *);
  161. void            gimp_image_delete_guide           (GimpImage *, Guide *);
  162.  
  163. GimpParasite *  gimp_image_parasite_find          (const GimpImage *,
  164.                            const gchar *name);
  165. gchar **        gimp_image_parasite_list          (GimpImage *gimage,
  166.                                                    gint *count);
  167. void            gimp_image_parasite_attach        (GimpImage *,
  168.                            GimpParasite *);
  169. void            gimp_image_parasite_detach        (GimpImage *, const gchar *);
  170.  
  171. Tattoo          gimp_image_get_new_tattoo         (GimpImage *);
  172. gboolean        gimp_image_set_tattoo_state       (GimpImage *, Tattoo);
  173. Tattoo          gimp_image_get_tattoo_state       (GimpImage *);
  174.  
  175. void            gimp_image_set_paths              (GimpImage *, PathList *);
  176. PathList *      gimp_image_get_paths              (GimpImage *);
  177.  
  178. /* Temporary hack till colormap manipulation is encapsulated in functions.
  179.    Call this whenever you modify an image's colormap. The ncol argument
  180.    specifies which color has changed, or negative if there's a bigger change.
  181.    Currently, use this also when the image's base type is changed to/from
  182.    indexed.  */
  183.  
  184. void        gimp_image_colormap_changed      (GimpImage * image,
  185.                            gint ncol);
  186.  
  187.  
  188. /*  layer/channel functions  */
  189.  
  190. gint            gimp_image_get_layer_index        (GimpImage *, Layer *);
  191. gint            gimp_image_get_channel_index      (GimpImage *, Channel *);
  192. Layer *         gimp_image_get_active_layer       (GimpImage *);
  193. Channel *       gimp_image_get_active_channel     (GimpImage *);
  194. Layer *         gimp_image_get_layer_by_tattoo    (GimpImage *, Tattoo);
  195. Channel *       gimp_image_get_channel_by_tattoo  (GimpImage *, Tattoo);
  196. Channel *       gimp_image_get_channel_by_name    (GimpImage *, gchar *);
  197. Channel *       gimp_image_get_mask               (GimpImage *);
  198. gint            gimp_image_get_component_active   (GimpImage *, ChannelType);
  199. gint            gimp_image_get_component_visible  (GimpImage *, ChannelType);
  200. gboolean        gimp_image_layer_boundary         (GimpImage *, BoundSeg **,
  201.                            gint *);
  202. Layer *         gimp_image_set_active_layer       (GimpImage *, Layer *);
  203. Channel *       gimp_image_set_active_channel     (GimpImage *, Channel *);
  204. Channel *       gimp_image_unset_active_channel   (GimpImage *);
  205. void            gimp_image_set_component_active   (GimpImage *, ChannelType,
  206.                            gint);
  207. void            gimp_image_set_component_visible  (GimpImage *, ChannelType,
  208.                            gint);
  209. Layer *         gimp_image_pick_correlate_layer   (GimpImage *, gint, gint);
  210. void            gimp_image_set_layer_mask_apply   (GimpImage *, gint);
  211. void            gimp_image_set_layer_mask_edit    (GimpImage *, Layer *, gint);
  212. void            gimp_image_set_layer_mask_show    (GimpImage *, gint);
  213. Layer *         gimp_image_raise_layer            (GimpImage *, Layer *);
  214. Layer *         gimp_image_lower_layer            (GimpImage *, Layer *);
  215. Layer *         gimp_image_raise_layer_to_top     (GimpImage *, Layer *);
  216. Layer *         gimp_image_lower_layer_to_bottom  (GimpImage *, Layer *);
  217. Layer *         gimp_image_position_layer         (GimpImage *, Layer *,
  218.                            gint, gboolean);
  219. Layer *         gimp_image_merge_visible_layers   (GimpImage *, MergeType);
  220. Layer *         gimp_image_merge_down             (GimpImage *, Layer *,
  221.                            MergeType);
  222. Layer *         gimp_image_flatten                (GimpImage *);
  223. Layer *         gimp_image_merge_layers           (GimpImage *, GSList *,
  224.                            MergeType);
  225. Layer *         gimp_image_add_layer              (GimpImage *, Layer *, gint);
  226. Layer *         gimp_image_remove_layer           (GimpImage *, Layer *);
  227. LayerMask *     gimp_image_add_layer_mask         (GimpImage *, Layer *,
  228.                            LayerMask *);
  229. Channel *       gimp_image_remove_layer_mask      (GimpImage *, Layer *,
  230.                            MaskApplyMode);
  231. Channel *       gimp_image_raise_channel          (GimpImage *, Channel *);
  232. Channel *       gimp_image_lower_channel          (GimpImage *, Channel *);
  233. Channel *       gimp_image_position_channel       (GimpImage *, Channel *, gint);
  234. Channel *       gimp_image_add_channel            (GimpImage *, Channel *, gint);
  235. Channel *       gimp_image_remove_channel         (GimpImage *, Channel *);
  236. void            gimp_image_construct              (GimpImage *,
  237.                            gint, gint, gint, gint,
  238.                            gboolean);
  239.  
  240. void            gimp_image_invalidate_without_render (GimpImage *, gint, gint,
  241.                               gint, gint, gint,
  242.                               gint, gint, gint);
  243. void            gimp_image_invalidate                (GimpImage *, gint, gint,
  244.                               gint, gint, gint,
  245.                               gint, gint, gint);
  246. void            gimp_image_validate                  (TileManager *, Tile *);
  247.  
  248. /*  Access functions  */
  249.  
  250. gboolean           gimp_image_is_empty             (GimpImage *);
  251. GimpDrawable *     gimp_image_active_drawable      (GimpImage *);
  252.  
  253. GimpImageBaseType  gimp_image_base_type            (GimpImage *gimage);
  254. GimpImageType       gimp_image_base_type_with_alpha (GimpImage *gimage);
  255.  
  256. gchar *            gimp_image_filename             (GimpImage *);
  257. gboolean           gimp_image_undo_is_enabled      (GimpImage *);
  258. gboolean           gimp_image_undo_enable          (GimpImage *);
  259. gboolean           gimp_image_undo_disable         (GimpImage *);
  260. gboolean           gimp_image_undo_freeze          (GimpImage *);
  261. gboolean           gimp_image_undo_thaw            (GimpImage *);
  262. void           gimp_image_undo_event       (GimpImage *, gint);
  263. gint               gimp_image_dirty                (GimpImage *);
  264. gint               gimp_image_clean                (GimpImage *);
  265. void               gimp_image_clean_all            (GimpImage *);
  266. Layer *            gimp_image_floating_sel         (GimpImage *);
  267. guchar *           gimp_image_cmap                 (GimpImage *);
  268.  
  269. /*  projection access functions  */
  270.  
  271. TileManager *   gimp_image_projection             (GimpImage *);
  272. GimpImageType    gimp_image_projection_type        (GimpImage *);
  273. gint            gimp_image_projection_bytes       (GimpImage *);
  274. gint            gimp_image_projection_opacity     (GimpImage *);
  275. void            gimp_image_projection_realloc     (GimpImage *);
  276.  
  277.  
  278. /*  composite access functions  */
  279.  
  280. TileManager *   gimp_image_composite              (GimpImage *);
  281. GimpImageType    gimp_image_composite_type         (GimpImage *);
  282. gint            gimp_image_composite_bytes        (GimpImage *);
  283. TempBuf *       gimp_image_composite_preview      (GimpImage *, ChannelType,
  284.                            gint, gint);
  285.  
  286. gint            gimp_image_preview_valid          (GimpImage *, ChannelType);
  287. void            gimp_image_invalidate_preview     (GimpImage *);
  288.  
  289. void            gimp_image_invalidate_previews    (void);
  290.  
  291. TempBuf *       gimp_image_construct_composite_preview (GimpImage *,
  292.                             gint , gint);
  293.  
  294. #endif /* __GIMPIMAGE_H__ */
  295.