[Gambas-user] About Image.Pixel
T Lee Davidson
t.lee.davidson at gmail.com
Tue Aug 15 20:28:27 CEST 2023
On 8/15/23 12:44, Bruce Steers wrote:
> On Tue, 15 Aug 2023 at 16:55, vuott--- via User <user at lists.gambas-basic.org <mailto:user at lists.gambas-basic.org>> wrote:
> Public Sub Form_Open()
> Dim hImg As New Image(1, 1, Color.Red)
> Print "red = "; Color.Red
> Print hImg.Pixels
> Print Val("&" & Hex(hImg.Pixels, 6) & "&"), Hex(hImg.Pixels, 8)
> Print hImg[0, 0]
> Hehe, yes i was absolutely 100% sure i was not doing it the easiest way, and maybe not even correctly ;)
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):
Public Sub Form_Open()
Dim hImg As New Image(1, 1, Color.Red)
' Print SizeOf(hImg.Pixels) ' <--- this causes a segmentation fault
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?
More information about the User