Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a method of getting GDI+ bitmaps into a layered window. This allows multiple bitmap overlays, positioning and re-sizing. </p> <pre><code>void SetSplashImage() { // Default to upper left of screen POINT ptOrigin = { 0, 0 }; SIZE sizeSplash = { 128, 128 }; // Get the actual screen location GetPointOfOrigin(ptOrigin, sizeSplash); // Our in memory database of GDI+ Bitmaps data::image::BoxOfBits *box = dynamic_cast&lt;data::image::BoxOfBits *&gt;(&amp;Images.get_package("skin_layout_008")); // Create a display context as a canvas to draw the images HDC hdcScreen = GetDC(NULL); HDC hdcMem = CreateCompatibleDC(hdcScreen); HBITMAP bmMem = CreateCompatibleBitmap(hdcScreen, sizeSplash.cx, sizeSplash.cy); // Prep canvas for rendering graphic HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, bmMem); Gdiplus::Graphics graphics(hdcMem); // Base image is a pic of a folder Gdiplus::RectF canvasDest(0,0,128,128); graphics.DrawImage(box-&gt;grab("black_folder").pBitmap_, canvasDest, 0,0,128,128, Gdiplus::UnitPixel); // Overlay a pic of some tools in center of folder Gdiplus::RectF canvasDest2(30,50,64,64); // resize half actual size graphics.DrawImage(box-&gt;grab("work_tools").pBitmap_, canvasDest2, 0,0,128,128, Gdiplus::UnitPixel); // Overlay a pic of a cog in upper left corner of folder Gdiplus::RectF canvasDest1(16,16,32,32); // resize half actual size graphics.DrawImage(box-&gt;grab("cog_edit").pBitmap_, canvasDest1, 0,0,32,32, Gdiplus::UnitPixel); // Prepare to alpha blend the canvas with the screen BLENDFUNCTION blend = { 0 }; blend.BlendOp = AC_SRC_OVER; blend.SourceConstantAlpha = 255; blend.AlphaFormat = AC_SRC_ALPHA; // Composite the canvas with the screen into the layered window POINT ptZero = { 0 }; UpdateLayeredWindow(hwnd_, hdcScreen, &amp;ptOrigin, &amp;sizeSplash, hdcMem, &amp;ptZero, RGB(0, 0, 0), &amp;blend, ULW_ALPHA); // Delete temporary objects used for canvas SelectObject(hdcMem, hbmpOld); DeleteObject(bmMem); DeleteDC(hdcMem); ReleaseDC(NULL, hdcScreen); // Update mouse hit-test coordinates GetWindowRect(hwnd_, &amp;rcMousedown_); } </code></pre> <p>The layered window composed of the three bitmaps look like this on the screen : -- guess I don't have enough reputation to post the image :( </p> <p>Here's the link though - <a href="http://i.stack.imgur.com/HmU7H.png" rel="nofollow">http://i.stack.imgur.com/HmU7H.png</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload