Thanks Tobias! Your clue led me to the point in the source where it goes:
for name in (:finish,:flush,:mark_dirty)
@eval begin
$name(surface::CairoSurface) =
ccall(($(string("cairo_surface_",name)),_jl_libcairo),
Void, (Ptr{Void},), surface.ptr)
end
end
and finish(surface) appears to work well:
c = CairoPDFSurface("/tmp/helloworld.pdf",imwidth,imheight)
cr = CairoContext(c)
...
...
finish(c)
On Monday, November 3, 2014 9:03:10 PM UTC, Tobias Knopp wrote:
>
> Maybe use the Julia wrapper for "cairo_surface_flush"?
>
> Am Montag, 3. November 2014 17:27:23 UTC+1 schrieb [email protected]:
>>
>> This is my "Hello world" for Cairo in Julia outputting to PNG:
>>
>> using Cairo
>>
>> imwidth = 200
>> imheight = 200
>>
>> c = CairoRGBSurface(imwidth,imheight)
>> cr = CairoContext(c)
>>
>> set_source_rgba(cr, 1, 0.7, 0.2, 0.9)
>> set_line_width(cr, 1)
>> circle(cr, 100, 100, 50)
>> stroke(cr)
>>
>> select_font_face (cr, "Helvetica", Cairo.FONT_SLANT_NORMAL,
>> Cairo.FONT_WEIGHT_NORMAL)
>> set_font_size (cr, 12)
>> move_to(cr, 100,100)
>> show_text(cr,"Hello world")
>>
>> write_to_png(c,"/tmp/helloworld.png")
>> run(`open /tmp/helloworld.png`)
>>
>>
>> But I prefer to output to PDF. I've got as far as finding this:
>>
>> c = CairoPDFSurface("/tmp/helloworld.pdf", imwidth, imheight)
>>
>>
>> but there's isn't a write_to_pdf() function (obviously?). But I can't get
>> any output.
>>
>> Pkg.installed() gives:
>>
>> "Cairo" => v"0.2.20"
>>
>> and I'm on version 0.3.0.
>>
>>
>>