brendan-duncan / image

Dart Image Library for opening, manipulating, and saving various different image file formats.
MIT License
1.17k stars 265 forks source link

fillRect not working on transparent Image #618

Open Equirinya opened 7 months ago

Equirinya commented 7 months ago

When creating a transparent image filling it with a rounded Rect does not seem to work:

img.Image bgImage = img.Image(width: 512, height:512, numChannels: 4);

bgImage = img.fillRect(bgImage, x1: 0, y1: 0, x2: bgImage.width, y2: bgImage.height, 
                              color: img.ColorRgba8(13, 42, 62, 255), radius: 20, maskChannel: img.Channel.alpha);

// => bgImage still just transparent

whereas just filling it with a color works: bgImage = img.fill(bgImage, color: img.ColorRgba8(13, 42, 62, 255), maskChannel: img.Channel.alpha);

Equirinya commented 7 months ago

Ive tested it a bit more and it actually appears to fill in a transparent rect no matter the color or maskChannel

brendan-duncan commented 7 months ago

Perhaps the masking logic needs to be reworked to be able to do channel based masking without a mask image. Currently you have to provide a mask image, and maskChannel indicates which channel of the mask image to use.