<div dir="ltr">Hi!<div>I'm absolutely getting crazy and I need someone that give me a clue on this:</div><div><br></div><div>In this section of code:</div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">
<span style="color:rgb(187,44,162)">void</span> studio::Widget_NavView::on_finish_render()</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">        </span><span style="color:rgb(187,44,162)">if</span>(studio::App::navigator_uses_cairo)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">        </span>{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">if</span>(!cairo_surface)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:rgb(0,0,0)"><span class="" style="white-space:pre">                    </span>synfig::warning(</span>"dock_navigator: Bad cairo surface"<span style="color:rgb(0,0,0)">);</span></p>

<p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(187,44,162)"><span style="color:rgb(0,0,0)"><span class="" style="white-space:pre">                   </span></span>return<span style="color:rgb(0,0,0)">;</span></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>}</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><span class="" style="white-space:pre">                </span></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">if</span>(cairo_surface_status(cairo_surface))</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(187,44,162)"><span style="color:rgb(0,0,0)"><span class="" style="white-space:pre">                   </span></span>return<span style="color:rgb(0,0,0)">;</span></p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><span class="" style="white-space:pre">                </span></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>Target_Cairo::gamma_filter(cairo_surface);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">int</span> w = <span style="color:rgb(39,42,216)">0</span>, h = <span style="color:rgb(39,42,216)">0</span>;</p>

<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">int</span> dw = cairo_image_surface_get_width(cairo_surface);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">int</span> dh = cairo_image_surface_get_height(cairo_surface);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">if</span>(cairo_prev)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                        </span>w = cairo_image_surface_get_width(cairo_prev);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                        </span>h = cairo_image_surface_get_height(cairo_prev);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>}</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">if</span>( w!=dw || h!=dh || !cairo_prev)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                        </span>cairo_prev=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, dw, dh);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>}</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>synfig::info(<span style="color:rgb(209,47,27)">"cairo_surface is mapped %d"</span>, cairo_surface_is_mapped(cairo_surface)); <span style="color:rgb(0,132,0)">// is not mapped</span></p>

<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span><span style="color:rgb(187,44,162)">static</span> <span style="color:rgb(187,44,162)">int</span> pass2=<span style="color:rgb(39,42,216)">0</span>;</p>

<p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:rgb(0,0,0)"><span class="" style="white-space:pre">              </span></span>// Image written to file is correct</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_surface_write_to_png(cairo_surface, strprintf(<span style="color:rgb(209,47,27)">"dock_navigator_on_finish_render_cairo_surface-pass%d.png"</span>, pass2).c_str());</p>

<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_t* cr=cairo_create(cairo_prev);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_save(cr);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_set_source_surface(cr, cairo_surface, <span style="color:rgb(39,42,216)">0</span>, <span style="color:rgb(39,42,216)">0</span>);</p>

<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_paint(cr);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_restore(cr);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_destroy(cr);<br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>cairo_surface_write_to_png(cairo_prev, strprintf(<span style="color:rgb(209,47,27)">"dock_navigator_on_finish_render_cairo_prev-pass%d.png"</span>, pass2).c_str());</p>

<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">                </span>pass2++;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">        </span>}</p><p style="margin:0px;font-size:11px;font-family:Menlo">}</p><p style="margin:0px;font-size:11px;font-family:Menlo">
<br></p><p style="margin:0px;font-size:11px;font-family:Menlo"> <br></p><div><div style>the written to file images cairo_prev and cairo_surface doesn't coincide, how's that possible???</div><div style>In particular cairo_surface is correct (what I expect to be) and cairo_prev is simply transparent.</div>
<div style>If I can write a surface to png correctly, why I can't paint it to other surface??</div><div style>Thanks in advance!</div></div><div style><br></div>-- <br>Carlos<br><a href="http://synfig.org" target="_blank">http://synfig.org</a><br>

</div></div>