[Gambas-user] About Image.Pixel
Benoit Minisini
benoit.minisini at gambas-basic.org
Wed Aug 16 13:08:56 CEST 2023
Le 15/08/2023 à 20:28, T Lee Davidson a écrit :
>
> That would work for a color with full opacity, but not necessarily for a
> color with any transparency.
>
> But, when playing around with this, I am getting some weirdness:
> This code (using Qt5):
> [code]
> Public Sub Form_Open()
>
> Dim hImg As New Image(1, 1, Color.Red)
>
> Print Hex(Color.Red)
> Print SizeOf(Color.Red)
> Print Hex(hImg.Pixels[0])
> ' Print SizeOf(hImg.Pixels[0]) ' <--- this causes a segmentation fault
>
> End
> [/code]
>
> Produces:
> FF0000
> 8
> FFFFFFFFFFFF0000
> !SegFault
>
> The size of Color.Red is 8 bytes, 64 bits? Shouldn't it be 4 bytes for
> 32 bits?
> Am I missing something, or is my Gambas corrupted?
>
>
The crash has been fixed in commit
https://gitlab.com/gambas/gambas/-/commit/c10a03cb59f24cca6bed231320f95798d3f660d3.
Read the documentation of SizeOf() to understand how to use it.
Regards,
--
Benoît Minisini.
More information about the User
mailing list