Fix clip_to_picture test app

* We want the text to be drawn on the clipping bitmap with alpha
blending, to get an useful mask.
This commit is contained in:
Adrien Destugues
2014-01-27 10:57:10 +01:00
parent f429142df9
commit a36c1c0590
@@ -32,22 +32,26 @@ TestView::TestView(BRect frame, const char* name, uint32 resizeFlags,
void
TestView::AttachedToWindow()
{
BPicture picture;
BPicture clipper;
BeginPicture(&clipper);
PushState();
SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE);
BeginPicture(&picture);
DrawString("Hello World! - Clipping", BPoint(10, 10));
FillRect(BRect(0, 20, 400, 40));
PopState();
EndPicture();
ClipToPicture(&picture);
ClipToPicture(&clipper);
}
void
TestView::Draw(BRect updateRect)
{
SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); // opaque black.
DrawString("Hello World! - Clipped", BPoint(10, 30));
FillRect(BRect(0, 0, 200, 20));
}