Welcome to the CHICKEN Scheme pasting service
imlib2 clearing image pasted by retroj on Sun Sep 11 23:17:34 2016
(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))))))
compilation warning added by retroj on Sun Sep 11 23:24:39 2016
imlib2.c: In function ‘stub363’: imlib2.c:523:1: warning: ‘visibility’ attribute ignored [-Wattributes] imlib_context_set_image(img);EAPI DATA32* data = imlib_image_get_data();memset(data, 0, 3 * width * height);imlib_image_put_back_data(data); ^~~~~~~~~~~~~~~~~~~~~~~