spiffen Posted April 7, 2009 Share Posted April 7, 2009 Hi. I'm currently working on a game where I do some simple pixel modifications when loading graphics. What I tried to do was to build a function that could take two RGBA values and add them, but I'm having real trouble with the alpha values. I know how to do it when using only RGB colors but when including alpha everything gets much trickier. Since I use Paint.NET when creating graphics and I know it can blend these colors very well, I'm hoping any developer or pixel color expert can help me how to write a function like this: u32 blendPixel(u32 baseColor, u32 paintColor) { u8 baseRed = getRed(baseColor); u8 baseGreen = getGreen(baseColor); u8 baseBlue = getBlue(baseColor); u8 baseAlpha = getAlpha(baseColor); u8 paintRed = getRed(paintColor); u8 paintGreen = getGreen(paintColor); u8 paintBlue = getBlue(paintColor); u8 paintAlpha = getAlpha(paintColor); u8 newRed = ??? u8 newGreen = ??? u8 newBlue = ??? u8 newAlpha = ??? return makecol(newRed, newGreen, newBlue, newAlpha); } Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted April 7, 2009 Share Posted April 7, 2009 This isn't a programming forum - I suggest posting in the CodeProject or MSDN forums instead. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.