Closed leftaroundabout closed 9 years ago
Wait a moment... actually the pixel-copying doesn't work right yet, at all. The blue and red channels are swapped, for one thing... I'll fix that. Done.
Any thoughts on this? @bergey ?
I'm not very familiar with JuicePixels or the raster parts of Cairo, but as far as I can tell, this looks good.
As I said, the re-newed text module seems to work fine, at least for me.
Here's another thing: The Cairo backend can so far only do external images. However, raster graphics are actually quite straightforward in Cairo. The only problem is that
Graphics.Rendering.Cairo.SurfaceData
is an abstractMArray
, whileCodec.Picture.Image
usesVector.Storable
. Both aren't directly compatible, so I implemented the copying with a manual loop over thebytes/pixel-components, which is of course inefficient and particularly annoying since both types are more or less just wrappers around C-arrays of exactly the same data! So, this isn't really a good final implementation, but it does work ok. Any ideas how it could be done more efficiently, without getting toounsafe
?It's still a loop now, but rather nicer: with the
ImageIPixels
traversal, over entire pixels (i.e.Word32
). And it's probably necessary, because the data is in fact not identical: JuicyPixels uses RGBA, while Cairo has ARGB, and one is big-endian, the other little-endian. So, effectively the red and blue channels are swapped; I implemented that with aData.Bits
rotation – probably quite optimal efficiency-wise.