<div dir="ltr">An update:<br><br><div>I implemented LRN's GTK+ 2 alterations to the Zetcode example (see also <a href="http://stackoverflow.com/questions/21102622/how-to-create-a-cairo-t-on-a-gtk-2-window">http://stackoverflow.com/questions/21102622/how-to-create-a-cairo-t-on-a-gtk-2-window</a>). I compiled against the same GTK+ 2 bundle as before, and rendering to the widget worked.<br><br></div><div>I then dropped in this code fragment into the example project to test image surface rendering:</div><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>cairo_surface_t *surface;</div><div>cairo_t *cr;</div><div><br></div><div>surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 390, 60);</div><div>cr = cairo_create(surface);</div><div><br></div><div>cairo_set_source_rgb(cr, 0, 0, 0);</div><div>cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);</div><div>cairo_set_font_size(cr, 40.0);</div><div><br></div><div>cairo_move_to(cr, 10.0, 50.0);</div><div>cairo_show_text(cr, "Test.");</div><div><br></div><div>cairo_surface_write_to_png(surface, "f:\\cairo_test_basic.png");</div><div><br></div><div>cairo_destroy(cr);</div><div>cairo_surface_destroy(surface);<br></div></blockquote><br></div><div>This also worked, outputting the expected PNG file.<br><br>However, this same code fragment generates a blank PNG file in my main project. I have the same GTK-related parameters in both VS projects' settings (as per <a href="http://stackoverflow.com/questions/15906580/how-to-configure-gtk-on-visual-studio-2010">http://stackoverflow.com/questions/15906580/how-to-configure-gtk-on-visual-studio-2010</a>).</div><div><br></div><div>The only difference in output when building each is that I get a dozen linker warnings for my main project, all of the form:<br><br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>1>gdk-win32-2.0.lib(libgdk-win32-2.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32-2.0-0.dll); second definition ignored</div><div>1>gdk-win32-2.0.lib(libgdk-win32-2.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library<br><br></div></div></blockquote>I'd appreciate any advice.</div><div><br></div><div>Jeff.</div><div class="gmail_extra"><br><div class="gmail_quote">On 22 January 2017 at 22:41, Jeffrey Sheen <span dir="ltr"><<a href="mailto:jeffrey.sheen00@alumni.imperial.ac.uk" target="_blank">jeffrey.sheen00@alumni.imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Thanks. I'll try the suggested syntax for the GDK Window example, and find an earlier API reference.</div><div dir="auto"><br></div><div dir="auto">However, I have also tried rendering with an image context, and the resulting PNG was blank too.</div><div dir="auto"><br></div><div dir="auto">Is it possible that I'm having the same issue here (the API has changed, but for Cairo specifically)?</div><div dir="auto"><br></div><div dir="auto">What I'll do is build against the very latest stable GTK libs, to check whether the code functions as expected in the reference examples (i.e. pixels are rendered).</div><div dir="auto"><br></div><div dir="auto">Then, given Windows XP is a target platform, what is the latest version of the Cairo libs that I can build against? N.B. I'm using Cairo in combination with Pango for image surface rendering only.</div><div dir="auto"><div class="gmail_extra" dir="auto"><br><div class="gmail_quote"><div><div class="gmail-h5">On 22 Jan 2017 21:28, "LRN" <<a href="mailto:lrn1986@gmail.com" target="_blank">lrn1986@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail-m_-4183835972798227105quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5"><div class="gmail-m_-4183835972798227105quoted-text">On 22.01.2017 23:24, Jeffrey Sheen wrote:<br>
> Dear list,<br>
><br>
> I'm trying to incorporate Cairo rendering into a cross-platform project.<br>
> Windows XP is a target platform for the project, so I am building against the<br>
> GTK+ 2.24.10 Bundle (20120208). N.B. This is a C/C++ implementation.<br>
><br>
> The problem I'm having is that no Cairo backend contexts are rendering pixels<br>
> to their surfaces.<br>
><br>
> I've tried the examples on the Zetcode guides for a PNG image surface and GTK<br>
> Window: <a href="http://zetcode.com/gfx/cairo/cairobackends/" rel="noreferrer" target="_blank">http://zetcode.com/gfx/cairo/c<wbr>airobackends/</a><br>
<br>
</div>These are for GTK3, i think. For GTK2 you need to do something like this:<br>
<br>
...<br>
  g_signal_connect(G_OBJECT(dare<wbr>a), "expose-event",<br>
      G_CALLBACK(on_expose_event), NULL);<br>
...<br>
<br>
static gboolean<br>
on_expose_event (GtkWidget      *widget,<br>
                 GdkEventExpose *event,<br>
                 gpointer        data)<br>
{<br>
  cairo_t *cr;<br>
<br>
  cr = gdk_cairo_create (gtk_widget_get_window (widget));<br>
<br>
  do_drawing (cr);<br>
<br>
  cairo_destroy (cr);<br>
<br>
  return FALSE;<br>
}<br>
<font color="#888888"><br>
<br>
--<br>
O< ascii ribbon - stop html email! - <a href="http://www.asciiribbon.org" rel="noreferrer" target="_blank">www.asciiribbon.org</a><br>
</font><br></div></div><span class="gmail-HOEnZb"><font color="#888888">--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="https://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">https://lists.cairographics.or<wbr>g/mailman/listinfo/cairo</a><br></font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>