[haiku-commits] r34996 - haiku/trunk/src/preferences/keymap

Author: korli
Date: 2010-01-10 23:19:29 +0100 (Sun, 10 Jan 2010)
New Revision: 34996
Changeset: http://dev.haiku-os.org/changeset/34996/haiku
Ticket: http://dev.haiku-os.org/ticket/3892

Modified:
   haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp
Log:
Change dragging bitmap so that the return key has a transparent background 
while moving.
Fixed #3892


Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp
===================================================================
--- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp   2010-01-10 
21:54:22 UTC (rev 34995)
+++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp   2010-01-10 
22:19:29 UTC (rev 34996)
@@ -272,25 +272,23 @@
                BRect rect = frame;
                rect.right--;
                rect.bottom--;
-               BBitmap* bitmap = new BBitmap(rect, B_BITMAP_ACCEPTS_VIEWS, 
B_RGBA32);
+               BBitmap* bitmap = new BBitmap(rect, B_RGBA32, true);
                bitmap->Lock();
 
-               BView* view = new BView(rect, "drag", 0, 0);
+               BView* view = new BView(rect, "drag", B_FOLLOW_NONE, 0);
                bitmap->AddChild(view);
-
+               
+               view->SetHighColor(0, 0, 0, 0);
+               view->FillRect(view->Bounds());
+               view->SetDrawingMode(B_OP_ALPHA);
+               view->SetHighColor(0, 0, 0, 128);
+               // set the level of transparency by value
+               view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
                _DrawKey(view, frame, key, frame, false);
 
                view->Sync();
-               bitmap->RemoveChild(view);
                bitmap->Unlock();
 
-               // Make it transparent
-               // TODO: is there a better way to do this?
-               uint8* bits = (uint8*)bitmap->Bits();
-               for (int32 i = 0; i < bitmap->BitsLength(); i += 4) {
-                       bits[i + 3] = 144;
-               }
-
                BMessage drag(B_MIME_DATA);
                drag.AddInt32("key", key->code);
 


Other related posts:

  • » [haiku-commits] r34996 - haiku/trunk/src/preferences/keymap - korli