• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA GDI Transparency?

Messages
64
Country
unitedkingdom
Hi,
Should the alpha values in pens and brushes be giving transparent objects when used in FSX gauges?
I'm trying to have a brightness control for a HUD, which I assumed would be a simple case of adjusting the alpha values 'on-the-fly'. However, when setting the alpha for either a pen or a brush it either doesn't appear at all between the values of 0 and 125, or appears completely solid from 125->.
For example...
mBluePen = new Pen(Color( 50, 100, 250, 100 ), (REAL)PENWIDTH); doesn't appear
mBluePen = new Pen(Color( 150, 100, 250, 100 ), (REAL)PENWIDTH); appears completely solid

The project is built upon the ESP opaque/transparent template.

Am I doing something wrong, or do these transparencies not work in FS?

Thanks
 
They do but it depends on 2 things. 1) the image flags for the gauge and 2), the material settings. For a HUD, you would want to use the image flags used in the transparent example, and your blend state for the polygon on which it is mapped should be SrcColor/InvSrcColor.

Also, when your device is created in the PANEL_SERVICE_POST_INSTALL, try adding the following line:

mGraphics->SetCompositingMode(CompositingModeSourceOver);

CompositingModeSourceOver will blend GDI+ graphics within the texture (eg draw 1 semi transparent line over the top of another and you will see a bit of brightness where the 2 cross) while CompositingModeSourceCopy will overwrite the existing color values for the pixels instead of blending them.
 
Thanks for that, I hadn't considered it would be something in the model.
Although I'm not a/the modeller, I have the model and made the changes you suggested and it does now show some transparency. However, it still disappears below the halfway point in the alpha value. Is there a complete list of the correct material settings for something like this?
 
There are several ways to control brightness; either modulate the RGB colors, or modulate the Alpha:
Code:
SolidBrush whiteBrush(Color(255, (255*brt)/100, (255*brt)/100, (255*brt)/100));
    //NOTE: you could also simply apply brt to the Alpha instead of each color!
    //NOTE: for multi-gauge creation, it would be better to declare the Brushes, Pens,
    //and Fonts used in the master .cpp file, then create them as need in each gauge.
Here is a simple "GDI Template" that may provide some help in getting you going:

GDI Project Template.zip
https://files.secureserver.net/0sjVT5UtpKBY3I
 
Back
Top