Thank you guys,<br><br>I will try and let you know when it works.<br>Regards,<br><br>Steve<div class="gmail_extra"><br><br><div class="gmail_quote">2012/11/5 Bill Spitzak <span dir="ltr"><<a href="mailto:spitzak@gmail.com" target="_blank">spitzak@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Cairo wants pre-multiplied data for the OVER composite. This likely means that the green value should depend on y just like the alpha value does. Ie set the green to (y < 50 ? 0 : 50 * (y - 50)/height)<br>

<br>
Also I recommend filling in the buffer as 32-bit words, rather than bytes. This is faster and will make the it work on a big-endian machine.<br>
<br>
unsigned char* buf = (unsigned char*)malloc(4*width*height);<br>
  cairo_surface_t* dataSurface = cairo_image_surface_create_<u></u>for_data (buf, CAIRO_FORMAT_ARGB32, width, height, rowLen);<br>
  for (y=0; y<height; y++)<br>
  {<br>
    for (x=0; x<width; x++)<br>
    {<br>
      //setColor(&buf[y*rowLen+x*4], 0x00FF00, y*255.0/3/height);<br>
      buf[y*rowLen+x*4+0] = 0;<br>
      buf[y*rowLen+x*4+1] = 50;<br>
      buf[y*rowLen+x*4+2] = 0;<br>
      buf[y*rowLen+x*4+3] = (y < 50 ? 0 : (y-50)*255.0/height);<br>
    }<br>
  }<br>
<br>
</blockquote></div><br></div>