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.

Lighting a DIBSECTION...

Featured Replies

  • Moderator

I am looking for a way to control whether a GDI+ gauge's drawing surface can be made "BRIGHT" and controllable via the panel lights switch.MAKE_STATIC( vision_image, BMP_VT_BG, NULL, NULL, IMAGE_USE_ERASE|IMAGE_USE_BRIGHT|IMAGE_CREATE_DIBSECTION, 0, MAP_LEFT_BORDER,MAP_TOP_BORDER)While this example is "lighted" via the IMAGE_USE_BRIGHT flag, there's no way to "turn it off."Does anyone have a clue how I can achieve this goal?I had thought that if I used a SLIDER for this, I could then use the callback to control the BRIGHT and DARKEN a la traditional bitmaps, but it seems that I can't use a SLIDER type with the IMAGE_CREATE_DIBSECTION flag.I suppose I should point out that I'm creating an LCD type gauge, and am using a photo of the guage as the BMP_VT_BG image, so it is important that any solution keep that in mind... ;)IOW, I'm only drawing the LCD "segments" of the gauge, NOT the "painted scales, labels and other markings..."

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

how about using 2 identical Static Images. The one should use the IMAGE_USE_BRIGHT and the other it shouldn't.MAKE_STATIC(img_var_wb,BMP_WB,NULL,NULL,IMAGE_USE_ERASE|IMAGE_USE_BRIGHT|IMAGE_CREATE_DIBSECTION,0,0,0)// Next element declaration should go here.MAKE_STATIC(img_var_wob,BMP_WOB,next_element,NULL,IMAGE_USE_ERASE|IMAGE_CREATE_DIBSECTION,0,0,0)The button should control img_var_wb by using HIDE_IMAGE and SHOW_IMAGE macros.---------------------------------------------------------------------In the other hand you can use Graphics::FillRectangle method with a black brush with variable alphaFor example: BYTE bDarkenLevel = 255; // <- This should control darkness level SolidBrush DarkenBrush(Color(bDarkenLevel,0,0,0)); Graphics G(hdc); G.FillRectangle(&DarkenBrush,...);This portion of code should be placed last in the drawing algo.

No. The first way won't work. If you try to use IMAGE_CREATE_DIBSECTION without IMAGE_USE_BRIGHT, you just get a black bitmap.The best way to lighten/darken a DIB section is to put an alpha channel layer above it for brightness control like in the second example.

  • Author
  • Moderator

>No. The first way won't work. If you try to use>IMAGE_CREATE_DIBSECTION without IMAGE_USE_BRIGHT, you just get>a black bitmap.>>The best way to lighten/darken a DIB section is to put an>alpha channel layer above it for brightness control like in>the second example.That would be true Hans, IF I was not using an actual "photograph" for the background image. I'm building a Vision Microsystems LCD engine cluster. The "scales" and "legends" are printed on the plastic cover for the LCD screen, and there's a nice "reflective sheen" to the plastic that I don't wish to lose... ;)Of course, that is the very reason why the second method wouldn't work for me either... ;)I solved the problem by simply creating a SLIDER and switching a copy of the background image on/off as a "cover." Further, to mask the tiny bits of the corners that overlap the bezel when the background is backlighted, I added another SLIDER with just the bezel.However, I do use method #2 for other GDI+ gauges that are wholly drawn on a blank background. It's quite effective.Doug Dawson sent me a unique solution to the question, which I'm including below just for sake of completness... ;)case PANEL_SERVICE_PRE_DRAW: lookup_var(&panel_lights); if ( lights_now != panel_lights.var_value.n ) { if ( panel_lights.var_value.n == 1 ) {bg_element->image_flags |= IMAGE_USE_BRIGHT;} else if ( panel_lights.var_value.n == 0 ) {bg_element->image_flags &= ~IMAGE_USE_BRIGHT;} REDRAW_IMAGE(bg_element); lights_now = panel_lights.var_value.n; }break;This works only to change the flag for the static. For some reason, bg_element->next_element->image_flags is not valid and will not allow the gauge to compile...http://forums.avsim.net/user_files/124232.jpg

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.