diff --git a/lib/src/draw/draw_pixel.dart b/lib/src/draw/draw_pixel.dart index 4568a579..74eaf297 100644 --- a/lib/src/draw/draw_pixel.dart +++ b/lib/src/draw/draw_pixel.dart @@ -37,7 +37,10 @@ Image drawPixel(Image image, int x, int y, Color c, var overlayB = filter != null ? c.bNormalized * filter.bNormalized : c.bNormalized; - final overlayA = (alpha ?? (c.length < 4 ? 1.0 : c.aNormalized)) * msk; + final a = (c.length < 4 ? 1.0 : c.aNormalized) * + ((filter == null || filter.length < 4) ? 1.0 : filter.aNormalized); + + final overlayA = (alpha ?? a) * msk; if (overlayA == 0) { return image; diff --git a/test/draw/draw_string_test.dart b/test/draw/draw_string_test.dart index a4a94ed5..cf60ed5a 100644 --- a/test/draw/draw_string_test.dart +++ b/test/draw/draw_string_test.dart @@ -9,7 +9,7 @@ void main() { test('drawString', () { final i0 = Image(width: 256, height: 256)..clear(ColorRgb8(128, 128, 0)); drawString(i0, "Hello", - font: arial24, x: 50, y: 50, color: ColorRgba8(255, 0, 0, 255)); + font: arial24, x: 50, y: 50, color: ColorRgba8(255, 0, 0, 128)); drawString(i0, "Right Justified", font: arial24, x: 200, y: 80, rightJustify: true); drawString(i0, "Centered", font: arial24);