Quoting Ilya Zakharevich <nospam-ab...@ilyaz.org>:
> I'm confused on why gimp-vectors-set-visible() is used. Any hint?
I did that merely so I could watch how the process progressed along
the path. It is not functionally necessary.
> And I can't guess reasons why you first do gimp-selection-none(), then
> combine the orig-sel back?
I assumed that you wanted to add together all of the fuzzy selections
made along the path, and then combine that result with the original
selection using the operation mode. To not do so would lead to some
rather useless results.
For example, if the operation mode were CHANNEL-OP-REPLACE and this
was passed to 'gimp-fuzzy-select-full' then despite making fuzzy
selections all along the path, the only thing that would matter would
be the fuzzy select performed on the path's last point.
Also consider what happens if the 'operation' mode were
CHANNEL-OP-INTERSECT and the original selection was the entire image
(if there were no selection originally then the final result would be
no selection). If I merely passed the INTERSECT mode to Fuzzy Select
then after the first x,y point on the path was "fuzzy selected", the
resulting intersection would be only that fuzzy selection. Moving to
the next x,y point and the resulting selection would only be the
intersection of the two Fuzzy Selects. At any point along the path --
including the last point on the path -- the resulting selection will
be no larger than the intersection of that point's fuzzy selection and
the one before it.
> And why do you need to set the drawable (which was initially active)
> "active again" at end of operation?
A script not leaving any drawable active after execution would be very
"impolite"; however, you are correct that this particular script would
not do that even if the original drawable wasn't re-activated (the
original drawable is never made inactive in this script).
The re-activation was a remnant of alternate version of the script
which also handled By Color Select. In order to perform By Color
Select in "sample merged" mode, it was necessary to create a temporary
layer that contained the merged image ('gimp-drawable-get-pixel' only
works with a drawable). After the By Color Select was processed, the
script deleted the temporary layer -- leaving no drawable active --
and then needed to re-activate the original active drawable.
> Is there no way to get-pixel() meaning "visible pixel"? I understand
> that this might be problematic when started from context menu of
> "Paths" (may there be multiple "views" of an image with different
> visiblity flags of masks/layers?), but if started from menu of Image
> window", GIMP knows which "view" (is it what you call "projection"? I
> found no definition in the docs) the user means...
The "projection" is the composited result of all of the layers,
employing all settings for the specified blend modes, opacities,
masks, and visibilities -- it is what you see in the image window.
There is no direct access to the projection contents from the PDB and
since 'gimp-drawable-get-pixel' does not provide a "sample merged"
mode, it would be necessary create a new layer that contains the
projection contents (in other words, do the equivalent of "Layer->New
>> The best approach to this would
>> likely be to create a new image from the drawable or projection, copy
>> the path to the new image, perform the walking selection along the
>> path, and then move the resulting selection back to the original image.
> I would very much prefer to avoid this. The image is about 0.1GPix
> already with a few layers, and the hardware is close to 10years old...
> And: if I want to operate "on one layer only", would cadr of the
> result of gimp-drawable-get-pixel() suitable as argument to
I basically gave up on my attempt to create a By Color Select version
because of all of the edge cases that needed to be handled: layer
offsets and dimensions (path coordinates are relative to the image,
'get-pixel' uses the drawable coordinates), changing colorspaces (mask
and channels are grayscale, while a layer may or may not be), and
image/drawable boundaries (paths are not constrained to the image).
All of these distinctions are dependent upon whether the colors are
being "sample merged", thus further complicating things.
If you wanted just a simple version which handled only a single layer
(not its mask, nor a channel) which had the same dimensions as the
image (and no offsets), and did not need to provide a "sample merged"
option, I could write one sometime later this evening.
Gimp-user mailing list