Commit Graph

4553 Commits

Author SHA1 Message Date
Michael Natterer 802a53fa54 Bug 723392 - Pasting an image replaces color profile with default one
gimp_image_duplicate(): set the new image's color profile *before*
copying layers to it, or the new layers will be automatically
converted to "no color profile aka sRGB", but then tagged with the
original profile anyway.
2015-08-30 01:31:59 +02:00
Michael Natterer 97e55692eb app: the blend tool was rendering all gradients off-by-0.5
When calculating the color of a pixel, we want to calculate the color
at its center, not at its top-left corner. Found by Raymond Jennings.
2015-08-26 23:23:16 +02:00
Michael Natterer 05add456bb app: add _gimp_image_update_color_profile() to update the cached profile
and call it when an "icc-profile" parssite is attached or detached.
This removes code duplication and creates a place to conveniently
update more cached profiles and transforms, such as from/to sRGB for
color picking and applying.
2015-08-26 19:16:17 +02:00
Michael Natterer 37a3d423e9 Bug 679387 - Add "select pixels with this color" from colormap
Add gimp_gegl_index_to_mask() and gimp_channel_select_by_index() and
around it actions, callbacks and GUI in the colormap dialog.
2015-08-26 01:06:34 +02:00
Michael Natterer eb5bdebe6a app: don't emit useless "name-changed" signals from GimpObject
if the same name is set via gimp_object_set_static_name() or
gimp_object_take_name() (gimp_object_set_name() and
gimp_object_set_name_safe() already had the check).

Since this is a slight behavior change it might have subtle side
effects; it definitely fixes GimpThumbBox thumbnail state to not
always re-create the thumbnail on click, which was happening since
porting to GFile (which switched from gimp_object_set_name() to
gimp_object_take_name()).
2015-08-25 18:39:17 +02:00
Michael Natterer 8c80ee14ff Bug 748749 - picked colors don't match image colors...
...when a color profile is active

This commit doesn't fix anything, but it prepares the code to do the
right thing:

It passes the actual raw image pixels through the entire color picking
mechanism to the widgets which display colors, particularly
GimpColorFrame.

This is needed for GimpColorFrame's "Pixel" mode (as opposed to its
RGB, HSV etc. modes) which is supposed to show the raw pixel values
from the image.

Before this commit, it was recreating the raw pixel values from the
GimpRGB value it knows, which will become impossible when we correctly
pick color managed GimpRGB values soon.
2015-08-25 00:05:59 +02:00
Michael Natterer b51ee77ec0 app: implement the "Convert to RGB Working Space" import dialog in the core
Add gimp_image_import_color_profile(), a GUI vtable entry
query_profile_policy() and a new dialog which returns the profile
policy and the profile to convert to. Get rid of the wrapper that
calls the lcms plug-in for that dialog, the plug-in is now completely
unused.

This commit doesn't add any new features, it's just the former lcms
plug-in dialog implemented in app/ (except the little fix that it is
now aware of linear vs. gamma images).
2015-08-23 12:59:12 +02:00
Michael Natterer 77dac3ea60 Bug 555562 - GIMP should ask before applying working space profile
Get rid of the "configurable RGB working space profile".

Instead, turn GimpColorConfig's "rgb-profile" property into a
"Preferred RGB profile" thing that is only a hint and never used
without explicit user interaction. Present it next to the built-in
profile in the profile combo boxes and call it "Preferred" in the
prefs dialog and its tooltip.

Most importantly, don't use it as the image's profile when the image
is not tagged with a profile. Untagged images are now always in the
sRGB or linear RGB built-in color spaces.

This commit reduces the "Apply color profile" dialog on file import to
a simple "Convert to built-in RGB", but that dialog is about to be
moved to the core and improved anyway.
2015-08-20 16:02:22 +02:00
Michael Natterer dd8a822aae Bug 723392 - Pasting an image replaces color profile with default one
Use black point compensation when converting color profiles during
copy/paste and drag/drop.
2015-08-19 17:28:39 +02:00
Michael Natterer 39de67cf4e app: fix undo/redo of profile assign/convert operations
The undo code needs to update the image's cached GimpColorProfile too.
2015-08-17 11:21:48 +02:00
Michael Natterer a36f37b2f4 app: make is impossible to tag the image with a built-in profile
by moving the code preventing it to more low-level places. The piece
in gimp_image_parasite_attach() is particularly evil.
2015-08-17 10:37:55 +02:00
Michael Natterer 3f09865384 app: drop the image's cached GimpColorProfile when the parasite is removed 2015-08-16 20:39:16 +02:00
Michael Natterer cd07627167 app: simplify gimp_image_new_from_drawable()'s color profile code 2015-08-16 19:45:04 +02:00
Michael Natterer 1715e1e60b app: keep GimpImage's profile around as GimpColorProfile
not only as parasite. This way we avoid having to create the profile
in each call to gimp_image_get_color_profile(). Also keep the built-in
profiles around in gimp_image_get_builtin_color_profile(). Add/remove
refs and unrefs as needed in all users of these functions.
2015-08-16 19:38:11 +02:00
Michael Natterer 235b4a5a67 Bug 723392 - Pasting an image replaces color profile with default one
gimp_layer_convert_type(): implement color profile conversion. This
should fix all DND operations between images with different profiles.
2015-08-16 16:00:32 +02:00
Michael Natterer 76782e622d app: add "gboolean convert_profile" to GimpDrawable::convert_type()
also add "GType old_type" to GimpItem::convert() so implementations
can do things depending on the type of the original item.

In gimp_layer_convert(), if the original item is also a layer, and
color management is not off (with a FIXME because this is the wrong
check), pass convert_profile = TRUE to gimp_drawable_convert_type().

There is no color profile conversion anywhere behind this, this is
just an API change commit.
2015-08-16 15:56:28 +02:00
Michael Natterer e8a5f285a7 app: change GimpBuffer to keep around an actual GimpColorProfile
not an icc_data blob. This simplifies the code using GimpBuffers
together with color profiles.
2015-08-16 13:14:56 +02:00
Michael Natterer b5264ec1be Bug 723392 - Pasting an image replaces color profile with default one
Make sure that paste buffers are always tagged with a profile. This
should fix copy and paste between gamma and linear images.
2015-08-15 19:15:14 +02:00
Michael Natterer 9cf455f915 app: use gimp_gegl_convert_color_profile() in gimp_layer_new_convert_profile() 2015-08-14 22:43:49 +02:00
Michael Natterer 514fbe0d66 Bug 723392 - Pasting an image replaces color profile with default one
gimp_edit_extract(): attach the profile to the copied buffer also when
the source is the image. Fixes "Copy Visible".
2015-08-14 22:34:29 +02:00
Michael Natterer 875314dd19 Bug 723392 - Pasting an image replaces color profile with default one
gimp_layer_new_convert_profile(): if there is a profile, always use
lcms to copy between the buffers, to avoid the additional gamma
conversion gegl_buffer_copy/get() would do in some cases. This should
fix copying between linear and gamma images.
2015-08-14 18:03:31 +02:00
Michael Natterer e868cfeed8 Bug 723392 - Pasting an image replaces color profile with default one
In gimplayer-new.c, convert new layers to the image's profile if color
management is not disabled in prefs. This should convert pixels from
whatever source if they have a profile attached. If they don't have a
profile, no conversion is done. I'm not entirely sure if this
automatic conversion is always the right thing to do, please test.
2015-08-14 00:08:51 +02:00
Jehan c402f10aae app: allow item numbering schemes with fixed number of digits.
If someone ended a layer name with 001, one would expect the next layer
to be 002 and not 2. We now account for this.
2015-08-08 19:05:37 +02:00
Michael Natterer cac04aed78 app: add gimp_image_get_builtin_color_profile()
which returns a color profile for the image as if nothing was
configured, currently either the builtin srgb or linear_rgb profile.
2015-08-02 23:27:06 +02:00
Michael Natterer 1ca3812396 app: rename gimpimage-profile.[ch] to gimpimage-color-profile.[ch] 2015-08-02 22:18:43 +02:00
Michael Natterer 16fa1b722d Bug 752582 - Error message when refreshing resources without...
...a writable resource directory

gimp_data_factory_data_save(): don't warn about a missing writable
directory if there is nothing to save.
2015-07-21 19:24:45 +02:00
Michael Natterer 597a438f07 app: remove gimp_image_set_filename()
- gimp-image-set-filename PDB wrapper: implement the same there in
  a few lines
- xcf-load.c: use gimp_image_set_file() instead, and get rid of the
  last use of filename in xcf/ in favor of GFile
2015-07-13 22:43:22 +02:00
Michael Natterer 6e420bcdbb app: remove gimp_image_get_filename() 2015-07-13 03:53:29 +02:00
Michael Natterer 0693298d63 libgimpcolor, *: change all GimpColorConfig getters to return const gchar*
instead of a gchar* which has to be freed. Cache all the strings in
the GimpColorConfig instance.
2015-07-12 14:10:18 +02:00
Michael Natterer c102dde92b libgimpcolor, *: change GimpColorProfile to be a GObject
it used to be a typedef to gpointer and actually was a cmsHPROFILE.

Change its API to be more "standard", remove the public close()
function. The object caches both the cmsHPROFILE and the data/length
ICC blob, so conversions between the two become obsolete (simply call
get_lcms_profile() or get_icc_profile()).

Adapt everything to the new API, but port it in a naive way for now,
the code doesn't take advantage of the new possibilities yet (like
refcounting).
2015-07-10 22:53:59 +02:00
Michael Natterer d6c578c567 app: change gimp_image_crop() to use x, y, width, height 2015-07-03 19:38:08 +02:00
Michael Natterer 33d7b6005e app: remove GimpChannel::bounds() and gimp_channel_bounds()
and port everything to GimpItem::bounds().
2015-07-03 19:38:08 +02:00
Michael Natterer 1c1d9618b0 app: add gimp_image_item_list_bounds()
which returns the bounds of a list of items, in image coordinates.
2015-07-03 19:38:08 +02:00
Michael Natterer e90e90265b app: port everything from gimp_channel_bounds() to gimp_item_bounds()
except gimpchannel.c itself.
2015-07-03 19:38:08 +02:00
Michael Natterer 1aa382e594 app: remove the GIMP_IS_CHANNEL() case from gimpimage-arrange.c
The object offset is calculated correctly for channels in the
GIMP_IS_ITEM() case using gimp_item_bounds().

Also did some general formatting cleanup in the entire file.
2015-07-03 19:38:07 +02:00
Michael Natterer 7e90a3e4e5 app: use gimp_item_bounds() instead of gimp_vectors_bounds() 2015-07-03 19:38:06 +02:00
Michael Natterer 4edf70f4f1 app: add virtual function GimpItem::bounds()
Which returns a boolean indicating if there is content at all, and the
bounds as double x, y, width, height because for most use cases that's
better than x1, y1, x2, y2. Wrap the method with two functions
gimp_item_bounds() which returns integer bounds and
gimp_item_bounds_f() which returns the original double bounds.
2015-07-03 19:38:06 +02:00
Michael Natterer fc0d253744 app: always return the rectangle values from gimp_pickable_auto_shrink()
If there is nothing to shrink, return the passed rectangle clamped
to the pickable's extents.
2015-07-03 17:52:34 +02:00
Michael Natterer 3d7af8a184 app: remove the "exclude" paameter from gimp_image_item_list_get_list()
and from gimp_image_item_list_filter(). After the fixes for bug 735906
it's no longer needed, and it was harmful.
2015-06-28 23:49:47 +02:00
Michael Natterer a13c63a3f1 app: don't push an undo group if an item list transform has only one item
The fixes for bug 735906 made it push too many undo groups.
2015-06-26 13:37:18 +02:00
Michael Natterer 3c706d00c6 Bug 735906 - Transform tools give unexpected results when transforming...
...certain sets of linked layers

Fix for translating layers from the PDB, and with the cursor keys
for gimpeditselectiontool. Moving layers with the mouse is still broken.

The approach is exactly the same as in 25a696c7.
2015-06-26 12:00:45 +02:00
Michael Natterer 25a696c7f8 Bug 735906 - Transform tools give unexpected results when transforming...
...certain sets of linked layers

Fix this bug for flip, rotate and general transforms (not for move yet):

gimp_item_linked_flip,rotate,transform(): always transform the passed
item too (do not filter it out of the list of items), so these functions
do the entire job of transforming a linked group now. Transforming the
active item separately didn't work (and is not implementable) if both
a layer and its parent layer group were linked.

flip tool, transform tool, layer->transform callbacks: don't call
gimp_item_foo() *and* (if the item is linked) gimp_item_linked_foo().
Instead call gimp_item_linked_foo() if the item is linked, and
gimp_item_foo() otherwise.

This commit also kills the mis-feature of transforming the selected
pixels of the active layer, and then the linked items completely. We
now either only transform the selected area *or* the linked group.
2015-06-25 12:25:41 +02:00
Michael Natterer b12ecc7195 app: small fix for the previous patch in gimp_group_layer_update_size() 2015-06-24 19:40:54 +02:00
Michael Natterer 953fa220a9 app: emit signals *after* gimp_drawable_real_set_buffer() changed the graph
Fixes another group layer update problem. Also freeze/thaw notify
emissions around the whole function.
2015-06-24 16:26:45 +02:00
Michael Natterer 2f8476bd18 app: fix update of group layers when size changes only trigger an offset change
In gimp_group_layer_update_size(), when the new size happens to be the
same as the old size, we need to call gimp_pickable_flush() on the
group projection so it is ready to be used for rendering the image,
just like in gimp_group_layer_stack_update().
2015-06-23 10:27:47 +02:00
Michael Natterer 6d6efbbf8b app: remove "remove_children" parameter from gimp_image_item_list_filter()
It was always TRUE. The function should be renamed now, but not until
the merging of linked item fixes to 2-8 is done.
2015-06-20 21:59:37 +02:00
Michael Natterer 64b24d169d app: remove "remove_locked" parameter from gimp_image_item_list_filter()
This is just removal of unused code before fixing bug 735906.
2015-06-20 16:03:40 +02:00
Michael Natterer 09cd5f6720 app: add ICC data/length parameters to gimp_layer_new_from_gegl_buffer()
and pass them where we know the buffer could be from another image.
Pass "NULL, 0" if we know it's the same image.

Add gimp_layer_new_convert_profile() which takes the newly created
layer and the ICC data/length; call it from both
gimp_layer_new_from_gegl_buffer() and gimp_layer_new_from_pixbuf().

gimp_layer_new_convert_profile() is empty, this is just
infrastructure.
2015-06-20 00:39:44 +02:00
Michael Natterer 6446c007cf app: rename gimp_layer_new_from_buffer() to gimp_layer_new_from_gegl_buffer()
and add new function gimp_layer_new_from_buffer() which takes a
GimpBuffer. This will make sense soon :)
2015-06-20 00:02:11 +02:00
Michael Natterer 7d4948b190 app: use gimp_create_image_from_buffer() to create the debug image graph 2015-06-19 23:49:41 +02:00