The actual algorithm is still the same sick algorithm that was used
before. But instead of iterating the mask row-by-row and filling
it in small spans, we now use one pixel_regions_process() loop to
process the whole mask. Makes a significant difference for large
elliptical selections.
Remove gimp_channel_add_segment() and gimp_channel_sub_segment()
as they are not needed any longer and were responsible for the
bad performance.
Solved a bug in the bilinear interpolated brush transform algorithm that
sometimes caused pixel artifacts to appear on brush edges for brushes
rotated 90, -90, -180, 180 degrees.
Make sure the duplicated group layer actually has a properly set up
tile manager taken from its projection, and not just a dumb copy of
the original group's tiles. Also optimizes away useless calls to
gimp_group_layer_update_size().
(gimp_image_merge_visible_layers): merge the visible layers in the
active layer's group. We can't possibly merge across different groups
anyway because there is no logical place to add the merged layer.
Moreoever, this change makes the group behave more like a sub-image,
which is our metaphor anyway.
There is no reason to disallow this, the merged-down group layer will
simply disappear from the image just as a normal layer, and its
projection composited with the layer below.
(gimp_group_layer_duplicate): change the allowed type of the duplicate
from GIMP_TYPE_GROUP_LAYER to GIMP_TYPE_DRAWABLE. The former was
simply a braino when copying and modifying the GimpLayer code.
* app/core/gimpdrawable.[ch]: add "gboolean push_undo" to
GimpDrawable::convert_type().
* app/core/gimpdrawable-convert.[ch]: same here for the gray and rgb
conversion functions.
* app/core/gimpchannel.c
* app/core/gimplayer.c: pass FALSE when called from GimpItem::convert()
because it can be called on unattached items only.
* app/core/gimpimage-convert.c: pass TRUE.
* app/core/core-enums.[ch]
* app/core/gimpgrouplayerundo.[ch]
* app/core/gimpimage-undo-push.[ch]: add GIMP_UNDO_GROUP_LAYER_CONVERT
which simply calls gimp_drawable_convert_type() with the old type
when undone/redone.
* app/core/gimpgrouplayer.c: push a group layer convert undo so this
can be properly undone/redone.
Needed because a group layer's projection can have a different type
than its image, at least at some pathologic moment during image type
conversion. But even if it didn't, it's cleaner this way anyway.
* app/core/gimpprojectable.[ch]: add the new vfunc plus public API.
* app/core/gimpprojection.c: use it instead of using the type of the
image returned by gimp_projectable_get_image(). The get_image()
function is now unused in the projection and only needs to stay
because the projection is also a GimpPickable.
* app/core/gimpgrouplayer.c: implement GimpProjectable::get_image_type().
Move pixel conversion code from gimp_layer_convert() to the new
gimp_layer_convert_type() implementation and call
gimp_drawable_convert_type() from convert(). In convert_type(), simply
chain up to convert to gray and rgb and only implement indexed
conversion ourselves.
This may look like duplication of GimpItem::convert() but in fact will
fix the longstanding uglyness that GimpItem::convert() both transfers
an item to another image *and* converts the image type of drawables.
When this refactoring is done, GimpItem::convert() will only move an
item to another image, and its implementation in GimpDrawable classes
will call GimpDrawable::convert_type() to convert the pixels to
whatever format.
Takes a "dest_image" parameter anyway because for converting to
indexed we need the destination colormap. The default impl in
GimpDrawable can only convert to gray and rgb however.
Don't blindly fill the dest region's alpha channel even if it has
none. Fixes longstanding bug that made things without alpha dropped
to indexed images to arrive broken.
The new functions reall convert the drawable this time, using the
previously renamed convert_tiles functions. Remove tile manager
fiddling from all callers and leave it there only for converting to
indexed.
Rename them from gimp_drawable_convert_foo() to
gimp_drawable_convert_tiles_foo() because they don't convert the
drawable itself, they convert its tiles into passed-in tiles.
* app/core/gimpgrouplayer.[ch]: add gimp_group_layer_suspend_resize()
and gimp_group_layer_resume_resize() and call them around functions
where all a group's children are transformed (translated, resized
etc). This way we go from the worst case of reallocating the
group's projection tiles once for each child down to exactly one
reallocation.
* app/core/Makefile.am
* app/core/core-enums.[ch]
* app/core/core-types.h
* app/core/gimpimage-undo-push.[ch]
* app/core/gimpgrouplayerundo.[ch]: add new undo class
GimpGroupLayerUndo which implements undos for suspend/resume of
group layers and calls them in reverse order when undoing.
When the projectable's size or image type changes, stop the idle
renderer and remove all queued update area because everything needs to
be re-rendered anyway. Also honor the projectable's offset when
invalidating the entire projection after clearing the pyramid.
The optimization here which would change only the group layer's offset
if the extents of the union of its children has not changed is
completely bogus. That case can only happen if one of the chldren was
moved in a way that does not change the extents of all children's
union, but this doesn't mean that the childrens' positions relative to
each other have not changed.
Instead, invalidate the entire projection to at least avoid constant
reallocation of the tile pyramid.
Found by group layer testing hero Tobias Jakobs.
(will have to optimize real translations of the entire group (or of the
only child in the group) differently)
Having a function that only abstracts whether there is an active
layer or not is pretty useless. This also doesn't make the code in
selection_generate_segs() more complex but rather more obvious.
When attaching/detaching a floating selection to/from its drawable,
connect/disconnect the floating selection's "update" signal and update
the drawable in the callback, because changes to the floating
selection affect the drawable and not the projection directly. Fixes
floating selection compositing in layer trees and is the right thing
to do anyway.
The opposite of gimp_item_get_path(), just that it doesn't return an
item, it returns a parent item and an index that can be used to add
the item to an item tree.
Use the new API whenever we want to determine the item's effective
lock state (whether we can write to the item's content or not). Use
gimp_item_get_lock_content() only in code that actually deals with
*this* item's locked state, which is only the PDB wrappers and GUI to
modify the flag on the item itself.
Begin to consider GimpObject::name as private and always use
gimp_object_get_name(). Change gimp_object_get_name() to take an
untyped pointer so we don't have to do so awfully many casts. There is
a runtime check for the type inside the function anyway.
Make sure a group layer really emits all needed size change signals
when children get added and removed, so the group layer above it can
also update itself based on these signals. Spotted (again) by tobi.
Now that group layers properly implement GimpItem::resize(), ::flip(),
::rotate() and ::scale(), we can go back to just transforming the
toplevel container of layers in the image. Left in and/or added some
special cases anyway, like when resizing sets of layers along with the
image is requested.
The only purpose of this change is to avoid having the "update"
signal twice on GimpGroupLayer (from GimpDrawable and from
GimpProjectable). Switch back to normal g_signal_connect()
in the projection.
This also (really this time) fixes nested group layers. There were
cases when the outer group layer didn't properly resize itself because
gimp_drawable_set_tiles() on the inner group layer failed to emit
notify::width and notify::height.
Sets the "width" and "height" properties and emits notifications and
"size-changed" if anything has changed. This in only to be used by
functions that actually resize the item, it does not scale/resize
anything.
* make internal merge functions aware of the container to merge and
its parent layer.
* git rid of some cruft in gimp_image_merge_down().
* merge down works within one container (naturally) and needs:
- the uppper layer not to be a group
- the lower layer to be writable
* fix action sensitivity accordingly.
Don't recursively duplicate all items. Instead, just duplicate the
items in the toplevel image containers, because group items duplicate
their children correctly all by themselves.
New function takes a GList of items as returned by
gimp_image_item_list_get_list() and can filter out items that:
- have lock_content set to TRUE.
- are children of items that are also in the list (to avoid
transforming group items *and* their children, because
the group items already do that for us).
Insert a gegl:translate node into the group layer's projection
graph. Produces identical results as the legacy projection now, but is
not yet switched on by checking View->Use Gegl.
Add implementations for GimpItem::translate(), scale(), resize(),
flip(), rotate() and transform(). Simply transform all children, the
group layer will automatically update itself. Also transform the layer
mask.
Implement the GimpProjectable interface and keep a GimpProjection
around that projects the GimpDrawableStack of our children. Propagate
the childrens' "update" signals to our own "update" signal so our
parent projection picks up all changes.
Add/Subtract the projectable's offset whenever we go from coordinates
from our public interface (which are always image coordinates) and
coordinates in out internal tile pyramid (wihch always starts at 0,0).
The Gegl projection still needs an offset node that is missing.
Also, connect to the projectable's "update" signal using
g_signal_connect_closure_by_id() instead of simply g_signal_connect(),
so we really connect to the signal of the GimpProjectable interface
and not to the "update" signal of GimpDrawable (which is a conflict
that will happen on group layers).
Add GimpProjectable::get_offset() and gimp_projectable_get_offset()
which returns the offset of the projectable in image coordinates, so
we can have projections that act as a viewport onto things that live
in image coordinates.
Add gimp_item_can_lock_content() and gimp_layer_can_lock_alpha() which
return TRUE unless the item is a grop (has children), because group
items will be considered to have lock_content always TRUE and
lock_alpha always FALSE.
Took patch from Martin Nordholts and ported it to add a "lock-content"
property, signal and API in the same way as it's done for "visible"
and "linked".
Add support for having obsolete data resources. An obsolete resource
is not shown in the UI or managed in any way, but it will be
considered when plug-ins requests resources. This in order to maintain
backwards compatibility for plug-ins.
Don't reuse the GeglProcessor as it can't handle dirty rects when
painting in GIMP, and this makes it harder to make GEGL-wise progress
in other parts of GIMP.
* app/core/gimpimage.[ch]: rename all gimp_image_reposition_foo() to
gimp_image_reorder_foo() and added "new_parent" parameters. Factor
out calculating of the item's new container and index to a utility
function.
* app/core/core-enums.[ch]: rename the REPOSITION undos to REORDER.
* app/core/gimpimage-undo-push.[ch]
* app/core/gimpchannelpropundo.[ch]
* app/core/gimplayerpropundo.[ch]
* app/vectors/gimpvectorspropundo.[ch]: change accordingly. Remember
the old parent item in all item reorder undos.
* app/widgets/gimpitemtreeview.h: change GimpReorderItemFunc prototype
accordingly.
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpvectorstreeview.c (class_init): follow image API
name changes.
* app/widgets/gimpitemtreeview.c (gimp_item_tree_view_drop_viewable):
implement reordering of items between groups.
* app/widgets/gimpcontainertreeview.c
(gimp_container_tree_view_reorder_item): fix to reorder the item
within its level of the tree (unrelated to above changes, but needed
to make them work).
The new functions figures if one viewable is another's parent or
grandparent or grandgrand... Note that unlike gtk_widget_is_ancestor(),
this function has its parameters in the right order.
A tree-enabled replacement for gimp_container_add,remove_handler(),
slightly more sane to a degree that makes me think it could replace
GimpContainer's own handler stuff. Public API consists of two
function:
- gimp_tree_handler_connect() which connects recursively to a specific
signal of all items in a container tree.
- gimp_tree_handler_disconnect() is just a wrapper around unrefing the
handler, but makes sure that dispose() is really executed (which
actually disconnects things).
* app/core/gimpimage.h: add define GIMP_IMAGE_ACTIVE_PARENT for magic
the value ((gpointer) 1) which can be passed as parent item to
add_layer(), add_channel() and add_vectors().
* app/core/gimpimage.c: add utility function
gimp_image_get_insert_pos() which honors above new special value and
figures all of parent container, parent item and insert position.
Remove lots of duplicated code from add_layer(), add_channel() and
add_vectors().
* app/core/gimpimage.[ch]: make the parent parameter public in
add_layer(), add_layers(), add_channel() and add_vectors().
* app/vectors/gimpvectors-import.[ch]: add parent parameters to
the vectors import functions.
* app/core/gimpchannelundo.[ch]
* app/core/gimplayerundo.[ch]
* app/vectors/gimpvectorsundo.[ch]
* app/core/gimpimage-undo-push.[ch]: remember the parent item when
removing layers, channels and vectors.
* app/actions/channels-commands.c
* app/actions/debug-commands.c
* app/actions/edit-commands.c
* app/actions/layers-commands.c
* app/actions/vectors-commands.c
* app/core/gimp-edit.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-quick-mask.c
* app/core/gimplayer-floating-sel.c
* app/core/gimpselection.c
* app/core/gimptemplate.c
* app/dialogs/file-open-dialog.c
* app/display/gimpdisplayshell-dnd.c
* app/text/gimptext-compat.c
* app/tools/gimptexttool.c
* app/tools/gimpvectortool.c
* app/widgets/gimptoolbox-dnd.c
* app/xcf/xcf-load.c
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/paths.pdb
* tools/pdbgen/pdb/vectors.pdb: pass NULL as parent item to above
functions and add FIXMEs all over the place because there is some
more hacking needed to make adding with index = -1 (on top of the
current item) work again.
* app/pdb/image-cmds.c
* app/pdb/paths-cmds.c
* app/pdb/vectors-cmds.c: regenerated.
* app/core/gimpimage-duplicate.c: duplicate the original image's
tree structure in the copy.
* app/widgets/gimpitemtreeview.[ch]: add parent to GimpAddItemFunc,
add utility function gimp_item_tree_view_get_drop_index() which
figures where to add something dropped to an item tree.
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpvectorstreeview.c: changed accordingly, using above
new GimpItemTreeView API.
Use gimp_image_get_layer,channel,vectors_list() instead of
gimp_image_get_layer,channel,vectors_iter(). As a side-effect,
simplified some code that was making sure we don't modify the list
returned by the old functions (the new functions return newly
allocated lists so we can safely remove items from the image while
iterating it). Some places will need adjusting once we really have
item trees.
Change gimp_image_add,remove_layer,channel,vectors() to deal with
parent items and insert/remove things to/from the right containers.
The "parent" parameter to the add_foo() functions is currently a local
variable that defaults to NULL, so nothing has chaged yet.
This is just a utility function like gimp_image_get_layer_iter()
in order to avoid including "core/gimplist.h" whenever a file needs
access to the actual GList inside the container.
* app/core/gimpitemstack.[ch]: add gimp_item_stack_get_item_list()
which returns a GList of all the stack's items, in depth-first
order if the stack is in fact a tree.
* app/core/gimpimage.[ch]: add gimp_image_get_layer_list(),
channel_list(), vectors_list() which use above new function.
Don't use image->layers, ->channels and ->vectors in the raise, lower
and position functions; use gimp_item_get_container() and
gimp_item_get_index() instead.
* app/core/gimpitem.[ch]: add virtual function ::get_container() plus
pubic API wrapper which returns the children of the item's parent
viewable, or the right toplevel container of its image.
Add utility function get_index() which returns the item's index
within its container.
* app/core/gimpchannel.c
* app/vectors/gimpvectors.c: implement get_container() and return
the right image container.
* app/core/gimplayer.[ch]: same here, and remove previously added
public get_container() API.
* app/core/gimplayermask.c
* app/core/gimpselection.c: implement get_container() for these GimpChannel
subclasses and return NULL.
The new function returns a layer's container, which is either its
parent viewable's children, or image->layers. Scheduled for being
moved to a virtual function on GimpItem.
- add member "GimpViewable *parent" and accessors to get/set it
(no property or signals yet)
- add virtual function ::get_children() which is supposed to return
a GimpContainer of the viewable's children
Get rid of artificial compiler warnings generated with the #warning
directive. They pollute the build output and don't work as incentives
for fixing stuff.
Since save and export are separate activities we need to keep track of
image dirtiness for both of them. For this purpose, add a
'export_dirty' member to GimpImage which has the same semantics as
'dirty', but for export. Set it to clean whenever a document is
exported by whatever means. Do this with a new function
gimp_image_export_clean_all(). Also add gimp_image_is_export_dirty().
Reuse the GeglProcessor instead of creating a new one in each call to
gimp_projection_construct_gegl(). Requires at least 0ed57a05da of
GEGL. Does not seem to give any performance improvement at all
unfortunately :(
* app/core/gimpmarshal.list: add marshallers needed for the binding
singnals.
* app/tools/gimptexttool.[ch]: add binding signals "move-cursor",
"delete-from-cursor" and "backspace" and hijack GtkTextView's
binding set to invoke them. Move code from the key_press() handler
to the signals' default handlers. This is how it should work. In
fact that code is #ifdef'ed away and we need an evil proxy
GtkTextView to invoke the bindings on because of reasons stated in
comments in the code. Ugly but works just fine.
(gimp_projection_validate_tile): fix stupid braino that made the
recently added optimization loop infinitely on images with a width
that is a multiple of TILE_WIDTH.
(gimp_drawable_transform_affine)
(gimp_drawable_transform_flip)
(gimp_drawable_transform_rotate): also transform the layer mask if we
are transforming a layer and there is no selection (which causes the
entire layer to be transformed).
2009-03-19 Sven Neumann <sven@gimp.org>
Bug 471681 – Keyboard shortcuts for brush size/params need
feedback
* app/core/gimpbrushgenerated.c
* app/core/gimpcontext.c
* app/paint/gimppaintoptions.c: applied patch from Stephen G.
that
marks some strings for translation.
svn path=/trunk/; revision=28182
2009-03-03 Sven Neumann <sven@gimp.org>
Bug 520078 – Rotate brushes
* app/core/gimpbrush-transform.c: applied patch from Tal that
improves bilinear interpolation for the brush transformations
and
fixes a bug in the calculation of the transformation matrix.
svn path=/trunk/; revision=28098
2009-03-02 Michael Natterer <mitch@gimp.org>
* app/core/gimptagged.[ch]: add gimp_tagged_set_tags() which
takes a GList of tags.
* app/widgets/gimptagentry.c (gimp_tag_entry_assign_tags): use it.
(gimp_tag_entry_item_set_tags): remove.
svn path=/trunk/; revision=28094
2009-02-28 Sven Neumann <sven@gimp.org>
Bug 520078 – Rotate brushes
* app/core/gimpbrush-transform.c: applied patch from Tal that
implements bilinear interpolation for the brush transformations.
svn path=/trunk/; revision=28078
2009-02-14 Sven Neumann <sven@gimp.org>
Bug 99457 – Support for dynamics on tilt
* app/core/gimpbrush.[ch]
* app/core/gimpbrushgenerated.c
* app/core/gimpbrush-transform.[ch]
* app/paint/gimpbrushcore.c
* app/paint/gimpsmudge.c: applied patch from Alexia Death,
separates brush scaling for x and y.
svn path=/trunk/; revision=28036
2009-02-14 Sven Neumann <sven@gimp.org>
* app/core/gimpcoords-interpolate.c
* app/display/gimpdisplayshell-coords.c: applied patch from
Alexia
Death that fixes issues with the new stroke direction code
(bug #520078).
svn path=/trunk/; revision=28030
2009-02-14 Sven Neumann <sven@gimp.org>
Bug 472644 – Rotate with clipping crops the whole layer
* app/core/gimp-transform-resize.c: applied patch as attached to
bug #472644. Supposedly fixes the problem of the disappearing
image.
svn path=/trunk/; revision=28029
2009-02-13 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.c (gimp_drawable_sync_source_node): need
to rip the floating selection's source node out of its layer's
graph before using it in the floating selection sub-graph, and
need to plug it back there when it's not a floating selection any
longer.
Unrelated:
Also introduce a "fs_crop_node" that makes sure the floating
selection stops at the drawable's boundaries.
(gimp_drawable_visibility_changed): use item->node instead of
gimp_item_get_node() because the latter creates the node on
demand.
* app/core/gimpdrawable-private.h: add fs_crop_node member.
svn path=/trunk/; revision=28022
2009-02-11 Sven Neumann <sven@gimp.org>
* app/core/gimpcoords-interpolate.c
(gimp_coords_interpolate_catmull): applied patch from Alexia
Death
that fixes a bug that was introduced by the last commit.
svn path=/trunk/; revision=28013
2009-02-10 Sven Neumann <sven@gimp.org>
* app/core/gimpcoords-interpolate.c
* app/core/gimpbrush-transform.c
* app/paint/gimppaintoptions.c
* app/display/gimpdisplayshell-coords.c: applied patch from
Alexia
Death that fixes the direction of brush rotation (bug #520078).
svn path=/trunk/; revision=28010
2009-02-08 Michael Natterer <mitch@gimp.org>
Bug 520078 – Rotate brushes
Applied a slightly modified patch from Alexia Death:
* app/core/core-types.h (struct GimpCoords): add "direction" member.
* app/core/gimpcoords.c: take direction into account in mix(),
scalarprod(), length_squared(), manhattan_dist() and equal().
* app/core/gimpcoords-interpolate.c
(gimp_coords_interpolate_catmull): same here.
* app/display/gimpdisplayshell-coords.c
(gimp_display_shell_eval_event): same here.
* app/paint/gimppaintoptions.[ch]: add properties for direction
dynamics and adapt dynamics mixing accordingly.
* app/paint/gimpbrushcore.c (gimp_brush_core_interpolate):
"interpolate" direction too (in fact, just copy it from
last_coords since it doesn't change along a straight line).
* app/paint/gimppaintcore-stroke.c
(gimp_paint_core_stroke_emulate_dynamics): emulate direction too.
* app/tools/gimppaintoptions-gui.c: add GUI for direction dynamics.
svn path=/trunk/; revision=28001
2009-02-07 Michael Natterer <mitch@gimp.org>
Simplify floating selection handling a bit more:
* app/core/gimpdrawable.c
(gimp_drawable_attach_floating_sel)
(gimp_drawable_detach_floating_sel): call
gimp_image_set_floating_selection() from these functions.
* app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop)
* app/core/gimpimage.c (gimp_image_add,remove_layer)
* app/core/gimplayer-floating-sel.c (floating_sel_to_layer): don't
call it here because we already call above functions.
svn path=/trunk/; revision=28000
2009-02-07 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.c
(gimp_drawable_attach_floating_sel)
(gimp_drawable_detach_floating_sel): call
gimp_drawable_invalidate_boundary(floating_sel). Fixes missing
selection update after turning a floating selection into a
layer. It's called redundantly now when adding or deleting a
floating selection, but that doesn't hurt much.
* app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop):
don't call it here because we already call above functions.
svn path=/trunk/; revision=27999
Move undo tiles updating into a helper function
gimp_image_map_update_undo_tiles() so the logic of
gimp_image_map_apply() becomes clearer.
svn path=/trunk/; revision=27997
Introduce and use a local helper function
gimp_image_map_kill_any_idle_processors() to get a rid of some code
duplication.
svn path=/trunk/; revision=27996
Introduce and use a local helper function
gimp_image_map_cancel_any_idle_jobs() to get a rid of some code
duplication.
svn path=/trunk/; revision=27995
2009-02-05 Sven Neumann <sven@gimp.org>
Bug 520078 – Rotate brushes
Applied patch from Alexia Death:
* app/core/gimpbrush.[ch]
* app/core/gimpbrushgenerated.c
* app/core/gimpbrush-transform.[ch]: affine transformations for
brushes. So far only scaling and rotation is supported. The
transformation is done using nearest-neighbour. This is a
regression and we need to add back interpolation before the next
release.
* app/paint/gimpsmudge.c
* app/paint/gimppaintoptions.[ch]
* app/paint/gimpbrushcore.[ch]: allow to control the brush
rotation angle.
* app/tools/gimppaintoptions-gui.c
* app/tools/gimpbrushtool.c: added UI for controlling the
brush rotation angle.
* app/actions/tools-actions.c
* app/actions/tools-commands.[ch]: add actions for controlling
the
brush rotation angle.
svn path=/trunk/; revision=27987
2009-02-05 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.h
* app/core/gimpdrawable-preview.c: move the preview related
members to the private struct.
* app/core/gimpdrawable.c
* app/core/gimpdrawable-private.h
* app/core/gimpselection.c: changed accordingly.
svn path=/trunk/; revision=27986