diff --git a/lime/graphics/utils/ImageDataUtil.hx b/lime/graphics/utils/ImageDataUtil.hx index a83b71707..f2efcde5b 100644 --- a/lime/graphics/utils/ImageDataUtil.hx +++ b/lime/graphics/utils/ImageDataUtil.hx @@ -387,6 +387,8 @@ class ImageDataUtil { if (fillColor == hitColor) return; + if (premultiplied) fillColor.multiplyAlpha(); + var dx = [ 0, -1, 1, 0 ]; var dy = [ -1, 0, 0, 1 ]; @@ -422,7 +424,7 @@ class ImageDataUtil { if (readColor == hitColor) { - fillColor.writeUInt8 (data, nextPointOffset, format, premultiplied); + fillColor.writeUInt8 (data, nextPointOffset, format, false); queue.push (nextPointX); queue.push (nextPointY); diff --git a/project/src/graphics/utils/ImageDataUtil.cpp b/project/src/graphics/utils/ImageDataUtil.cpp index 6f1419974..c28d12c81 100644 --- a/project/src/graphics/utils/ImageDataUtil.cpp +++ b/project/src/graphics/utils/ImageDataUtil.cpp @@ -277,6 +277,8 @@ namespace lime { bool premultiplied = image->buffer->premultiplied; RGBA fillColor (color); + + if (premultiplied) fillColor.MultiplyAlpha (); RGBA hitColor; hitColor.ReadUInt8 (data, ((y + image->offsetY) * (image->buffer->width * 4)) + ((x + image->offsetX) * 4), format, premultiplied); @@ -326,7 +328,7 @@ namespace lime { if (readColor == hitColor) { - fillColor.WriteUInt8 (data, nextPointOffset, format, premultiplied); + fillColor.WriteUInt8 (data, nextPointOffset, format, false); queue.push_back (nextPointX); queue.push_back (nextPointY);