<div>Hi,</div><div><br></div><div>If you stroke each line you need (on my system) 500 bytes per line. That would be 10GB RAM. I don't have that. You can use swap (and you need 64 bits), but it will be very slow.</div><div>
<br></div><div>If you try to create a path with 20 milion subpaths, cairo will fail silently(!!!) which I think is a bug.</div><div><br></div><div>What I did, is stroke the path every 1000 lines. That does work. I don't know if acroread can open it. Evince can, but it takes a long time. Files like this can break all sorts of software.</div>
<div><br></div><div>Rendering to PNG or JPEG might be the right thing to do. You need to experiment what resolution works best for you. It will always (as long the image is not 100s of mega pixels) be faster to view than PDF files.</div>
<div><br></div><div>Groeten, Arjen</div><div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> while(t<ITER_NO) {</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> cairo_move_to (cr, 229770, -26573.7);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> cairo_line_to (cr, 231202, -24967.3);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> ++t;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> if (t % 1000 == 0)</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> cairo_stroke(cr);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> std::cout<<"Drawn so far:"<<((double)t/(double)ITER_NO)*100<<"%"<<std::endl;</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace"> }</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div></div><div><br></div><div><br></div><div class="gmail_quote">
On Mon, Aug 30, 2010 at 10:39 AM, necko necko <span dir="ltr"><<a href="mailto:opustenom@hotmail.com">opustenom@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
As for the cairo version, I simply followed the steps for Ubuntu, from<br><a href="http://www.cairographics.org/download/" target="_blank">http://www.cairographics.org/download/</a><br>This means I only typed<br><pre><code>sudo apt-get install libcairo2-dev<br>
<br>Below is the code that reproduces the problem. Setting ITER_NO to<br>20000, for example, produces regular pdf file. But, setting it to<br>20000000 seems not to be appropriate.<br><br>I hope you would have suggestions on how to achieve the goal of<br>
representing large number of lines.<br>Also, I'm interested in whether the png version of the resulting output<br>file would be lighter and easier (less time consuming) to view using regular<br>viewer. Your suggestions on this might also be helpful.<br>
</code></pre>code:<br><br>#include <cairo.h><br>#include <cairo-pdf.h><br>#include <sstream><br>#include <cmath> <br>#include <vector> <br>#include <limits.h><br>#include <queue><br>
#include <algorithm><br>#include <numeric><br>#include <iostream><br>int main() {<br> cairo_surface_t *surface;<br> cairo_t *cr;<br><br> std::stringstream myOut; int k=1;<br> myOut<<"forGallery"<<k<< ".pdf";<br>
surface = cairo_pdf_surface_create(myOut.str().c_str(), 1432, 1606);<br> cr = cairo_create(surface);<br> cairo_translate (cr, -229770, 26573.7); // -40, 50: for margin -37, 53<br><br> unsigned int t=0; unsigned int ITER_NO=20000000;<br>
while(t<ITER_NO) {<br> cairo_move_to (cr, 229770, -26573.7);<br> cairo_line_to (cr, 231202, -24967.3);<br> std::cout<<"Drawn so far:"<<((double)t/(double)ITER_NO)*100<<"%"<<std::endl;<br>
++t;<br> }<br> <br> cairo_stroke(cr);<br> cairo_show_page(cr);<br> cairo_surface_destroy(surface);<br> cairo_destroy(cr);<br><br> return 0;<br><br>}<br><br>> Date: Sun, 29 Aug 2010 21:41:23 +0200<br>> Subject: Re: [cairo] Very large number of lines<br>
> From: <a href="mailto:a.g.nienhuis@gmail.com" target="_blank">a.g.nienhuis@gmail.com</a><br>> To: <a href="mailto:opustenom@hotmail.com" target="_blank">opustenom@hotmail.com</a><br>> CC: <a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a>; <a href="mailto:cairo-bugs@cairographics.org" target="_blank">cairo-bugs@cairographics.org</a><div>
<div></div><div class="h5"><br>> <br>> What version of cairo do use?<br>> Did you finish() the surface?<br>> Can you send a simple program (source code) that reproduces the problem?<br>> <br>> Groeten, Arjen<br>
> <br>> On Sunday, August 29, 2010, necko necko <<a href="mailto:opustenom@hotmail.com" target="_blank">opustenom@hotmail.com</a>> wrote:<br>> ><br>> ><br>> ><br>> ><br>> ><br>> > The pdf output file is supposed to display very large number of lines, connections<br>
> > between a number of points. This is the code sample which specifies around 8million<br>> > lines:<br>> > .............<br>> > while (myIter!=edges.end()) {<br>> > .......<br>> > cairo_move_to (cr, *firstIter, *(firstIter+1));<br>
> > cairo_line_to (cr, *secondIter, *(secondIter+1));<br>> > ..........<br>> > ++myIter;<br>> > }<br>> > cairo_set_line_width (cr, .05);<br>> > cairo_stroke (cr);<br>> > .........................<br>
> > Note that the above code produces pdf files which were viewed with Evince, but not<br>> > with Adobe Reader (drawing error occurred, shown in the report window).<br>> > I used the same code for showing larger number of lines, more than 20million. The output<br>
> > pdf files had names as specified, but their size was around 400 bytes, and when I try to<br>> > open them, they are simply empty(white, in Evince), while Adobe says that the file has no<br>> > pages to display.<br>
> > In order to overcome this problem, I put stroke() within the while() loop, but when I tried<br>> > to draw files showing more than 20million lines, the process got "Killed" (Ubuntu Linux) at<br>> > around 33% of the total.<br>
> > .............................<br>> > What would be the way to properly draw the pdf file specifying very large number of lines?<br>> > What would be the code to try? Note that the variations work properly with smaller number<br>
> > of lines.<br>> ><br>> > Thanks<br>> >                                           <br>> ><br>                                            </div></div></div>
</blockquote></div><br>