[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] imlib2 and define/clone
From: |
Graham Fawcett |
Subject: |
[Chicken-users] imlib2 and define/clone |
Date: |
Tue, 20 Feb 2007 19:26:08 -0500 |
Hi Peter,
The (define/clone) syntax in imlib2 isn't quite right: it never
returns a copy of the cloned object. (So, for example, (imlib:blur
my-image) returns an undefined value, instead of a blurred clone of
my-image.
(define-syntax define/clone
(syntax-rules ()
((define/clone ?name ?name!)
(define (?name img . args)
(apply ?name! (imlib:clone img) args)))))
Maybe your destructive versions used to return a copy of the image?
I don't use syntax-rules much, but I think this is right:
(define-syntax define/clone
(syntax-rules ()
((define/clone ?name ?name!)
(define (?name img . args)
(let ((clone (imlib:clone img)))
(apply ?name! clone args)
clone)))))
Cheers,
Graham
- [Chicken-users] imlib2 and define/clone,
Graham Fawcett <=