Jump to content
Sign in to follow this  
Guest Jon_Gibbs

Changing Alpha values in GDI+

Recommended Posts

Guest Jon_Gibbs

Hi,There are a lot of examples of how to change colors in a bmp in GDI+ and the Color class does contain a method to set a new value.However I have tried this many times and had no luck.Here is the algorithmByte Brightness = 0xFF; Color green(brightness, 0x00, 0xFF, 0x00);rendergauge{...Make argb (brigness, ....) --this is in the the sdkgreen.setvalue(argb);}Mousefunctionbrightdownbrightness--;Any ideas? Has anyone else managed to do this?Also has anyone been successful in making their own class defenitions and methods in FS9? Mine compiles and runs but once you press alt, FS9 exits.ThanksJon

Share this post


Link to post
Share on other sites
Guest bartels

I'm not at home at the moment, I'll have to check in detail later. The problem of exiting on "ALT" looks, as if you "hook" to the bitmap in the wrong time. You can't use PANEL_SERVICE_CONNECT_TO_WINDOW and PANEL_SERVICE_DISCONNECT for hooking to the MAKE_STATIC, since the pointers get invalid on resizing, these both service_ids are only for starting/stopping GDI+. You can either use all GDI+ drawing code in the PANE_SERVICE_PRE_DRAW or choose the the servide_ids for contructiing/destructing with care.Arne Bartels

Share this post


Link to post
Share on other sites
Guest Jon_Gibbs

Hi Arne,Im not sure what you mean by "hooking the bitmap" but I do have code in those to functions for things other then gdi+ (mainly for initialization destruction of my own class objects). Also it looks like my drawing functions are only being called once and not updating with time. They do resize approriatly when they need to but other then that, it looks like they are only being called once.Any ideas?Thanksjon

Share this post


Link to post
Share on other sites

So are you just trying to change the alpha of a bitmap, before drawing it?If so, try using a colormatrix. I used something like this to turn my bitmap into an alpha shadow:ImageAttributes ia;ColorMatrix colorMatrix = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, .50f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};ia.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);

Share this post


Link to post
Share on other sites
Guest Jon_Gibbs

No,I want to change the alpha value of a color for a pen. Not a bitmap.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...