Artifact 1da93abfbca5dcacebac2d2d7ca04e92e566dca3:


(require-library canvas-draw-base)

(module canvas-draw-play
	(canvas-play!)
	(import scheme chicken foreign canvas-draw-base)

;; {{{ Data types

(foreign-declare
	"#include <cd.h>\n")

(include "canvas-draw-types.scm")

;; }}}

;; {{{ Context content playback

(define canvas-play/ptr!
	(foreign-lambda int "cdCanvasPlay" nonnull-canvas nonnull-context int int int int c-pointer))

(define canvas-play/string!
	(foreign-lambda int "cdCanvasPlay" nonnull-canvas nonnull-context int int int int c-string))

(define (canvas-play! canvas context x0 x1 y0 y1 data)
	(let ([canvas-play/data! (if (string? data) canvas-play/string! canvas-play/ptr!)])
		(unless (zero? (canvas-play/data! canvas context x0 x1 y0 y1 data))
			(error 'canvas-play! "failed to replay graphics"))))

;; }}}

)