• 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.

FSX:SE GDI+ gauge drawing - gradated alpha transparency

Messages
823
Country
ca-ontario
Is it possible to draw a gradated ( or graduated? :scratchch ) alpha transparency for virtual cockpit? I can draw a a transparent (HUD type) gauge no problem, but this consists of only 2 states: transparent or opaque.

I'd like to draw a smooth ramp from, let's say, black to transparent, using GDI+ calls. When I implemented that, I got full transparency for any alpha except full opaque. Same with bitmaps - I used a PNG with smooth transition from black to transparent, and I got full opaque to full transparent.

Let me make this clear: I can do these transitions when drawing onto a bitmap surface that is used as a gauge surface (for instance, a MFD screen). In this case, gauge surface is first cleared with black color. But when clearing with transparent color, as in the transparent gauge type, I only get either full opaque or full transparent.

I toyed with the material settings but so far nothing worked. I'm also wondering if any of the flags in MAKE_STATIC macro are used for this?

Code:
MAKE_STATIC
(
    SH_image,
    BMP_BACKGROUND,
    NULL,
    NULL,
    IMAGE_CREATE_DIBSECTION | IMAGE_USE_TRANSPARENCY | IMAGE_USE_ALPHA | IMAGE_USE_ERASE | IMAGE_ERASE_ALWAYS,
    0,
    0, 0
)
 
Unfortunately the sim insists on converting VC textures to 16bit which means only 1bit alpha. If you want a translucent HUD for example, your 3D model materials are the determining factor. I would set the blend mode to SrcColor/InvSrcColor. Then setting the alpha of your pens/brushes will blend the elements with a black background, which will reduce their actual RGB values, and then the sim will blend by color to get the final result.
 
Ah - ok, great, thanks for the info! I'm going to play with it a bit more to see if I can get something out of it...
 
Back
Top