Gimp-Forum.net

Full Version: Bucket fill with a Pattern
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If I'm trying to bucket fill one specific area of a drawing with a pattern, the pattern always seems to "index" itself from the upper left hand corner of the entire  drawing, and not just within the specific area.

The gist of this question is, is there some easily adjusted setting that I am missing that will tell the pattern to index itself within the fill area, and NOT the entire drawing?

To illustrate....here is a pattern... note that the left edge is blue, and the top edge is red

[Image: Fe2sp84.png]


And here is my canvas, with the desired  fill area being inside the black box

[Image: NWu7x4f.png]

And, when I bucket fill the black box, I get this (example one)

[Image: QGk0AUb.png]
Whereas, what I would prefer to get is this (example two)

[Image: sHjXURr.png]

The reason that Im getting example one is because behind the scenes, gimp is indexing the pattern with the upper  left hand corner of the drawing ....like this

[Image: e5rErS6.png]

I've found laborious work arounds such as selecting the target area and copying it to a completely new image, making the bucket fill on the new image and then pasting that back to the original drawing....but I just wonder if there is an easier way, one that instructs the bucket fill operation to index itself  off of only the area that it will be painting to?

Granted, the way it currently works is very nice for when you have to make alterations to a filled area, and have to patch back-in after the alterations,  but I do find it desirable to target the pattern to the intended fill area often enough that a solution is worthwhile too. 

Clearly these illustrations are only intended to illustrate the concept, and not part of any final work

Thanks in advance
(10-08-2021, 07:12 PM)rickk Wrote: [ -> ]the pattern always seems to "index" itself from the upper left hand corner of the entire  drawing, and not just within the specific area.

Indeed, it does index from the upper left corner.
You don't need "New Image" Wink

What I do, is a new layer then make a selection of the needed area (in the middle for example), then fill with a color,  you don't care about the color I just drag n drop from FG or BG (it's just to have a "content"),
then  Layer > Crop to content now I can fill with my pattern and it will be filled as I want
still it's indexed from the upper left, but it is indexed from a smaller layer and at the place I want

[attachment=6814]

In your case
You can stroke your selection on a new layer, then same > Layer > Crop to content then bucket fill your gradient

It might not be the best solution but it does the trick
Even faster,
New Layer > Crop Tool ( Current layer only is checked)
Drag n drop your pattern on that layer Wink

[attachment=6815]
Sincerely appreciated!! Hadn't thought about the "crop to content" possibility..
I am, however, surprised that there isn't an option, perhaps in the "modes" selection utility, that allows the user to specify this.

Somewhere I was using a graphics program years ago that had I guess almost a random indexing of bucketfill patterns...and it was a nightmare if you had to edit an area already having a pattern.
Really you answered the question yourself at the beginning. The origin of the pattern fill is zero, zero - ie. top left corner. That applies to layers as well as the canvas. If you can make your area a selected layer, even as a temporary layer it will fill from top left corner.

For that rectangle, a fuzzy select inside (with threshold up a bit to avoid anti-aliased pixels) and then a paste gives a floating selection layer. That still obeys the rules and fills. Then it is anchored to fill the rectangle.

Reads more complicated than it is: 30 second demo: https://i.imgur.com/1SuqZzE.mp4
(10-09-2021, 06:37 PM)rich2005 Wrote: [ -> ]Really you answered the question yourself at the beginning. The origin of the pattern fill is zero, zero - ie. top left corner.  That applies to layers as well as the canvas.  If you can make your area a selected layer, even as a temporary layer it will fill from top left corner.

For that rectangle, a fuzzy select inside (with threshold up a bit to avoid anti-aliased pixels) and then a paste gives a floating selection layer. That still obeys the rules and fills. Then it is anchored to fill the rectangle.

Yeah, but I'm notorious for putting myself through convoluted, multi-step processes, only to have someone come along and say "why are you beating yourself up like that? There is an easier way"

So, I just was curious if there was a toggle  control somewhere that I had failed to notice.  Somehow for me,  now knowing that the shorter route doesn't exist, will make going the longer route less stressful....not having to wonder what I've missed.

Strangely enough when going through this procedure originally, I was having problems with the filled pattern originating at 0,0  even in the lifted layers made with the select tool, which is why my original post mentions pasting the selection as a new image. Doing that way was the only way I could get away from the original indexing.   I'm not sure why that was, but since trying today after reading Pixlab's submission...it seems to be working just within the confines of the lifted layer, so "all is well"

Thanks!!   Smile

I'm in good shape now. And wiser for the experience.

[Image: hDvltJa.png]



 I always suspected that patterns began  from a non-obvious point of origin, due to the way they painted in the select area. I just wasn't sure where.  Coming from an IBM OS/2 background, their architecture uses the Cartesian coordinate system, which "paints" from lower left corner.
(10-09-2021, 06:37 PM)rich2005 Wrote: [ -> ] a fuzzy select inside (with threshold up a bit to avoid anti-aliased pixels) and then a paste gives a floating selection layer. That still obeys the rules and fills. Then it is anchored to fill the rectangle.

It took a while for your suggestion to sink in,  But that is a perfect solution, thanks again!!

I can see from the following example that it indexes from the top of the floating selection perfectly!

[Image: ZQaPzJ5.png]