Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Transparent Bitmaps

longwell
Beginner
1,164 Views
I need your help. What is the trick to creating transparent bitmaps in Developer Studio? I would like to create bitmaps that blend in to the gray color of the dialog box that contains them.

Thanks,
Joe
0 Kudos
6 Replies
Jugoslav_Dujic
Valued Contributor II
1,164 Views
I don't think you can create transparent bitmaps, but you can give a try of creating an icon of custom size; never tried it myself though.

Jugoslav
0 Kudos
Steven_L_Intel1
Employee
1,164 Views
I had read that the color you used for the upper left corner pixel was made "transparent" in icons, but I have never been able to get this to work myself. There must be something else I missed...

Steve
0 Kudos
tomballard
Beginner
1,164 Views
You can draw a transparent bitmap by creating a mask for the bitmap which you want to display with a transparent background. Attached is an example of the code for displaying the bitmap.

use dfwina
integer*4 hDCBitMap,hbmBullseye,hbmBullseyeMaks
integer*4 hDC,iHPosition,iVPosition


hbmBullseye = LoadBitmap(ghModule,IDB_BULLSEYE)
hbmBullseyeMask = LoadBitmap(ghModule,IDB_BULLSEYE_MASK)
hDCBitMap = CreateCompatibleDC(hDC)
ret = SelectObject(hDCBitMap,hbmBullseyeMask)
ret = BitBlt (hDC, iHPosition, iVPosition, 15, &
15,hDCBitMap, 0, 0, SRCAND)
ret = SelectObject(hDCBitMap,hbmBullseye)
ret = BitBlt (hDC, iHPosition, iVPosition, 15, &
15,hDCBitMap, 0, 0, SRCPAINT)
ret = DeleteDC(hDCBitMap)

You need to initialize iHPosition and iVPosition according to where you want the bitmap to be displayed. I don't know if this is what you are looking for, but you should be able to modify it for your dialog boxes. This particular bit of code was used to paint a bullseye bitmap on a graph in the main window.

Unfortunately, for some reason, I am not able to attach files to this message, otherwise, I would attach the sample bitmap and mask.
0 Kudos
Steven_L_Intel1
Employee
1,164 Views
If you want to attach a file of a type not accepted by the forum, put it in a ZIP archive and attach that.

Steve
0 Kudos
tomballard
Beginner
1,164 Views
Here are the bitmaps that go with my reply.
0 Kudos
david_jones
Beginner
1,164 Views
Regarding the Icon Editor in Visual Studio, the bit of the in-line help regarding this says

Choosing an Opaque or Transparent Background
Home Page (Graphics Editor) | Overview | How Do I ... Topics

When you move or copy a selection from a cursor or icon, any pixels in the selection that match the current background color are, by default, transparent: they do not obscure pixels in the target location. A custom brush behaves in the same way.

To toggle the background-color transparency

In the Graphics toolbar option selector, click the appropriate button:
Opaque background: existing image is obscured by all parts of the selection.


Transparent background: existing image shows through parts of the selection that match the current background color.
You can change the background color while a selection is already in effect to change which parts of the image are transparent.



I think that the background colour is set within the "Colors" toolbar where there are two small "terminal screen" icons (green or pink). In addition when in the Icon Editor, there is an "Image" menu on the main toolbar containing a "draw opaque" option which I think is what controls whether the background is counted as transparent or not when finally drawn within a toolbar.
0 Kudos
Reply