Alpha channel issue (AGS 3.2)

Started by Dave Gilbert, Sat 21/08/2010 22:24:33

Previous topic - Next topic

Dualnames

enum eBlendModes{
  eBlendNormal = 0,
  eBlendDarken = 1,   
  eBlendLighten = 2,
  eBlendMultiply = 3,
  eBlendAdd = 4,
  eBlendSubtract = 5,
  eBlendDifference = 6,
  eBlendNegation = 7,
  eBlendScreen = 8,
  eBlendExclusion = 9,
  eBlendOverlay = 10,
  eBlendSoftlight = 11,
  eBlendHardlight = 12,
  eBlendColorDodge = 13,
  eBlendColorBurn = 14,
  eBlendLinearDodge = 15,
  eBlendLinearBurn = 16,
  eBlendLinearLight = 17,
  eBlendVividLight = 18,
  eBlendPinLight = 19,
  eBlendHardMix = 20,
  eBlendReflect = 21,
  eBlendGlow = 22,
  eBlendPhoenix = 2



Does those modes work for realz?
Cause if they do, I'm marrying you Calin.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Calin Leafshade

they should do, although I havent tested them all against the photoshop versions.

Also I had to make up the code that factors in the alpha channel so I cant guarantee that alpha blending is exactly the same as photoshop handles it.

I can't really see how people would really use these at runtime except for very niche effects but ya know.. I answered the call of justice!

Dualnames

Quote from: Calin Leafshade on Tue 24/08/2010 08:20:42
they should do, although I havent tested them all against the photoshop versions.

Also I had to make up the code that factors in the alpha channel so I cant guarantee that alpha blending is exactly the same as photoshop handles it.

I can't really see how people would really use these at runtime except for very niche effects but ya know.. I answered the call of justice!

I can use those at runtime, they'd be like WOW. Well, downloading before you realize your mistake.
*I'm just being so badass today!*
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Calin Leafshade

#23
oh also, update to the usage:

DrawSprite(dest.Graphic, src.Graphic, x, y, mode, trans);

trans is in the same format as AGS (0 = opaque)

Edit: Fixed some issues with the coordinate system and normal blending:

http://www.thethoughtradar.com/AGS/agsblend055.zip

Knox

If its not too much to ask, is it possible to add something like this as a function to your plugin? (quicker and more compact then doing it old school, I think) :

greyValue = GetRGB(alphaSprite.Graphic, x, y);
PutAlpha(inv_curs.Graphic, x, y, greyValue);

We can then get gray values from an opaque black and white sprite and convert it into transparency with your PutAlpha :D

(unless of course Im retarded and this exists already) **but not GetColorFromRGB**
--All that is necessary for evil to triumph is for good men to do nothing.

Calin Leafshade

in a monochrome colour all the values of RGB are the same so you just need to grab one of them.

this function will do that

Code: ags

enum eRGBComponent {
  eRed, 
  eGreen,
  eBlue,
  };

function GetRGBComponent(int color, eRGBComponent component) {
  if (component == eRed) return 8*(color/2048);
  if (component == eGreen) return 8*((color%2048)/64);
  int b = (8*((color%2048)%64));
  if (b > 255) return (8*(((color%2048)%64)-31))-1;
  return b;
  }


The red colour value is the least computationally expensive one so use that one.

SMF spam blocked by CleanTalk