Jump to content

Recommended Posts

Posted

Hi guys, I need a little help...

I'm coding a "game" using GDI+ and want to keep it based 100% on AutoIT. The problem is that the game uses "sprites" and each sprite has a background color, this color need to be removed when the "sprite" is printed on the buffer.

Right now I'm using this code:

hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
global $hIA = _GDIPlus_ImageAttributesCreate() ;create an ImageAttribute object
_GDIPlus_ImageAttributesSetColorKeys($hIA, 0, True, 0xFF640064, 0xFFffaaff) ;make a range of colors transparent

But the problem is that I want to remove ONLY the color 225,0,225 and the values 0xFF640064 / 0xFFffaaff remove lots of shades of the 225,0,225.
I had tried many combinations of values, but I didnt find the right range to remove only the 225,0,225 and let the other colors untouched.

I cant post the entire code because it wont run without all the bmps and wav files, but maybe this video will serve as example of what I'm talking about...
look at the control pannel at the top left, there are missing pixels there because the values used (0xFF640064, 0xFFffaaff) remove many colors, not just the 225,0,225.
https://www.facebook.com/urls.can.decieve.you.little.one/videos/344118782625198/
Here is a sprite example
 

Can someone help me, please?
 

 

 

m1a2.bmp

Posted
1 hour ago, SiegfriedSchlieper said:

Hi guys, I need a little help...

I'm coding a "game" using GDI+ and want to keep it based 100% on AutoIT. The problem is that the game uses "sprites" and each sprite has a background color, this color need to be removed when the "sprite" is printed on the buffer.

Right now I'm using this code:

hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
global $hIA = _GDIPlus_ImageAttributesCreate() ;create an ImageAttribute object
_GDIPlus_ImageAttributesSetColorKeys($hIA, 0, True, 0xFF640064, 0xFFffaaff) ;make a range of colors transparent

But the problem is that I want to remove ONLY the color 225,0,225 and the values 0xFF640064 / 0xFFffaaff remove lots of shades of the 225,0,225.
I had tried many combinations of values, but I didnt find the right range to remove only the 225,0,225 and let the other colors untouched.

I cant post the entire code because it wont run without all the bmps and wav files, but maybe this video will serve as example of what I'm talking about...
look at the control pannel at the top left, there are missing pixels there because the values used (0xFF640064, 0xFFffaaff) remove many colors, not just the 225,0,225.
https://www.facebook.com/urls.can.decieve.you.little.one/videos/344118782625198/
Here is a sprite example
 

Can someone help me, please?
 

 

 

m1a2.bmp

Well if you only wish to remove one color, just do:

_GDIPlus_ImageAttributesSetColorKeys($hIA, 0, True, 0xFFFF00FF, 0xFFFF00FF)

Or if you wish to remove the color, no matter the alpha channel:

_GDIPlus_ImageAttributesSetColorKeys($hIA, 0, True, 0x00FF00FF, 0xFFFF00FF)

 

Posted

Hey genius257

thanks for the reply

I finally found where I was getting lost... the problem isnt with the function, but with my sprites
Using the GIMP to convert real size images to little bmp's, when I use the selection tool to cut the edges of the image, it dont create a "plain cut" in the edge of the selected area, instead it merges some of the colors using a transparency factor
now using FF00FF and fixing the sprintes its working just fine

Many thanks for your time and attention!
It was a little detail but after so many tries I was really lost and frustrated

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...