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.

Owner drawn gauge help

Featured Replies

  • Author
  • Moderator

I use SET_OFF_SCREEN as that is the way I was taught... ;) The way I understand it, this will force the gauge to redraw if the gauge is resized (i.e., undocked and enlarged, moved, or shrunk). /* Define the Small Arrow structure */ Point AMPS_1(-10 * dx, 8 * dy); Point AMPS_2(-9 * dx, 9 * dy); Point AMPS_3(-19 * dx, 24 * dy); Point AMPS_4(-24 * dx, 24 * dy); Point AMPS_5(-24 * dx, 19 * dy); Point AMPS_blade[6] = {AMPS_1, AMPS_2, AMPS_3, AMPS_4, AMPS_5, AMPS_1}; graphics.FillPolygon(&blackBrush, AMPS_blade, 6); graphics.ResetTransform(); } PointF pointLA(467*dx, 418*dy); graphics.DrawString(load_amps_wch, -1, &SmallNumbers, pointLA, &blackBrush); } //end gauge_draw else clause } SET_OFF_SCREEN (pelement); } } break;As Doug wrote previously, PANEL_SERVICE_PREDRAW is called once each frame, which means that it is updated according to the frame rate. PANEL_SERVICE_PREUPDATE is performed 18 times per second, which means that the gauge is being drawn even if the result is 'discarded.'My own experience has been that using PREDRAW results in less of a 'performance hit' on the sim... YMMV, or course... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

I guess the only thing that I can't deduce from your example is the content of your STATIC images. I'm assuming that the BMP_VT_LM image is similar to the background image and that you are drawing on it.I don't suppose it's possible to draw an image with transparency, is it? I've tried drawing on a STATIC that's USE_TRANSPARENCY, but the DC is invalid. I've also |'ed USE_DIBSECTION and gotten a valid dc from the static, but when it's drawn, it's just the original image without any dynamic content, although I'm sure I wrote successfully to the DC. Makes me think that USE_TRANSPARENT images are reloaded before they are rendered or something like that.Another issue I have when drawing on a USE_DIBSECTION STATIC is that the contents of the previous rendering are not lost between frames/changes, so what I draw is never 'erased' if you will. I can Blt stuff to it fine, but it stays throughout the life of the gauge.The short of it is that it would make things a lot easier if I could use a drawing surface with transparency. I'm expecting this is impossible.Thanks for all the input.

  • Author
  • Moderator

>I guess the only thing that I can't deduce from your example>is the content of your STATIC images. I'm assuming that the>BMP_VT_LM image is similar to the background image and that>you are drawing on it.What is unclear? I posted a picture of BMP_VT_LM image? (Hint: it's the second picture!) ;)>I don't suppose it's possible to draw an image with>transparency, is it?I know that some few people have advanced the claim that it's possible, but AFAIK no one has shared their procedure... >Another issue I have when drawing on a USE_DIBSECTION STATIC>is that the contents of the previous rendering are not lost>between frames/changes, so what I draw is never 'erased' if>you will. I can Blt stuff to it fine, but it stays throughout>the life of the gauge.I've already provided this example, but here it is again:Image image(L"AircraftEaglesoft Liberty XL2texturevision.bmp");Rect destinationRect(0, 0, 600 * dx, 590 * dy);graphics.DrawImage(ℑ,destinationRect,0, 0, 600, 590, UnitPixel);The image loaded/painted is a copy of the BMP_VT_LM bitmap that is placed in the aircraft's texture folder. This routine is performed every drawing cycle before any other gauge drawing occurs. The purpose of course is to 'erase the slate' and provide a clean drawing surface... ;)If you are drawing on a blank "LCD screen display," then the clearing routine is much simpler:Color Black(0,0,0);graphics.Clear(Black);Simply substitute whatever color you desire instead of Black(0,0,0)...

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • 1 year later...

>>I don't suppose it's possible to draw an image with>>transparency, is it?Yes, and it's not hard with GDI+.You basically adjust the alpha of an ARGB color. 255 is opaque, and 0 is fully transparent. howBrt = 2.55 * brtness; StaticObj::brushTxtGold.SetColor(Color(int(howBrt), byte(StaticObj::txtGold.GetRed()), byte(StaticObj::txtGold.GetGreen()), byte(StaticObj::txtGold.GetBlue()))); StaticObj::brushTxtLime.SetColor(Color(int(howBrt), byte(StaticObj::txtLime.GetRed()), byte(StaticObj::txtLime.GetGreen()), byte(StaticObj::txtLime.GetBlue()))); g->FillRectangle(&StaticObj::brushTxtLime, POS_X, POS_Y + 8, int(barWidth), 16);and whatever you draw with the colors you have adjusted will use that alpha (transparency).

  • Commercial Member

When FS creates the DC it prefills it with a black background.To prove my statement, simply do no drawing whatever. It will always, always display black.There are ways to render bitmaps with transparency... but since FS always fills the DC passed before passing it, you can not get the DC as a 'blank' slate.

Ed Wilson

Mindstar Aviation
My Playland - I69

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.