mirror of https://github.com/GNOME/gimp.git
e09e563a70
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. |
||
---|---|---|
.. | ||
groups | ||
.gitignore | ||
Makefile.am | ||
README | ||
README_NEW_PDB_PROC | ||
app.pl | ||
enumcode.pl | ||
enumgen.pl | ||
enums-external.pl | ||
enums.pl | ||
groups.pl | ||
lib.pl | ||
pdb.pl | ||
pdbgen.pl | ||
stddefs.pdb | ||
util.pl |
README
Some mostly unfinished docs are here. -Yosh This document describes the tool PDBGEN. If you added or modified .pdb files do not run this tool manually but run make instead! It will call pdbgen.pl then to generate the files into the right output directories. PDBGEN ------------------ What is this? PDBGEN is a tool to automate much of the drudge work of making PDB interfaces to GIMP internals. Right now, it generates PDB description records, argument marshallers (with sanity checking) for the app side, as well as libgimp wrappers for C plugins. It's written so that extending it to provide support for CORBA and other languages suited to static autogeneration. Invoking PDBGEN from the command line: 1. Change into the ./pdb directory. 2. $ ./pdbgen.pl DIRNAME where DIRNAME is either "lib" or "app", depending on which set of files you want to generate. The files are written into $destdir/app or $destdir/libgimp. $destdir is the environment variable destdir. If it's not set, then it's the ./pdb directory. Make sure the directories $destdir/app and $destdir/libgimp already exist and you have write permissions. Otherwise the code generator will fail and exit. It's up to you to diff the file you changed. When you're happy with the generated file, copy it into the actual ./app/ or ./libgimp/ directory where it finally gets built. Anatomy of a PDB descriptor: PDB descriptors are Perl code. You define a subroutine, which corresponds to the PDB function you want to create. You then fill certain special variables to fully describe all the information pdbgen needs to generate code. Since it's perl, you can do practically whatever perl lets you do to help you do this. However, at the simplest level, you don't need to know perl at all to make PDB descriptors. Annotated description: For example, we will look at gimp_display_new, specified in gdisplay.pdb. sub display_new { We start with the name of our PDB function (not including the "gimp_" prefix). $blurb = 'Create a new display for the specified image.'; This directly corresponds to the "blurb" field in the ProcRecord. $help = <<'HELP'; Creates a new display for the specified image. If the image already has a display, another is added. Multiple displays are handled transparently by the GIMP. The newly created display is returned and can be subsequently destroyed with a call to 'gimp-display-delete'. This procedure only makes sense for use with the GIMP UI. HELP This is the help field. Notice because it is a long string, we used HERE document syntax to split it over multiple lines. Any extra whitespace in $blurb or $help, including newlines, is automatically stripped, so you don't have to worry about that. &std_pdb_misc; This is the "author", "copyright", and "date" fields. Since S&P are quite common, they get a special shortcut which fills these in for you. Stuff like this is defined in stddefs.pdb. @inargs = ( &std_image_arg ); You specify arguments in a list. Again, your basic image is very common, so it gets a shortcut. @outargs = ( { name => 'display', type => 'display', desc => 'The new display', alias => 'gdisp', init => 1 } ); This is a real argument. It has a name, type, description at a minimum. "alias" lets you use the alias name in your invoker code, but the real name is still shown in the ProcRecord. This is useful not only as a shorthand, but for grabbing variables defined somewhere else (or constants), in conjunction with the "no_declare" flag. "init" simply says initialize this variable to a dummy value (in this case to placate gcc warnings) %invoke = ( headers => [ qw("gdisplay.h") ], These are the headers needed for the functions you call. vars => [ 'guint scale = 0x101' ], Extra variables can be put here for your invoker. code => <<'CODE' { if (gimage->layers == NULL) success = FALSE; else success = ((gdisp = gdisplay_new (gimage, scale)) != NULL); } CODE The actual invoker code. Since it's a multiline block, we put curly braces in the beginning.