automatically uses alpha blending for B_RGBA32 bitmaps
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11103 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,6 +13,7 @@ BitmapView::BitmapView(BRect frame, const char* name,
|
|||||||
fBitmap(bitmap)
|
fBitmap(bitmap)
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||||
|
SetHighColor(255, 0, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
@@ -25,8 +26,16 @@ BitmapView::~BitmapView()
|
|||||||
void
|
void
|
||||||
BitmapView::Draw(BRect updateRect)
|
BitmapView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
if (fBitmap)
|
if (fBitmap) {
|
||||||
|
if (fBitmap->ColorSpace() == B_RGBA32) {
|
||||||
|
// draw the bitmap with pixel alpha
|
||||||
|
// against a red background
|
||||||
|
FillRect(updateRect);
|
||||||
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
|
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||||
|
}
|
||||||
DrawBitmap(fBitmap, Bounds().LeftTop());
|
DrawBitmap(fBitmap, Bounds().LeftTop());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseDown
|
// MouseDown
|
||||||
|
|||||||
Reference in New Issue
Block a user