Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== srfi-203 [[toc:]] === Introduction This egg implements [[https://srfi.schemers.org/srfi-203/srfi-203.html|SRFI-203]] using code from the [[http://wiki.call-cc.org/eggref/4/sicp|sicp egg]]. === Author Vasilij Schneidermann === Repository [[https://depp.brause.cc/srfi-203]] === API The procedures listed below expect a proper list of numbers for their data representation. Vector and frame accessors are therefore defined as follows: <enscript highlight="scheme"> (define origin-frame car) (define edge1-frame cadr) (define edge2-frame caddr) (define xcor-vect car) (define ycor-vect cadr) </enscript> 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: <enscript highlight="scheme"> (define (fixup-vector vector) (list (xcor-vect vector) (ycor-vect vector))) (draw-line (fixup-vector start) (fixup-vector end)) </enscript> ==== Canvas manipulation <parameter>(canvas-path)</parameter> Obtain or set the path the canvas should be rendered to. <parameter>(canvas-width)</parameter> <parameter>(canvas-height)</parameter> Obtain or set the width and height of the canvas measured in pixels. <procedure>(canvas-frame)</procedure> Obtain a frame corresponding to the canvas width and height. <procedure>(canvas-reset)</procedure> Reset the canvas to its initial state. <procedure>(canvas-refresh)</procedure> Commit all pending drawing operations and return a {{file://}} URL to the file backing the canvas. This will call {{canvas-reset}} if needed. <procedure>(canvas-cleanup)</procedure> Delete the current canvas, including its backing file. ==== Painters <procedure>(draw-line start end)</procedure> 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. <procedure>(rogers frame)</procedure> A built-in painter that paints an image of William Rogers into {{frame}}. <procedure>(image-file->painter file-name)</procedure> 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. <procedure>(jpeg-file->painter file-name)</procedure> Alias for {{image-file->painter}}. === Example <enscript highlight="scheme"> (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)) </enscript> === Licenses [[https://depp.brause.cc/srfi-203/LICENSES/BSD-3-Clause.txt|BSD-3-Clause]], [[https://depp.brause.cc/srfi-203/LICENSES/CC0-1.0.txt|CC0-1.0]] === Version history ==== 0.1 * Initial release
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 17 from 6?