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.
93 lines
3.7 KiB
C
93 lines
3.7 KiB
C
/* GIMP - The GNU Image Manipulation Program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* gimplevelsconfig.h
|
|
* Copyright (C) 2007 Michael Natterer <mitch@gimp.org>
|
|
*
|
|
* 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_LEVELS_CONFIG_H__
|
|
#define __GIMP_LEVELS_CONFIG_H__
|
|
|
|
|
|
#include "core/gimpsettings.h"
|
|
|
|
|
|
#define GIMP_TYPE_LEVELS_CONFIG (gimp_levels_config_get_type ())
|
|
#define GIMP_LEVELS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfig))
|
|
#define GIMP_LEVELS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
|
|
#define GIMP_IS_LEVELS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LEVELS_CONFIG))
|
|
#define GIMP_IS_LEVELS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LEVELS_CONFIG))
|
|
#define GIMP_LEVELS_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
|
|
|
|
|
|
typedef struct _GimpLevelsConfigClass GimpLevelsConfigClass;
|
|
|
|
struct _GimpLevelsConfig
|
|
{
|
|
GimpSettings parent_instance;
|
|
|
|
GimpTRCType trc;
|
|
|
|
GimpHistogramChannel channel;
|
|
|
|
gdouble low_input[5];
|
|
gdouble high_input[5];
|
|
|
|
gboolean clamp_input;
|
|
|
|
gdouble gamma[5];
|
|
|
|
gdouble low_output[5];
|
|
gdouble high_output[5];
|
|
|
|
gboolean clamp_output;
|
|
};
|
|
|
|
struct _GimpLevelsConfigClass
|
|
{
|
|
GimpSettingsClass parent_class;
|
|
};
|
|
|
|
|
|
GType gimp_levels_config_get_type (void) G_GNUC_CONST;
|
|
|
|
void gimp_levels_config_reset_channel (GimpLevelsConfig *config);
|
|
|
|
void gimp_levels_config_stretch (GimpLevelsConfig *config,
|
|
GimpHistogram *histogram,
|
|
gboolean is_color);
|
|
void gimp_levels_config_stretch_channel (GimpLevelsConfig *config,
|
|
GimpHistogram *histogram,
|
|
GimpHistogramChannel channel);
|
|
void gimp_levels_config_adjust_by_colors (GimpLevelsConfig *config,
|
|
GimpHistogramChannel channel,
|
|
const GimpRGB *black,
|
|
const GimpRGB *gray,
|
|
const GimpRGB *white);
|
|
|
|
GimpCurvesConfig *
|
|
gimp_levels_config_to_curves_config (GimpLevelsConfig *config);
|
|
|
|
gboolean gimp_levels_config_load_cruft (GimpLevelsConfig *config,
|
|
GInputStream *input,
|
|
GError **error);
|
|
gboolean gimp_levels_config_save_cruft (GimpLevelsConfig *config,
|
|
GOutputStream *output,
|
|
GError **error);
|
|
|
|
|
|
#endif /* __GIMP_LEVELS_CONFIG_H__ */
|