Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
#lang racket
|
||||
(require racket/draw)
|
||||
|
||||
(define (read-ppm port)
|
||||
(parameterize ([current-input-port port])
|
||||
(define magic (read))
|
||||
(define width (read))
|
||||
(define height (read))
|
||||
(define maxcol (read))
|
||||
(define bm (make-object bitmap% width height))
|
||||
(define dc (new bitmap-dc% [bitmap bm]))
|
||||
(send dc set-smoothing 'unsmoothed)
|
||||
(define (adjust v) (* 255 (/ v maxcol)))
|
||||
(for/list ([x width])
|
||||
(for/list ([y height])
|
||||
(define red (read))
|
||||
(define green (read))
|
||||
(define blue (read))
|
||||
(define color (make-object color% (adjust red) (adjust green) (adjust blue)))
|
||||
(send dc set-pen color 1 'solid)
|
||||
(send dc draw-point x y)))
|
||||
bm))
|
||||
Loading…
Add table
Add a link
Reference in a new issue