diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-01-15 20:49:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-16 09:00:25 +0100 |
commit | ef7f98ff3c73182528995057a3f691a6d1aefdd5 (patch) | |
tree | a9048b1b5e477bd682c92b02cca7e9c60141ff83 /vcl | |
parent | 647c9de0338350c1b5eff4b9adf08bd06930e36b (diff) |
transparency->alpha in BitmapEx
Change-Id: I631f4ca5a2bdcb8c7691a9a8c71d3de15377213b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109390
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/bitmap/BitmapEx.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index 1f5da07218c4..65698b6bbad9 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -675,22 +675,22 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & aBitmap, const tools::Long return aRet; } -sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const +sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const { - sal_uInt8 nTransparency(0xff); + sal_uInt8 nAlpha(0); if(!maBitmap.IsEmpty()) { if (nX >= 0 && nX < GetSizePixel().Width() && nY >= 0 && nY < GetSizePixel().Height()) { if (maBitmap.GetBitCount() == 32) - return 255 - GetPixelColor(nX, nY).GetAlpha(); + return GetPixelColor(nX, nY).GetAlpha(); switch(meTransparent) { case TransparentType::NONE: { // Not transparent, ergo all covered - nTransparency = 0x00; + nAlpha = 255; break; } case TransparentType::Color: @@ -704,7 +704,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const // If color is not equal to TransparentColor, we are not transparent if (aBmpColor != maTransparentColor) - nTransparency = 0x00; + nAlpha = 255; } break; @@ -722,13 +722,13 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const if(mbAlpha) { - nTransparency = aBitmapColor.GetIndex(); + nAlpha = 255 - aBitmapColor.GetIndex(); } else { if(0x00 == aBitmapColor.GetIndex()) { - nTransparency = 0x00; + nAlpha = 255; } } } @@ -739,7 +739,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const } } - return nTransparency; + return nAlpha; } |