[Gambas-user] About Image.Pixel

Benoit Minisini benoit.minisini at gambas-basic.org
Tue Aug 15 12:37:02 CEST 2023


Le 15/08/2023 à 00:37, Bruce Steers a écrit :
> 
> 
> On Mon, 14 Aug 2023, 21:19 Fabien Bodard, <gambas.fr at gmail.com 
> <mailto:gambas.fr at gmail.com>> wrote:
> 
>     Hi,
> 
>     Dim hImg As New Image(1, 1, Color.red)
>     dim a as Integer[]
> 
>     a = hImg.Pixels
>        Print a[0]
>        Print hImg[0, 0]
> 
>     result :
>     -65536
>     16711680
> 
> 
>     Why ?
> 
>     -- 
>     Fabien Bodard
> 
> 
> According to wiki Image[x,y] returns a "colour"
> Image.pixels[n] will be from an array of "32 bits integers"
> 
> I don't understand it but seems could be a difference?
> 
> 
> Respects
> BruceS
> 
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Gambas colors use BGRA format with alpha component inverted.

             A R G B
-65536   -> FFFF0000
16711680 -> 00FF0000

The 'Pixels' property returns a copy of the image data, whose format can 
be (almost) anything (read the 'Format' property of the image), with the 
alpha component never inverted.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list