Commit Graph

495 Commits

Author SHA1 Message Date
Michael Natterer ef4ab94a12 app: change GimpDrawable::convert_type() to take a target profile
instead of just a boolean "convert_profile". This takes the logic to
figure the right target profile out of gimp_layer_convert_type(), it
can't possibly know everything about how to convert anyway, and having
the logic in the callers conveniently splits it up and distributes its
parts to the places they belong.

This commit should cause no behavor change and is just preparation for
fixing bug 765176.
2016-04-30 18:35:52 +02:00
Michael Natterer f34aa5fa6b Bug 756389 - Color-managing grayscale images
Rename profile constructors to say "d65_gray" instead of just "gray",
"srgb_trc" instead of "srgb_gamma", and drop the "srgb" from
"srgb_linear" because we now say "d65". This should be a naming scheme
that doesn't conflict with whatever future functions we might add.
2016-04-09 18:47:51 +02:00
Michael Natterer b3dbb968c9 app: correctly deal with color profiles when converting from/to GRAY
Convert the layers to the new GimpImageBaseType's builtin color
profile because the converted image will have its color profile
removed.
2015-12-25 23:07:26 +01:00
Michael Natterer 11e8cacf7e Bug 756389 - Color-managing grayscale images
Support creating linear/sRGB-gamma variants of gray profiles and
rename gimp_color_profile_new_linear_rgb_from_color_profile() to
gimp_color_profile_new_linear_gamma_from_color_profile() because it's
not RGB-specific any longer.
2015-12-13 23:36:31 +01:00
Jehan eb7d634a45 app: replacing tabs with spaces in gimplayer.c. 2015-11-11 15:19:45 +01:00
Michael Natterer ac1c6d7864 app: add progress reporting to gimp_drawable_convert_type()
so it doesn't sit there appearing to do nothing while converting an
image with profile to gamma/linear.
2015-10-21 22:22:30 +02:00
Michael Natterer ecd4752072 Bug 751553 - Linear precision doesn't display the image correctly
When converting and image with a color profileimage between linear and
gamma, create a new profile using the new API in GimpColorProfile,
convert the layers to that profile and tag the image with the new
profile.

If creating a new profile fails, convert to the right builtin profile
(linear rgb or sRGB from GimpColorProfile), but that code should be
considered a fallback that will be prevented from happening in the
convert dialog (at least the user will be informed).
2015-10-20 23:53:47 +02:00
Michael Natterer 69abd4d972 app: add progress handling to gimp_gegl_convert_color_profile,transform() 2015-10-19 01:29:22 +02:00
Michael Natterer 616c57b8cf Bug 478528 - Layer and Image previews are not color managed
Fix color managed layer previews when adding/removing alpha:

Implement GimpDrawable::alpha_changed() in GimpLayer and emit
GimpColorManaged::profile_changed() so all cached color transforms are
nuked.
2015-09-21 20:30:15 +02:00
Michael Natterer 4479cedf13 app: rename mask enum values GIMP_COMPONENT_RED,GREEN,BLUE etc.
to GIMP_COMPONENT_MASK_RED,GREEN,BLUE etc.
2015-09-07 00:35:02 +02:00
Michael Natterer b45d31072b app, libgimpcolor: refactor GimpColorManaged::get_color_profile()
to not return a reference that has to be dropped. Also allow NULL to
be returned if the managed cannot have a profile. If it can have one,
get_color_profile() still always returns a profile (either the
assigned one, or a generated built-in one).
2015-09-03 01:36:02 +02:00
Michael Natterer 7c95676f88 app: implement the GimpColorManaged interface in GimpLayer
and change GimpImage and GimpItemStack to emit the "profile-changed"
signal when the image's profile changed. Also connect GimpViewRenderer
to "profile-changed" if the viewable is a GimpColorManaged and
invalidate the preview.
2015-09-03 00:21:40 +02:00
Michael Natterer 76ff1c1584 Revert "app: add ::get_color_profile() to GimpPickable and GimpProjectable"
This reverts commit 5c8ffdf6c5.

It was a bad idea, we have the GimpColorManaged interface for that.
2015-09-03 00:21:09 +02:00
Michael Natterer 5c8ffdf6c5 app: add ::get_color_profile() to GimpPickable and GimpProjectable
which currently all end in a call to gimp_color_managed_get_color_profile()
except for channels and masks. This is currently unused infrastructure but
will be used for things like layer previews, and return NULL if called
on a mask or channel, or if color management is disabled, or whatever.
2015-09-01 22:27:31 +02:00
Michael Natterer 216da3b5e2 Bug 754297 - Show Layer Mask should not use the layer blend mode
Call gimp_layer_update_mode_node() also when removing a mask, and
change it to only do its magic if there actually is a mask (don't only
look at the "show_mask" boolean).
2015-09-01 10:27:43 +02:00
Michael Henning bb9170bdbf Bug 754297 - Show Layer Mask should not use the layer blend mode 2015-08-30 14:10:43 -04: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 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 db09d0f3d3 app: move functions to create layers to new files gimplayer-new.[ch] 2015-06-17 13:21:01 +02:00
Michael Natterer 9f9865afb8 app: fix the build with MyPaint brushes enabled, and some formatting foo 2015-05-25 02:15:03 +02:00
Øyvind Kolås 7e6320497e follow gegl api changes from commit af5361ca8d, with an abyss policy argument
to gegl_buffer_copy.
2015-05-25 01:27:31 +02:00
Michael Natterer 909c4b4084 app: add a GimpCpmponentType parameter to GimpDrawable::estimate_memsize()
so we can also estimate converting the drawable to other precisions.
2014-06-14 23:12:22 +02:00
Michael Natterer d1b8a715c2 app: ref/unref layer->fs.drawable in gimp_layer_set_floating_sel_drawable()
It always felt wrong not to ref it, but now it started crashing. Dunno
what exactly has changed, but for example the "Weave" script was
triggering it.
2014-05-20 23:39:53 +02:00
Michael Natterer 23037b5230 app: convert all stock IDs kept around by the core by icon names
Particularly GimpViewable's stock_id. Make sure old config files
containing stock IDs are still properly parsed.
2014-05-07 01:01:56 +02:00
Michael Natterer 22c222291d libgimpbase,*: clean up enum values in gimpbaseenums.h
GIMP_ADD_foo_MASK -> GIMP_ADD_MASK_foo
GIMP_foo_MODE -> GIMP_BLEND_foo
GIMP_foo_CLONE -> GIMP_CLONE_foo
GIMP_foo -> GIMP_DODGE_BURN_TYPE_foo
GIMP_foo -> GIMP_TRANSFER_foo

Add compat values for the old names and compat code to script-fu
and pygimp.
2014-04-29 20:58:30 +02:00
Massimo Valentini 9498cc615d Bug 722676: Pasting image from clipboard sometimes does not work.
Change gimp_pixbuf_create_buffer() to copy the pixels if a linear
buffer cannot be created. Add functions that convert between
GimpTempBuf and GdkPixbuf. Fix users of gimp_pixbuf_create_buffer()
to make the least possible copies. Patch modified by Mitch.
2014-02-23 00:49:56 +01:00
Michael Natterer f33d11b99c app: keep the layer mode node's "linear" property up-to-date
Implement GimpDrawable::set_buffer() and update the mode node if
the layer's "linear" property has changed.
2013-06-29 23:34:12 +02:00
Michael Natterer 3b68ae0f3c app, pdb, libgimp: Remove all traces of the supersampling recursion level
from all transform APIs. This is no longer used since we use GEGL to
transform, the value was only passed around and never used.
2013-05-31 01:15:32 +02:00
Michael Natterer 9c93df2d4b app: add gimp_drawable_get_linear() which currently always returns FALSE
Add "linear" parameter to GimpApplicator. Pass the drawable's "linear"
to the applicator, and to all calls to gimp_gegl_mode_node_set_mode(),
instead of hardcoding FALSE everywhere.
2013-04-27 08:41:06 +02:00
Michael Natterer a93eaa9122 app: set paint_mode and opacity separately on mode nodes
so we don't constantly change the operation only because the opacity
varies during painting.
2013-04-22 22:53:07 +02:00
Michael Natterer 4ca746eab7 app: move the "is-last-node" property and API from drawable to filter 2013-04-11 12:25:11 +02:00
Michael Natterer 45a6ea432c app: add new class GimpFilter as parent class of GimpItem
and move the item's GeglNode API there. The purpose of this is to
factor out "gimp object that manages a node".
2013-04-11 12:25:10 +02:00
Michael Natterer c914aa805d Bug 675747 - Layers with some modes get hidden in layer groups
Add a boolean "is-last-node" property to GimpDrawable and set it from
GimpDrawableStack, which is the place that easily has the information.
In GimpLayer, connect to "notify" and make sure we use NORMAL mode
unless the layer is in NORMAL or DISSOLVE mode.
2012-11-12 10:55:41 +01:00
Michael Natterer 435df29d85 app: add utility functions for applying specific operations to buffers
so gimp_gegl_apply_foo() will run "gegl:foo" with the required
properties on a buffer and write the result to another buffer.
2012-10-31 23:47:45 +01:00
Michael Natterer ca4dadefa4 app: remove gimp_drawable_apply_operation_to_buffer()
it was a completely silly wrapper. Use gimp_gegl_apply_operation()
directly instead.
2012-10-22 16:14:56 +02:00
Michael Natterer eb89a545d5 app: move core/gimp-apply-operation.[ch] to gegl/gimp-gegl-apply-operation.[ch] 2012-10-22 16:03:40 +02:00
Michael Natterer 60305c11d5 app: add "const Babl *new_format" to GimpDrawable::convert_type()
but only to the virtual function, not the public API. Implement it in
GimpSelection and GimpLayerMask, and pass the correct mask format down
to the parent class which does the actual conversion.
2012-10-13 22:56:32 +02:00
Michael Natterer 5dbcdef477 app: implement optional dithering when converting to lower bit depth
Add "layer_dither_type" and "mask_dither_type" to
GimpDrawable::convert_type(), pass around the dither type from the
dialog, and implement dithering using gegl:color-reduction.
2012-10-13 21:46:56 +02:00
Massimo Valentini 82af5731fa app: small typo
gimp-2.9 used to print:

(gimp-2.9:3): GEGL-gegl-node.c-WARNING **: gegl_node_pads_exist:
   Can't find source property outout of gegl:translate 0x10cbde10

before crashing
2012-07-07 16:18:48 +02:00
Michael Natterer 373a4e7469 app: completely remove TileManager and friends (base/ and paint-funcs/)
And along with it a lot of stuff like the drawable preview cache, the
gegl tile manager backend, temporary gimp_gegl_buffer_foo() stuff, and
the remaining bits of performance.

The projection is in an evil semi-ported state which makes it work
ok-ish for stuff like layer moving, but absolutely unbearable for
painting, there is also an off-by-one rendering glitch at some zoom
levels.
2012-06-20 21:44:09 +02:00
Michael Natterer 4dcd1f3ad4 app: use plain gegl_buffer_new() and _dup(), not the gimp_gegl_ variants
unless the buffers end up being drawable->buffer.
2012-05-20 22:02:59 +02:00
Michael Natterer d294cfb8b2 app: remove the legacy projection construction code 2012-05-19 00:06:03 +02:00
Michael Natterer 83a728f492 app: rename gimp_gegl_node_set_layer_mode() to gimp_gegl_mode_node_set()
and have it set mode and opacity at the same time, so we don't reset
opacity each time we set the mode.
2012-05-18 23:50:35 +02:00
Michael Natterer 4699725821 app: port floating selection blending to the new mode ops
Also, remove the fallback layer mode code from GimpOperationPointLayerMode,
and pass premultiplied = FALSE to gimp_gegl_node_set_layer_mode().
2012-05-18 23:37:56 +02:00
Ville Sokk e377eb01cd app: modified gegl blending modes to take mask and opacity inputs 2012-05-18 22:52:48 +02:00
Michael Natterer efa52edf6e app: change the layer's graph to expect mode operations with mask inputs
and opacity inputs. Add two offset nodes for both layer and mask, and
plug everything directly into the mode node.
2012-05-18 18:57:58 +02:00
Michael Natterer c73bcac2d0 app: create the offset node in GimpLayer, and manage its offset in GimpItem 2012-05-15 22:25:12 +02:00
Michael Natterer c3e933b7b2 app: always use gimp_item_peek_node() to check if the item has a graph
instead of checking different things in each item subclass, which is
confusing to the reader.
2012-05-15 21:57:40 +02:00
Michael Natterer 4d1173570a Bug 676107 - Picking logic doesn't take group visibility into account
gimp_layer_get_opacity_at(): use gimp_item_is_visible() not
get_visible() so we use the layer's effective visibility.
2012-05-15 19:46:47 +02:00
Michael Natterer 20f3cba2b6 app: rename gimp_image_base_type() to gimp_image_get_base_type() 2012-05-07 21:57:33 +02:00
Michael Natterer 94da46c373 app: add precision argument to gimp_image_get_format()
and use it instead of gimp_babl_format() in some places where indexed
formats can occur. Also fix some places using gimp_babl_format() to
special case indexed formats correctly.
2012-05-07 21:46:47 +02:00
Michael Natterer 3ad73b3658 libgimpcolor: add GdkPixbuf <-> GeglBuffer utility functions
and update tons of includes in libgimp and app.
2012-05-03 03:37:20 +02:00
Michael Natterer d81ea1315e app: implement active, affected components in GEGL
Add GimpOperationMaskComponents, enum GimpComponentMask, and image and
drawable infrastructure to get the right mask, and plug the mask
operation into gimp_gegl_create_apply_buffer_node().
2012-05-02 17:51:17 +02:00
Michael Natterer 17e36e9b3f app: make sure the layer mask's precision gets converted too
when the layer's precision is converted.
2012-05-02 17:51:16 +02:00
Michael Natterer f164069c9c app: remove gimp_drawable_bytes() and ask its format instead 2012-05-02 17:51:16 +02:00
Michael Natterer 96ebc6f848 app: add "new_precision" argument to gimp_drawable_convert_type()
for clarity and consistency with the "new_base_type" argument.
2012-05-02 17:51:15 +02:00
Michael Natterer 0e8a00db8b app: honor precision when copying drawables between images 2012-05-02 17:51:15 +02:00
Michael Natterer 7c271f15fc app: use gimp_image_get_component_format() instead of hardcoding "A u8"
to extract a drawable's alpha channel into a layer mask.
2012-05-02 17:51:09 +02:00
Michael Natterer 3ea0e3f090 app: return double not int from GimpPickable::get_opacity_at()
and fix GimpLayer's impl to honor the mask also for layers without
alpha.
2012-05-02 17:51:07 +02:00
Michael Natterer 9d518677d2 app: remove gimpdrawable-convert.[ch]
This can now be done in gimp_drawable_real_convert_type() with a few
lines of GEGL buffer copying.
2012-05-02 17:51:03 +02:00
Michael Natterer 95cb77edc9 app: change gimp_image_get_format() to take a base_type and a with_alpha boolean
which kills almost all remaining use of GimpImageType.
2012-05-02 17:51:03 +02:00
Michael Natterer feb4b9cfe9 app: fix gimp_layer_new() API docs 2012-05-02 17:51:01 +02:00
Michael Natterer 2b18645fb5 app: use gimp_drawable_get_base_type() instead of GIMP_IMAGE_TYPE_BASE_TYPE() 2012-05-02 17:50:57 +02:00
Øyvind Kolås 6efd812d08 app: s/GIMP_GEGL_RECT/GEGL_RECTANGLE/
Defining GeglRectangle inline is so useful that it has been added to
GEGL.
2012-05-02 17:50:52 +02:00
Michael Natterer eea149d8e5 app: better GEGL code in gimp_layer_create_mask() 2012-05-02 17:46:16 +02:00
Øyvind Kolås f68c3c7051 app: adapt to API changes in GEGL 2012-05-02 17:46:15 +02:00
Michael Natterer be853cd239 app: remove "gboolean linear" from all apply_operation APIs
thes were all unused and we want to get rid of that anyway.
2012-05-02 17:46:13 +02:00
Michael Natterer de0321a82e app: add gimp_gegl_node_set_layer_mode()
and remove all other code that does layer_mode -> node.
2012-05-02 17:46:13 +02:00
Michael Natterer fb74b9e822 app: chnage gimp_gegl_create_apply_opacity_node()'s mask offset
to be the offset *of* the mask, not the offset *into* the mask, also
reorder parameters.
2012-05-02 17:46:12 +02:00
Michael Natterer bfd54a69b7 app: implement "disable layer mask" in the GEGL graph 2012-05-02 17:46:12 +02:00
Michael Natterer a0c1007b66 app: port GimpDrawableUndo, GimpDrawable::push_undo() and ::swap_tiles()
which gets rid of the manual implementation of sparse undo buffers,
but GEGL will take care of proper COW here soo enough.
2012-05-02 17:46:08 +02:00
Michael Natterer f8f4455459 app: change GimpDrawable::set_tiles() to ::set_buffer()
and remove the "type" argument, GeglBuffers have a format.
2012-05-02 17:46:07 +02:00
Michael Natterer 765c2cfea2 app: replace GimpDraable's type by a Babl format
and change gimp_drawable_new() and all gimp_layer_new() variants to
take formats instead of types.
2012-05-02 17:46:06 +02:00
Michael Natterer 9b0634bbd4 app: remove gimp_layer_new_from_tiles(), it's now unused 2012-05-02 17:46:06 +02:00
Michael Natterer b89a912cc7 app: use gimp_drawable_set_buffer() in a few places 2012-05-02 17:46:05 +02:00
Øyvind Kolås f8b1372038 app: make use of GIMP_GEGL_RECT in more places 2012-05-02 17:46:05 +02:00
Øyvind Kolås 84b914ce63 app: fix initialization of variable in gimp_layer_get_opacity_at 2012-05-02 17:46:05 +02:00
Øyvind Kolås fe3220ae6f app: remove write property of GeglBuffer backend 2012-05-02 17:46:05 +02:00
Michael Natterer 0bcae125b5 app: merge gimp_drawable_get_read_buffer() and get_write_buffer()
into get_buffer(). The loss of zero copy will be compensated soon.
2012-05-02 17:46:04 +02:00
Michael Natterer 0053494c18 app: apply patch from Villa Sokk that implements GimpOperationDissolveMode 2012-05-02 17:46:03 +02:00
Michael Natterer e613af7b46 app: implement "show layer mask" in the GEGL graph 2012-05-02 17:46:02 +02:00
Michael Natterer 58dfa962a1 app: port simple rotating and flipping to GEGL
Which requires making the entire copy/paste apparatus aware of the
Babl format of the passed around tile managers.
2012-05-02 17:46:02 +02:00
Michael Natterer 2c62644f94 app: BoundSeg -> GimpBoundSeg, boundary_foo() -> gimp_boundary_foo() 2012-05-02 17:46:02 +02:00
Michael Natterer 9323c2f28c app: move base/boundary.[ch] to core/gimpboundary.[ch]
No other changes yet, just make the move build.
2012-05-02 17:46:02 +02:00
Michael Natterer 1b44953352 app: port bucket fill to GEGL
Add mask offset parameters to gimp_gegl_create_apply_opacity_node()
so it's possible to use a part of the mask only, bucket fill
uses that to avoid uneccessary work where the mask is empty.

Should use the same in gimp_drawable_stroke_scan_convert().
2012-05-02 17:46:01 +02:00
Michael Natterer 066d5d84c9 app: port all implementations of GimpProjectable::get_opacity_at() to Gegl 2012-05-02 17:46:00 +02:00
Michael Natterer e2afb75292 app: use gimp_drawable_apply_operation_to_buffer() in gimp_layer_flatten()
and not gimp_drawable_apply_operation_to_tiles() because that would
guess the wrong Babl format for the new tiles if the image is indexed.
2012-05-02 17:45:58 +02:00
Michael Natterer 9a09d3a762 app: drop "babl" from gimp_foo_get_babl_format[_with_alpha]() 2012-05-02 17:45:58 +02:00
Michael Natterer 744199a8f7 app: remove gimp_layer_new_from_region() and use from_buffer() instead 2012-05-02 17:45:57 +02:00
Michael Natterer 3ce071b89a app: let Babl handle converting layers to indexed
Except of course the initial indexed conversion which needs more logic
than a simple color mapping.
2012-05-02 17:45:57 +02:00
Michael Natterer d146cc40ea app: require a Babl for all buffers created on top of tiles
Fixes quite some introduced glitches with indexed mode because
the buffers use the right pixel format now.
2012-05-02 17:45:56 +02:00
Michael Natterer 88388467cc app: move the layer mask show, edit, apply API from GimpLayerMask to GimpLayer
because it would require really evil hacks to honor these properties
in the gegl projection if they were on the mask, and because they
actually belong to the layer.
2012-05-02 17:45:56 +02:00
Michael Natterer 684f7f167b app: use GimpOperationSetAlpha in gimp_layer_create_mask()
After transferring the layer's alpha to the mask, the alpha needs to
be set to opaque.
2012-05-02 17:45:56 +02:00
Michael Natterer 57985cd26d app: create a meta-op to apply mask and opacity
and use it to apply the layer mask.
2012-05-02 17:45:53 +02:00
Michael Natterer 5c71411502 app: use GEGL to create a layer mask from a grayscale copy of the layer 2012-05-02 17:45:53 +02:00
Michael Natterer a898491b3f app: allow to "cast" a buffer's pixel format to another one
as long as it has the same number of bytes. Add
gimp_tile_manager_create_buffer_with_format() for that purpose,
register a format that contains's only a u8 alpha byte, and use that
to extract alpha from drawables.
2012-05-02 17:45:52 +02:00
Michael Natterer 0ae0dfb52e app: add a flatten meta-op and use it for layers and channels 2012-05-02 17:45:52 +02:00
Michael Natterer 5413949851 app: implement gimp_layer_add_alpha() with gegl_buffer_copy() 2012-05-02 17:45:52 +02:00
Michael Natterer 4d18bda0c7 app: cache readable and writable buffers in the drawable
As API, replace gimp_drawable_create_buffer() by
gimp_drawable_get_read_buffer() and gimp_drawable_get_write_buffer().
2012-05-02 17:45:48 +02:00