From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Panicz Maciej Godek <godek.maciek@gmail.com>
Newsgroups: gmane.lisp.guile.user
Subject: Example usages of guile-cairo
Date: Wed, 6 Jul 2016 22:01:52 +0200
Message-ID: <CAMFYt2aWLCOJxVqUtx-dj4P8oOPzUpD0R=QMfztPgy6Cn9P48w@mail.gmail.com>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1467835355 10799 80.91.229.3 (6 Jul 2016 20:02:35 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 6 Jul 2016 20:02:35 +0000 (UTC)
To: "guile-user@gnu.org" <guile-user@gnu.org>
Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jul 06 22:02:30 2016
Return-path: <guile-user-bounces+guile-user=m.gmane.org@gnu.org>
Envelope-to: guile-user@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <guile-user-bounces+guile-user=m.gmane.org@gnu.org>)
	id 1bKt1e-0005BK-Hg
	for guile-user@m.gmane.org; Wed, 06 Jul 2016 22:02:26 +0200
Original-Received: from localhost ([::1]:35617 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guile-user-bounces+guile-user=m.gmane.org@gnu.org>)
	id 1bKt1d-0005Hw-Km
	for guile-user@m.gmane.org; Wed, 06 Jul 2016 16:02:25 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51843)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <godek.maciek@gmail.com>) id 1bKt1C-0005Hq-9Q
	for guile-user@gnu.org; Wed, 06 Jul 2016 16:01:59 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <godek.maciek@gmail.com>) id 1bKt19-0007Ko-6c
	for guile-user@gnu.org; Wed, 06 Jul 2016 16:01:57 -0400
Original-Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:37260)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <godek.maciek@gmail.com>) id 1bKt18-0007Kc-Rj
	for guile-user@gnu.org; Wed, 06 Jul 2016 16:01:55 -0400
Original-Received: by mail-wm0-x22a.google.com with SMTP id a66so6494213wme.0
	for <guile-user@gnu.org>; Wed, 06 Jul 2016 13:01:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:from:date:message-id:subject:to;
	bh=EgROhNYEDw/LYWDrsQ9FY2Lgaonh1HHA7PS1KOTZ7H8=;
	b=ftrBV6VRXDYC+SUtVACGct2DOwjSRg9erz4IpuJw/hZHPZKdhzfcUtO+yFbBjDINF1
	B/KVuqdb6AUKSzIJePTLpoW3GZEyxakfE/W/1RubOuR3nJvpz6StvMK663tN4BAzUHC4
	04lVvomqhyCRieORRlSiiROHwztJSccFyupcnets4QaiMnXGUaHhLAFw41qBqTZMG0Nq
	e/m3YRHEILmKJo2ahQCuBoOvxOOZ/3EXwmQR43aKgOMGLvS/mj+60fOoTfsPPrhTdbvM
	D2LsyU5Ga7ZHHJwNlIa8VRUPGfobdaZuaDrszsxrisg1lzOBtX3SXD5+n+2nuzyxc004
	87ew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=EgROhNYEDw/LYWDrsQ9FY2Lgaonh1HHA7PS1KOTZ7H8=;
	b=PHP819UibgKOjUqzTT40hsAaWmOWeNT69jyVMMwVPleHs6gcp9gHV7G4QTT78klw//
	ahXjbxYvOOM63wdpnRDCh9azDGyBkJTVagYRAooJIRNwCIeCf6bNyejgFHxxwQQiqKTU
	T38N1J3vi4iard6cHFvop5oddU2H2R4unUvI3v/QqaCuIoVX2YGW5uPeWAdToKqtKK3f
	w8RG+j5BUwGWP3Ezq189kcreCtENqLt9v9Gvmfbxi2MhhioUSh7cg6zpz+fo2rKjWrf4
	dmw68HdpcjB6wwFIcpFuZkZU+xBdhXkgRVWk8SmuyHpQKjAI0u7ngv+0IX9ii+bssyg+
	r+9g==
X-Gm-Message-State: ALyK8tInYEoBVzQrrumrTZaLLz5exprFUucxrjfWvl+6elCfXRhCTCkL+wobzIwa7fRf4pV7xGoTl4HQdhlFLw==
X-Received: by 10.194.55.136 with SMTP id s8mr22016430wjp.134.1467835313514;
	Wed, 06 Jul 2016 13:01:53 -0700 (PDT)
Original-Received: by 10.194.179.98 with HTTP; Wed, 6 Jul 2016 13:01:52 -0700 (PDT)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::22a
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: guile-user@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: General Guile related discussions <guile-user.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guile-user>,
	<mailto:guile-user-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/guile-user/>
List-Post: <mailto:guile-user@gnu.org>
List-Help: <mailto:guile-user-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guile-user>,
	<mailto:guile-user-request@gnu.org?subject=subscribe>
Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org
Original-Sender: "guile-user" <guile-user-bounces+guile-user=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.lisp.guile.user:12729
Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.user/12729>

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)