
I created a new function gimp_channel_combine_items() which combines a list of items with a channel. The list of items is first combined together as an union set, then only combined with the channel with the desired operation (this is important for operations such as intersect which was broken in my previous commit because all items would be intersected with each other and the selection, whereas we actually want the union of all items to be intersected with the selection). This new function is now used for "Alpha to Selection". Also similarly to copy or color-pick on multi-layers, alpha to selection will now use the composited result of the multi-layers as visible. In particular it means that opacity, modes and visible properties on the layers are taken into account. Alpha to selection on a single layer though still works as previously, only taking the non-composited layer data into account. I am actually struggling if alpha to selection on uncomposited layers (just an union on alpha to selection result for each layer) would not make sense to on some workflows. To be experimented. Finally it is to be noted that this function should also work on channels and vectors (both single or multiple; and of course in such cases, compositing does not matter) though I haven't tested yet. It could even work with a source mix of layers, channels and vectors, though our GUI does not allow such action currently.
61 lines
3.0 KiB
C
61 lines
3.0 KiB
C
/* GIMP - The GNU Image Manipulation Program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* 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_CHANNEL_COMBINE_H__
|
|
#define __GIMP_CHANNEL_COMBINE_H__
|
|
|
|
|
|
void gimp_channel_combine_rect (GimpChannel *mask,
|
|
GimpChannelOps op,
|
|
gint x,
|
|
gint y,
|
|
gint w,
|
|
gint h);
|
|
void gimp_channel_combine_ellipse (GimpChannel *mask,
|
|
GimpChannelOps op,
|
|
gint x,
|
|
gint y,
|
|
gint w,
|
|
gint h,
|
|
gboolean antialias);
|
|
void gimp_channel_combine_ellipse_rect (GimpChannel *mask,
|
|
GimpChannelOps op,
|
|
gint x,
|
|
gint y,
|
|
gint w,
|
|
gint h,
|
|
gdouble rx,
|
|
gdouble ry,
|
|
gboolean antialias);
|
|
void gimp_channel_combine_mask (GimpChannel *mask,
|
|
GimpChannel *add_on,
|
|
GimpChannelOps op,
|
|
gint off_x,
|
|
gint off_y);
|
|
void gimp_channel_combine_buffer (GimpChannel *mask,
|
|
GeglBuffer *add_on_buffer,
|
|
GimpChannelOps op,
|
|
gint off_x,
|
|
gint off_y);
|
|
|
|
void gimp_channel_combine_items (GimpChannel *mask,
|
|
GList *items,
|
|
GimpChannelOps op);
|
|
|
|
|
|
#endif /* __GIMP_CHANNEL_COMBINE_H__ */
|