如何在诡计中创造开罗表面

时间:2010-09-29 11:56:59

标签: scheme cairo guile

我有这段代码

guile> (cairo-pdf-surface-create "foo.pdf" 100.0 100.0)
; and get this error
standard input:29:1: In procedure cairo-pdf-surface-create in expression (cairo-pdf-surface-create "foo.pdf" 100.0 ...):
standard input:29:1: Wrong type (expecting string): 100.0
ABORT: (wrong-type-arg)

当我使用字符串作为宽度和高度时

guile> (cairo-pdf-surface-create "foo.pdf" "100.0" "100.0")

Backtrace:
In standard input:
  30: 0* [cairo-pdf-surface-create "foo.pdf" {"100.0"} "100.0"]

standard input:30:1: In procedure cairo-pdf-surface-create in expression (cairo-pdf-surface-create "foo.pdf" "100.0" ...):
standard input:30:1: Wrong type (expecting real number): "100.0"

文档说:

  

cairo-pdf-surface-create(filename< char>)[功能]
  (宽度在点   < double>)(高度在点< double>)
  ⇒(ret< cairo-surface-t>)

1 个答案:

答案 0 :(得分:3)

至少在最新版本中,试试这个:

(cairo-pdf-surface-create 100.0 100.0 "foo.pdf")

请参阅the source,它以(sx sy filename)的顺序指定参数,文件名是可选的(如果未指定,则使用当前输出端口)。