unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Example usages of guile-cairo
@ 2016-07-06 20:01 Panicz Maciej Godek
  2016-07-15 20:19 ` Vladimir Zhbanov
  2016-08-04 21:06 ` Andy Wingo
  0 siblings, 2 replies; 5+ messages in thread
From: Panicz Maciej Godek @ 2016-07-06 20:01 UTC (permalink / raw)
  To: guile-user@gnu.org

Hi,
I've been trying to cooperate with guile-cairo. However, the documentation
serves as a reference rather than a tutorial, and I've been trying to agree
the tutorial from the Cairo website with guile bindings, to no avail.

After evaluating the following code, the svg (or pdf) file gets generated,
but it is (in both cases) completely blank. The textual content of the svg
and pdf files suggests that the drawing commands have indeed been issued,
but apparently something's wrong.

(cairo-version) reports 11406.

So, here comes the code (based on the first snippet in the "Drawing with
Cairo" section from https://cairographics.org/tutorial/).

Note (BUG) by the way, that the order of arguments to
cairo-*-surface-create is reversed compared to the documentation, which
claims that the output file name should come first.


(use-modules (cairo))


(define s (cairo-svg-surface-create 200 300 "test.svg"))


;;(define s (cairo-pdf-surface-create  300.0 200.0 "test.pdf"))


(define c (cairo-create s))


(cairo-set-source-rgb c 0 0 0)


(cairo-move-to c 0 0)


(cairo-line-to c 1 1)


(cairo-move-to c 1 0)


(cairo-line-to c 0 1)


(cairo-set-line-width c 0.2)


(cairo-stroke c)


(cairo-rectangle c 0 0 0.5 0.5)


(cairo-set-source-rgba c 1 0 0 0.80)


(cairo-fill c)


(cairo-rectangle c 0 0.5 0.5 0.5)


(cairo-set-source-rgba c 0 1 0 0.60)


(cairo-fill c)


(cairo-rectangle c 0.5 0 0.5 0.5)


(cairo-set-source-rgba c 0 0 1 0.40)


(cairo-fill c)


(cairo-surface-finish s)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-04 21:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-06 20:01 Example usages of guile-cairo Panicz Maciej Godek
2016-07-15 20:19 ` Vladimir Zhbanov
2016-07-16  8:05   ` Panicz Maciej Godek
2016-07-27 19:30     ` Vladimir Zhbanov
2016-08-04 21:06 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).