The procedures listed below expect a proper list of numbers for their data representation. Vector and frame accessors are therefore defined as follows:
(define origin-frame car) (define edge1-frame cadr) (define edge2-frame caddr) (define xcor-vect car) (define ycor-vect cadr)
If you chose to use a different internal representation, you'll need to define appropriate conversion procedures. For example a pair representation can be transformed as follows:
(define (fixup-vector vector) (list (xcor-vect vector) (ycor-vect vector))) (draw-line (fixup-vector start) (fixup-vector end))
Obtain or set the path the canvas should be rendered to.
Obtain or set the width and height of the canvas measured in pixels.
Obtain a frame corresponding to the canvas width and height.
Reset the canvas to its initial state.
Commit all pending drawing operations and return a file:// URL to the file backing the canvas. This will call canvas-reset if needed.
Delete the current canvas, including its backing file.
- draw-line start endprocedure
Draws a line from start to end on the canvas. This should be used in combination with a procedure that adjusts the coordinates of start and end to fit the canvas.
- rogers frameprocedure
A built-in painter that paints an image of William Rogers into frame.
- image-file->painter file-nameprocedure
Returns a painter that will paint the image at file-name.
Note that file-name is interpreted relative to the path returned by canvas-refresh. Therefore only absolute paths are guaranteed to work.
(import scheme) (import (srfi 203)) (define (flip-vert painter) ...) (define (beside painter1 painter2) ...) (define (below painter1 painter2) ...) (define rogers2 (beside rogers (flip-vert rogers))) (define rogers4 (below rogers2 rogers2)) (rogers4 (canvas-frame)) (print (canvas-refresh))
- Initial release