Adventure Game Studio

AGS Development => Editor Development => Topic started by: Monsieur OUXX on Mon 08/07/2013 16:46:47

Title: Documentation: "GetPixel" article is incomplete
Post by: Monsieur OUXX on Mon 08/07/2013 16:46:47
The manual doesn't say that "GetPixel()" returns -1 (constant COLOR_TRANSPARENT) on transparent pixels, even in a 32-bits game.

On a side note, that also answers the question: "how the hell do I know if a pixel is transparent, considering the top-left corner of the image is not necessarily pink in the images I import?".
Title: Re: Documentation: "GetPixel" article is incomplete
Post by: Ryan Timothy B on Mon 08/07/2013 16:53:45
I'm pretty sure AGS changes the color in the sprite of "top-left corner" etc, to COLOR_TRANSPARENT. Or that wasn't your question.
Title: Re: Documentation: "GetPixel" article is incomplete
Post by: Kitai on Mon 08/07/2013 17:41:11
I think M. OUXX had no question: he just points out that the manual does not (but should) say that whenever you pass the coordinates of a transparent pixel to GetPixel, it returns the value -1.
Once the user learns it, (s)he no longer wonders what value (naively the pink value) he should check for in order to know whether the pixel he's looking at is transparent or not.
Title: Re: Documentation: "GetPixel" article is incomplete
Post by: Monsieur OUXX on Tue 09/07/2013 11:25:44
Quote from: Kitai on Mon 08/07/2013 17:41:11
I think M. OUXX had no question: he just points out that the manual does not (but should) say that whenever you pass the coordinates of a transparent pixel to GetPixel, it returns the value -1.
Once the user learns it, (s)he no longer wonders what value (naively the pink value) he should check for in order to know whether the pixel he's looking at is transparent or not.

Exactly. I was expecting pink. Or the top-left color. I had to debug to find out that GetPixel was actually returning -1. And I had to search the forums to learn that "-1" was known as macro COLOR_TRANSPARENT.