Re: Trying out cairo2

"Hendrik Boom [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
On Mon, Jul 20, 2015 at 10:59:28AM +0200, Christophe Troestler wrote:
> On Sun, 19 Jul 2015 14:25:37 -0400, Hendrik Boom wrote:
> > 
> > But insteaad of trying to figure out oasis (another huge lump to swallow before I get anything going, aind I'm really not sure if I need to understand this until I have a bigger project, or am preparing a package for distribution) I just used
> > 
> >    ocamlfind ocamlopt -o foom -package cairo2,lablgtk2,cairo2.lablgtk2 -linkpkg foo.ml
> > 
> > and then 
> >    ./foom
> > gave me a window with some coloured circles.
> 
> That's fine.  oasis is especially interesting for projects that you want to package.
> 
> > Do I understand correctly that there's no user interaction in this program?
> 
> No, that's not the purpose of Cairo.  For user interaction, you would need to embed it in, say, a Gtk canva and use Gtk for user interaction.

Yes, that's what it looked like.  Just trying to avoid looking for 
what isn't there.

I adapted it to a program I had written about a year ago to produce a 
pdf.  Got a blank window.  Took a while to figure out that was because 
I was drawing black on black (dark grey) and ended up seeing nothing.
Made the necessary adjustments.

There seems to be no defined default background.  Back in the pdf days, 
I printed on a printer, and de default paper color was white, because 
that was the paper in the  printer.

So henceforth I'll start by painting the background!

Next I get to figure out how it knew how big to render my drawing 
within the window frame (defult turned out to be unexpectedly 
reasonable), and how to render text, and how to get events from gtk.

AAny advice about pango or gtk bindings to use or avoid?
 
Thank you.  This is a good start.

-- hendrik
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.