Poll results so far:<div><br></div><div>Yes: </div><div> 0.4%</div><div><br></div><div>No:</div><div> 0.4%</div><div><br></div><div>I don't care:</div><div> 99.2%<br><br><div class="gmail_quote">On Tue, Apr 20, 2010 at 1:40 PM, Arjen Nienhuis <span dir="ltr"><<a href="mailto:a.g.nienhuis@gmail.com">a.g.nienhuis@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><b>Proposal:<br></b><br><div>Implement an image operator for cairo.<br><br>It's possible to draw an image (the contents of an Image Surface) onto a cairo surface with the following code:<br>
<br><font face="'courier new', monospace">cairo_translate(...);<br>
cairo_scale(...);<br>cairo_set_source(...);<br>cairo_paint(...);<br></font><br>I'd like to propose to replace that with a single call to:<br><br><font face="'courier new', monospace">cairo_image(cr, src, x, y, width, height);</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Both SVG and PDF have this operator but Cairo has not.<br><br>
</font><b><font face="arial, helvetica, sans-serif">C Prototype:</font><br></b><br><font face="'courier new', monospace">cairo_image(<br> cairo_t *cr,<br> cairo_surface_t *source_image_surface,<br>
double x,<br> double y,<br> double width,<br> double height);<br></font><br></div><div><b>Implementation:</b></div><div><br></div><div>1: make a fallback wrapper like:</div><div><br></div><div>
<font face="'courier new', monospace">cairo_save();</font></div><span style="font-family:'courier new', monospace">cairo_translate(...);<br>cairo_scale(...);<br>
</span><div><span style="font-family:'courier new', monospace">...something about EXTEND...</span></div><div><font face="'courier new', monospace">cairo_set_source(...);<br>
cairo_paint(...);</font></div><div><font face="'courier new', monospace">cairo_restore();<br></font><br></div><div>2: For SVG and PDF (PS?) backends implement it with the native image operators: <font face="'courier new', monospace"><svg:image ...></font> and PDFs <font face="'courier new', monospace">/Image</font>. Now images are always pattern fills.</div>
<div><br></div><div><b>Pros:<br></b><br>- More readable code<br>- Cleaner PDF and SVG files</div><div> - Easier to edit with external tools (Inkscape, Acrobat)</div><div> - Processed faster by RIPs.</div><div> - This makes better round trips through poppler and rsvg.</div>
<div> - Counter: this can be done now by special casing some <font face="'courier new', monospace">cairo_fill()</font> calls.</div><div> - Counter: this seems hard</div><div><br>
<b>Cons:<br></b><br>- Larger external API needs to be maintained</div><div> - Counter: why implement <font face="'courier new', monospace">cairo_rectangle()</font> if you have <font face="'courier new', monospace">cairo_line_to()</font></div>
</blockquote></div><br></div>