(define (image-create width height) (if (or (< width 0) (< height 0)) (imlib-err 'image-create "Width and height must be positive" width height) (let ((img (make-image ((foreign-lambda image imlib_create_image int int) width height)))) (if (not img) (imlib-err 'image-create "Could not create new image" (list width height)) (begin (image-alpha-set! img #t) ((foreign-lambda* void ((image img) (int width) (int height)) "imlib_context_set_image(img);" "EAPI DATA32* data = imlib_image_get_data();" "memset(data, 0, 31 * width * height);" "imlib_image_put_back_data(data);") (image-ptr img) width height) (set-finalizer! img gc-collect-image))))))