#12931: Spirograph (BeOS app) doesn't draw its background transparent
----------------------------------+----------------------------
Reporter: jscipione | Owner: jscipione
Type: bug | Status: new
Priority: normal | Milestone: R1
Component: Kits/Interface Kit | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
----------------------------------+----------------------------
Comment (by jscipione):
This appears to be the malfunctioning bit of code
{{{
int32 DrawView::Rewrite_image(DrawView* data)
{
rgb_color Transparent;
memcpy (&Transparent, &B_TRANSPARENT_MAGIC_RGBA32, 4);
// We'll add a drawing view to the bitmap
int i; // Index for the loop - we'll need it later
BView* drawer = new BView (
data->image->Bounds(),
"drawer",
B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_SUBPIXEL_PRECISE);
// If allocated successfully, add it to the bitmap
if (drawer != NULL) {
data->image->AddChild(drawer);
}
// Now, adding the image layers, one by one
// The drawing mode must be set to B_OP_MODE, for
the LowColor
// of the drawing shall be treated as transparent.
//
// I must acquire the lock!
if ( drawer->LockLooper() ) {
drawer->SetLowColor(Transparent);
drawer->SetViewColor(Transparent);
drawer->SetDrawingMode(B_OP_OVER);
for (i=0; i<MAX_LAYERS-1; i++) {
// If current layer is not empty
if ( (data->layers[i] != NULL) && ( (int
)data->layers[i] != 0x19) ) {
// Adding it to the bitmap, in
B_OP_OVER mode
drawer->DrawBitmap (data->layers[i]);
drawer->Sync();
}
}
drawer->UnlockLooper();
}
else { // If I can't lock the BView, I alert the
user.
BAlert* cantLockLooper = new BAlert(NULL, "Cannot acquire
the lock on the drawing element!", "Ok");
cantLockLooper->Go();
}
// Now we may successfully delete the "drawer" BView
data->image->RemoveChild (drawer);
delete drawer;
drawer = NULL;
exit_thread(0);
return 0;
}
}}}
--
Ticket URL: <https://dev.haiku-os.org/ticket/12931#comment:2>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.