[haiku-3rdparty-dev] Re: BPictureButton transparency ?

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Mon, 27 Dec 2010 23:36:17 +0100

Hi,

sorry for not reading all mails in the thread before replying... a few remarks, 
though:


Von: Michael Pfeiffer <michael.w.pfeiffer@xxxxxxxxx>
> Am 27.12.2010 um 21:41 schrieb Tomas Wilhelmsson:
> 
> > Is it posible to make a BPictureButton Transparent somehow?
> 
> If the bitmap contains transparency information (alpha values)
> setting the drawing and blending mode after BeginPicture(...)
> is required IIRC.
> view->SetDrawingMode(B_OP_ALPHA);
> view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE);
> or
> to apply the alpha value from the high color to the bitmap
> when it is drawn:
> view->SetHighColor(0, 0, 0, alpha)
> view->SetDrawingMode(B_OP_ALPHA);
> view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);

B_ALPHA_COMPOSITE is only appropriate when you have the view that is drawing 
attached to a BBitmap itself. On the screen, alpha operations can always assume 
a non-transparent background, against which they render, which is what 
B_ALPHA_OVERLAY means.

> Not sure if a picture overwrites the drawing modes when it is draw; 
> if it does you probably want to save and restore the state using
> view->PushState() after BeginPicture and
> view->PopState() before EndPicture.

Yes, good point.

Best regards,
-Stephan

Other related posts: