[cairo] Image surface pixel twiddling API
T Rowley
tor at cs.brown.edu
Mon Mar 5 12:20:21 PST 2007
In implementing SVG filters in mozilla, we have the need to access and
modify individual pixels of an image. Our existing code relied on a
particular byte layout, which broke when tested on a big-endian cpu for
reasons that were obvious after taking a close read of cairo.h.
We would like an API to obtain the particular channel of a pixel. In
our experiments we tried two different types of API. The first was a
set of macros that returned a particular channel from pixel word [1],
the second were channel offset macros that could be used to index into a
byte pointer. For our use, the first approach of word accessors made
for somewhat messier source code and generated code that was slightly
slower for x86 though faster on PPC [3]. For that reason we're more in
favor of the channel offsets, but would like to hear feedback from
others about what seems best.
[1] https://bugzilla.mozilla.org/attachment.cgi?id=254325
[2] https://bugzilla.mozilla.org/attachment.cgi?id=256528
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=369528#c9
More information about the cairo
mailing list