summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/bitmapex.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 14b3fa17efd6..dba603347679 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -769,6 +769,27 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
return nTransparency;
}
+
+Color BitmapEx::GetPixelColor(sal_Int32 nX, sal_Int32 nY) const
+{
+ Bitmap aAlpha( GetAlpha().GetBitmap() );
+
+ Bitmap aTestBitmap(maBitmap);
+ Bitmap::ScopedReadAccess pReadAccess( aTestBitmap );
+ assert( pReadAccess );
+
+ Color aColor = pReadAccess->GetColor( nY, nX ).GetColor();
+
+ if (!aAlpha.IsEmpty())
+ {
+ Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha.AcquireReadAccess(), aAlpha );
+ aColor.SetTransparency( pAlphaReadAccess->GetPixel( nY, nX ).GetIndex() );
+ }
+ else
+ aColor.SetTransparency(255);
+ return aColor;
+}
+
// Shift alpha transparent pixels between cppcanvas/ implementations
// and vcl in a generally grotesque and under-performing fashion
bool BitmapEx::Create( const css::uno::Reference< css::rendering::XBitmapCanvas > &xBitmapCanvas,