Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GDI+ and transparency

Featured Replies

Hello all,is there any way to have semi-transparent gauges with GDI+?What I mean is basically having a black (RGB 0, 0, 0) canvas with the CREATE_DIBSECTION flag, but also the TRANSPARENCY flag. I just do not get it working, after much trying around. It usually draws nothing at all or extremly wild and weird colored images where you can barely recognize the original shapes drawn by GDI+, but as I said, completely wrong/crazy colors and very pixelated, just not as intended.Does anyone here have experience/success with that?I'd greatly appreciate it.Thanks guys,Etienne :-wave

As far as I know GDI and GDI+ can't use transparency. You can add transparency between parts of the same GDI drawing, but not to other image elements or gauges.Arne Bartels

  • Author

Big pity.I was thinking of some kind of GDI+ drawn HUD, since from what I heared someone got something similar working recently with the XML 'vector' stuff.Thanks for the information though. :)Etienne

  • Author

Exactly this is what I mean! Good job by the way. :-hahMay I ask what kind of background bitmap you use (and its image flags like transparency etc. in case those exist in XML)?Or is that not even required in XML? Sorry, I have no idea about the XML gauges, but with GDI(+) you need some kind of background bitmap to draw onto, that is why I am asking.Thank you!Etienne :-wave

Etienne,The only bitmap is an image of the HUD frame, but you even don't need that one; is just for the "look".You can use:as a "background" for the xml code.In this case the xml the transparancy command is not needed.I use rectangles with transparancy to "dim and brighten" the various MFD's in my 767-300 panel.Jan"Beatus Ille Procul Negotiis"

Jan

 

 

 

"Beatus ille qui procul negotiis..."

Jan, thanks for getting back to me on the subject - much appreciated.I did find a way to duplicate this in GDI+, but it involves drawing directly on the window for that panel, creating your own GDI+ context, and thus effectively creating your own window paint routine. One of the clear advantages is that you do have access to all the anti-aliasing and color matrix transforms this way.The technique also works with DirectX rendering, which is much faster than GDI+, but a little trickier to implement in code, especially for "2d" type stuff. Unless rendering very complex items, probably not worth the boost.

  • Author

>I did find a way to duplicate this in GDI+, but it involves>drawing directly on the window for that panel, creating your>own GDI+ context, and thus effectively creating your own>window paint routine. One of the clear advantages is that you>do have access to all the anti-aliasing and color matrix>transforms this way.What do you mean with that advantage, you usually have access to the anti-alias etc pretty much always when creating a usual GDI+ drawn 'vector' gage, dontcha!? :-eekAlso an interesting observation on DX, by the way.But in general you mean it is indeed possible to 'connect' GDI+ and transparency, huh?Etienne

Yes, what I mean by that is that by creating your own context you have much better control over the rendering process in general, including transparency issues, and you can mix/match any graphics tool under Windows (GDI, GDI+ and DirectDraw) as needed.One of the main advantages of painting your own window is that you can render full alpha channels in bitmaps, allowing for interesting shading effects.The paradox with using DirectX for 2D drawing is that the 2D part of DirectDraw was eliminated starting with DX8, and you have to go back to create a DirectX7 canvas to use 2D, or use projections in 3D. When you look at the quantity of code needed vs speed vs GDI+, on the mid-range to high end systems you won't see much of a FPS hit.I think that one of the tricks to performance is to make judicious use of pre-rendered complex backgrounds and sprites in GDI+, and use vectors drawing to provide content on top sparingly.

  • Author

Very cool, thanks for the insight.I have never tried to use DX though, so this is kinda outta my league.Best,Etienne

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.