(define (cairo-graphics/open make-device #!optional width height)
(let ((width (if (default-object? width) 512 width))
(height (if (default-object? height) 384 height)))
- (guarantee-positive-fixnum width 'cairo-graphics/open)
- (guarantee-positive-fixnum height 'cairo-graphics/open)
+ (guarantee positive-fixnum? width 'cairo-graphics/open)
+ (guarantee positive-fixnum? height 'cairo-graphics/open)
(make-device (make-cairo-graphics width height))))
(define (cairo-graphics/close device)
(let ((msg (C-call "cairo_status_to_string"
(make-alien '(* (const char)))
status)))
- (error msg surface)))))
+ (error (utf8->string (c-peek-cstring msg)) surface)))))
(define (guarantee-cairo-surface object operator)
(if (and (alien? object) (eq? (alien/ctype object) '|cairo_surface_t|))
(define (cairo-surface-write-to-png surface filename)
(guarantee-cairo-surface surface 'cairo-surface-write-to-png)
- (guarantee-string filename 'cairo-surface-write-to-png)
- (C-call "cairo_surface_write_to_png" surface filename))
+ (guarantee string? filename 'cairo-surface-write-to-png)
+ (C-call "cairo_surface_write_to_png" surface (string->utf8 filename)))
(define (cairo-surface-flush surface)
(guarantee-cairo-surface surface 'cairo-surface-flush)
(let ((msg (C-call "cairo_status_to_string"
(make-alien '(* (const char)))
status)))
- (error msg pattern)))))
+ (error (utf8->string (c-peek-cstring msg)) pattern)))))
(define (guarantee-cairo-pattern object operator)
(if (and (alien? object) (eq? (alien/ctype object) '|cairo_pattern_t|))
(let ((msg (C-call "cairo_status_to_string"
(make-alien '(* (const char)))
status)))
- (error msg cairo)))))
+ (error (utf8->string (c-peek-cstring msg)) cairo)))))
(define (guarantee-cairo object operator)
(if (and (alien? object) (eq? (alien/ctype object) '|cairo_t|))
(define (cairo-show-text cairo string)
(guarantee-cairo cairo 'cairo-show-text)
- (guarantee-string string 'cairo-show-text)
- (C-call "cairo_show_text" cairo string))
+ (guarantee string? string 'cairo-show-text)
+ (C-call "cairo_show_text" cairo (string->utf8 string)))
(define (cairo-paint cairo)
(guarantee-cairo cairo 'cairo-paint)