gimp/app/core/gimpimage-private.h

145 lines
6.7 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_IMAGE_PRIVATE_H__
#define __GIMP_IMAGE_PRIVATE_H__
typedef struct _GimpImageFlushAccumulator GimpImageFlushAccumulator;
struct _GimpImageFlushAccumulator
{
gboolean alpha_changed;
gboolean mask_changed;
gboolean floating_selection_changed;
gboolean preview_invalidated;
};
typedef struct _GimpImagePrivate GimpImagePrivate;
struct _GimpImagePrivate
{
gint ID; /* provides a unique ID */
GimpPlugInProcedure *load_proc; /* procedure used for loading */
GimpPlugInProcedure *save_proc; /* last save procedure used */
GimpPlugInProcedure *export_proc; /* last export procedure used */
gchar *display_name; /* display basename */
gchar *display_path; /* display full path */
gint width; /* width in pixels */
gint height; /* height in pixels */
gdouble xresolution; /* image x-res, in dpi */
gdouble yresolution; /* image y-res, in dpi */
GimpUnit resolution_unit; /* resolution unit */
GimpImageBaseType base_type; /* base gimp_image type */
GimpPrecision precision; /* image's precision */
GimpLayerMode new_layer_mode; /* default mode of new layers */
guchar *colormap; /* colormap (for indexed) */
gint n_colors; /* # of colors (for indexed) */
GimpPalette *palette; /* palette of colormap */
const Babl *babl_palette_rgb; /* palette's RGB Babl format */
const Babl *babl_palette_rgba; /* palette's RGBA Babl format */
gboolean is_color_managed; /* is this image color managed */
GimpColorProfile *color_profile; /* image's color profile */
Initial space invasion commit in GIMP All babl formats now have a space equivalent to a color profile, determining the format's primaries and TRCs. This commit makes GIMP aware of this. libgimp: - enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA as deprecated aliases, add PERCEPTUAL values so we now have LINEAR, NON_LINEAR and PERCPTUAL for each encoding, matching the babl encoding variants RGB, R'G'B' and R~G~B~. - gimp_color_transform_can_gegl_copy() now returns TRUE if both profiles can return a babl space, increasing the amount of fast babl color conversions significantly. - TODO: no solution yet for getting libgimp drawable proxy buffers in the right format with space. plug-ins: - follow the GimpPrecision change. - TODO: everything else unchanged and partly broken or sub-optimal, like setting a new image's color profile too late. app: - add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as replacement for all "linear" booleans. - change gimp-babl functions to take babl spaces and GimpTRCType parameters and support all sorts of new perceptual ~ formats. - a lot of places changed in the early days of goat invasion didn't take advantage of gimp-babl utility functions and constructed formats manually. They all needed revisiting and many now use much simpler code calling gimp-babl API. - change gimp_babl_format_get_color_profile() to really extract a newly allocated color profile from the format, and add gimp_babl_get_builtin_color_profile() which does the same as gimp_babl_format_get_color_profile() did before. Visited all callers to decide whether they are looking for the format's actual profile, or for one of the builtin profiles, simplifying code that only needs builtin profiles. - drawables have a new get_space_api(), get_linear() is now get_trc(). - images now have a "layer space" and an API to get it, gimp_image_get_layer_format() returns formats in that space. - an image's layer space is created from the image's color profile, change gimpimage-color-profile to deal with that correctly - change many babl_format() calls to babl_format_with_space() and take the space from passed formats or drawables - add function gimp_layer_fix_format_space() which replaces the layer's buffer with one that has the image's layer format, but doesn't change pixel values - use gimp_layer_fix_format_space() to make sure layers loaded from XCF and created by plug-ins have the right space when added to the image, because it's impossible to always assign the right space upon layer creation - "assign color profile" and "discard color profile" now require use of gimp_layer_fix_format_space() too because the profile is now embedded in all formats via the space. Add gimp_image_assign_color_profile() which does all that and call it instead of a simple gimp_image_set_color_profile(), also from the PDB set-color-profile functions, which are essentially "assign" and "discard" calls. - generally, make sure a new image's color profile is set before adding layers to it, gimp_image_set_color_profile() is more than before considered know-what-you-are-doing API. - take special precaution in all places that call gimp_drawable_convert_type(), we now must pass a new_profile from all callers that convert layers within the same image (such as image_convert_type, image_convert_precision), because the layer's new space can't be determined from the image's layer format during the call. - change all "linear" properties to "trc", in all config objects like for levels and curves, in the histogram, in the widgets. This results in some GUI that now has three choices instead of two. TODO: we might want to reduce that back to two later. - keep "linear" boolean properties around as compat if needed for file pasring, but always convert the parsed parsed boolean to GimpTRCType. - TODO: the image's "enable color management" switch is currently broken, will fix that in another commit.
2018-07-21 14:23:01 +02:00
const Babl *layer_space; /* image's Babl layer space */
/* Cached color transforms: from layer to sRGB u8 and double, and back */
gboolean color_transforms_created;
GimpColorTransform *transform_to_srgb_u8;
GimpColorTransform *transform_from_srgb_u8;
GimpColorTransform *transform_to_srgb_double;
GimpColorTransform *transform_from_srgb_double;
GimpMetadata *metadata; /* image's metadata */
2014-07-08 00:03:08 +02:00
GFile *file; /* the image's XCF file */
GFile *imported_file; /* the image's source file */
GFile *exported_file; /* the image's export file */
GFile *save_a_copy_file; /* the image's save-a-copy file */
GFile *untitled_file; /* a file saying "Untitled" */
gboolean xcf_compression; /* XCF compression enabled? */
gint dirty; /* dirty flag -- # of ops */
2014-08-25 13:34:17 +05:30
gint64 dirty_time; /* time when image became dirty */
gint export_dirty; /* 'dirty' but for export */
gint undo_freeze_count; /* counts the _freeze's */
gint instance_count; /* number of instances */
gint disp_count; /* number of displays */
GimpTattoo tattoo_state; /* the last used tattoo */
GimpProjection *projection; /* projection layers & channels */
GeglNode *graph; /* GEGL projection graph */
GeglNode *visible_mask; /* component visibility node */
GList *symmetries; /* Painting symmetries */
GimpSymmetry *active_symmetry; /* Active symmetry */
GList *guides; /* guides */
GimpGrid *grid; /* grid */
GList *sample_points; /* color sample points */
/* Layer/Channel attributes */
GimpItemTree *layers; /* the tree of layers */
GimpItemTree *channels; /* the tree of masks */
GimpItemTree *vectors; /* the tree of vectors */
GSList *layer_stack; /* the layers in MRU order */
GQuark layer_alpha_handler;
GQuark channel_name_changed_handler;
GQuark channel_color_changed_handler;
GimpLayer *floating_sel; /* the FS layer */
GimpChannel *selection_mask; /* the selection mask channel */
2010-02-03 23:42:32 +01:00
GimpParasiteList *parasites; /* Plug-in parasite data */
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean quick_mask_state; /* TRUE if quick mask is on */
gboolean quick_mask_inverted; /* TRUE if quick mask is inverted */
GimpRGB quick_mask_color; /* rgba triplet of the color */
/* Undo apparatus */
GimpUndoStack *undo_stack; /* stack for undo operations */
GimpUndoStack *redo_stack; /* stack for redo operations */
gint group_count; /* nested undo groups */
GimpUndoType pushing_undo_group; /* undo group status flag */
2010-02-04 21:09:19 +01:00
2013-01-27 17:52:38 +02:00
/* Signal emission accumulator */
GimpImageFlushAccumulator flush_accum;
};
#define GIMP_IMAGE_GET_PRIVATE(image) \
G_TYPE_INSTANCE_GET_PRIVATE (image, \
GIMP_TYPE_IMAGE, \
GimpImagePrivate)
void gimp_image_take_mask (GimpImage *image,
GimpChannel *mask);
#endif /* __GIMP_IMAGE_PRIVATE_H__ */