steffest / DPaint-js

Webbased image editor, modeled after the legendary Deluxe Paint with a focus on retro Amiga file formats: read and write Amiga icon files and IFF ILBM images
https://www.stef.be/dpaint/
MIT License
481 stars 28 forks source link

How do I constrain the gradient fill? #31

Closed danchaseCTS closed 1 month ago

danchaseCTS commented 1 month ago

When I draw a square, then try to fill it with a gradient, no matter what I do the gradient covers the entire screen. I also tried using a selection, but that didn't work either. I basically just want to draw a square, and do a gradient within that square but I can't figure out how.

danchaseCTS commented 1 month ago

I just realized there's a duplicate to this question, does this mean I need to use a layer and somehow copy the gradient to the other layer?

steffest commented 1 month ago

Yes indeed. I know most (all?) other graphics software only apply drawing actions inside the selection, but for some reason I find it more handy to reverse that: apply a drawing action to a layer and then - if needed - use a selection to cut out the part your need. I find it handy because then you still can alter/move/resize your drawed part independant from the selection. Maybe I'll change that behaviour because apparently it seems cumbersome to most users.

So for know:

gradient-fill-rect2

danchaseCTS commented 1 month ago

Thank you! I'd also like to say I'm impressed by your reply, many on these projects just reply with the equivalent of "Nah", but your explanation is very helpful and refreshing.