From 1f2b441c9a78a8ec43d3b5a80aef28dc5a74aaa3 Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Sun, 27 Dec 2009 23:23:45 +0000 Subject: [PATCH] Fixed alpha calculation in Image::Copy with applyAlpha = true git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1312 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Graphics/Image.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index d706daae3..29d5126be 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -299,11 +299,12 @@ void Image::Copy(const Image& source, unsigned int destX, unsigned int destY, co const Uint8* src = srcPixels + j * 4; Uint8* dst = dstPixels + j * 4; - // Interpolate RGB components using the alpha value of the source pixel + // Interpolate RGBA components using the alpha value of the source pixel Uint8 alpha = src[3]; dst[0] = (src[0] * alpha + dst[0] * (255 - alpha)) / 255; dst[1] = (src[1] * alpha + dst[1] * (255 - alpha)) / 255; dst[2] = (src[2] * alpha + dst[2] * (255 - alpha)) / 255; + dst[3] = alpha + dst[3] * (255 - alpha) / 255; } srcPixels += srcStride;