Hi Christian,
It appears that
PictureMBS.RowInFormat(y,ImageFormatRGBA)
is returning premultiplied RGBA data, even on Win32 which doesn't use
Premultiplied alpha.
Here's a little test:
#if TargetWin32
app.UseGDIPlus = true
#endif
dim p as new picture(128,128) // new-style 32 bit xojo picture
dim c as color = &cFF000080 // Red = 255, Green = 0, Blue = 0, Alpha = 128
p.Graphics.ForeColor = c
p.Graphics.FillRect 0,0,p.width,p.height
dim rgba as color = p.RGBSurface.Pixel(0,0)
MsgBox "Pixel RGBA = " + str(rgba.Red) + " " + str(rgba.Green) + " " +
str(rgba.blue) + " " + str(rgba.Alpha)
// now make a pictureMBS and get the data
dim pm as new PictureMBS(p, p.HasAlphaChannel)
dim mb as MemoryBlock = pm.RowInFormat(0,PictureMBS.ImageFormatRGBA)
MsgBox "Data RGBA = " + str(mb.byte(0)) + " " + str(mb.byte(1)) + " " +
str(mb.byte(2)) + " " + str(mb.byte(3))
On both Mac and Windows, I get
Pixel RGBA = 255, 0, 0, 127
Data RGBA = 127, 0, 0, 127
I would expect to get
Data RGBA = 255, 0, 0, 127
on both platforms, although I suppose you could argue that on Mac perhaps the
premultiplied values are "right".
Is there any way I can work around this and get the raw RGBA data, not
premultiplied?
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info