refactoring, added a texture noise function

master
Lindsey Handley 2017-12-27 10:33:23 -08:00
parent 6e25389f0d
commit 6ec26648b9
4 changed files with 329 additions and 102 deletions

View File

@ -111,3 +111,45 @@
(set-my-mod! (add-block my-mod id)))
)]))
(define wool-mod
(mod-struct "wool" '() '() '() '() '()))
(define-syntax (define-wool-block stx)
(syntax-case stx ()
[(_ x )
(with-syntax* ([name (symbol->string (format-symbol "~a" #'x))])
#`(begin
(define x (wool-block name) )
(provide x)
) ) ]))
(define-syntax (define-wool-blocks stx)
(syntax-case stx ()
[(_ x ... )
#`(begin
(define-wool-block x ) ...
) ]))
(define (wool-block id)
(block-struct (++ "" id)
(++ "Wool: " id)
'()
wool-mod))
(define-wool-blocks
white
grey
black
red
yellow
green
cyan
blue
magenta
orange
violet
brown
pink
dark_grey
dark_green)

View File

@ -290,7 +290,7 @@
0 -1 -1 4 1 #"\0"
0 -1 1 #"\0"
1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255
255 0 -1 -1 0 879 0 28 3 12 #"#lang racket"
255 0 -1 -1 0 833 0 28 3 12 #"#lang racket"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 17 3 14 #";Housecleaning"
@ -303,30 +303,10 @@
#"acket"
) 0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 17 3 34 #";TODO: More 2htdp/image utilities."
0 0 24 29 1 #"\n"
0 0 17 3 44 #"; (crunchy img) -> Adds noise to image."
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 17 3 30 #";TODO: Schematics almost done!"
0 0 24 29 1 #"\n"
0 0 17 3 55 #"; Getting trapped in a schematic is annoying...."
0 0 24 29 1 #"\n"
0 0 17 3 62
#"; Support specifying bottom up intepretation of images?"
0 0 24 29 1 #"\n"
0 0 17 3 79
(
#"; Ensure that each image is padded according to the largest i"
#"n the list."
) 0 0 24 29 1 #"\n"
0 0 17 3 44 #"; Supply a wool mapping as a default."
0 0 24 29 1 #"\n"
0 0 17 3 53 #"; Would work best with a color rounding..."
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 17 3 55 #";TODO: Write a readme so team can know what's going on."
0 0 24 29 1 #"\n"
0 0 17 3 32 #"; Slideshow presentation..."
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 17 3 88
(
@ -432,6 +412,12 @@
0 0 24 3 1 #"("
0 0 15 3 7 #"require"
0 0 24 3 1 #" "
0 0 19 3 14 #"\"textures.rkt\""
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 15 3 7 #"require"
0 0 24 3 1 #" "
0 0 19 3 13 #"\"compiler.rkt"
0 0 19 3 1 #"\""
0 0 24 3 1 #")"
@ -532,27 +518,6 @@
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 15 3 6 #"define"
0 0 24 3 2 #" ("
0 0 14 3 5 #"fract"
0 0 24 3 1 #" "
0 0 14 3 1 #"i"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 5 #"above"
0 0 24 3 1 #" "
0 0 14 3 1 #"i"
0 0 24 29 1 #"\n"
0 0 24 3 10 #" ("
0 0 14 3 6 #"beside"
0 0 24 3 1 #" "
0 0 14 3 1 #"i"
0 0 24 3 1 #" "
0 0 14 3 1 #"i"
0 0 24 3 3 #")))"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
@ -564,10 +529,10 @@
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 5 #"fract"
0 0 14 3 9 #"tri-fract"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 14 3 5 #"fract"
0 0 14 3 9 #"tri-fract"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" "
0 0 14 3 4 #"base"
@ -583,9 +548,11 @@
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 5 #"noise"
0 0 24 3 2 #" ("
0 0 14 3 7 #"overlay"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 24 3 11 #" ("
0 0 14 3 6 #"square"
0 0 24 3 1 #" "
0 0 21 3 1 #"5"
@ -595,7 +562,7 @@
0 0 19 3 7 #"\"black\""
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 24 3 11 #" ("
0 0 14 3 6 #"square"
0 0 24 3 1 #" "
0 0 21 3 2 #"14"
@ -605,7 +572,7 @@
0 0 14 3 5 #"color"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 24 3 11 #" ("
0 0 14 3 6 #"square"
0 0 24 3 1 #" "
0 0 21 3 2 #"20"
@ -615,7 +582,7 @@
0 0 19 3 7 #"\"black\""
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 24 3 11 #" ("
0 0 14 3 6 #"square"
0 0 24 3 1 #" "
0 0 21 3 2 #"31"
@ -625,7 +592,7 @@
0 0 14 3 5 #"color"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 24 3 11 #" ("
0 0 14 3 6 #"square"
0 0 24 3 1 #" "
0 0 21 3 2 #"33"
@ -633,7 +600,7 @@
0 0 19 3 7 #"\"solid\""
0 0 24 3 1 #" "
0 0 19 3 7 #"\"black\""
0 0 24 3 3 #")))"
0 0 24 3 4 #"))))"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
@ -1529,7 +1496,7 @@
0 0 24 3 3 #" ("
0 0 14 3 9 #"schematic"
0 0 24 29 1 #"\n"
0 0 24 3 6 #" ("
0 0 24 3 7 #" ("
0 0 14 3 7 #"mapping"
0 0 24 29 1 #"\n"
0 0 24 3 7 #" "
@ -1543,51 +1510,7 @@
0 0 14 3 6 #"leaves"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 5 #" "
0 0 17 3 2 #"#;"
0 0 24 3 1 #"("
0 0 14 3 4 #"list"
0 0 24 3 2 #" ("
0 0 14 3 4 #"star"
0 0 24 3 1 #" "
0 0 21 3 2 #"10"
0 0 24 3 1 #" "
0 0 19 3 7 #"\"solid\""
0 0 24 3 1 #" "
0 0 19 3 7 #"\"brown\""
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 14 #" ("
0 0 14 3 4 #"star"
0 0 24 3 1 #" "
0 0 21 3 2 #"10"
0 0 24 3 1 #" "
0 0 19 3 7 #"\"solid\""
0 0 24 3 1 #" "
0 0 19 3 7 #"\"brown\""
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 14 #" ("
0 0 14 3 4 #"star"
0 0 24 3 1 #" "
0 0 21 3 2 #"10"
0 0 24 3 1 #" "
0 0 19 3 7 #"\"solid\""
0 0 24 3 1 #" "
0 0 19 3 7 #"\"brown\""
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 14 #" ("
0 0 14 3 4 #"star"
0 0 24 3 1 #" "
0 0 21 3 2 #"10"
0 0 24 3 1 #" "
0 0 19 3 7 #"\"solid\""
0 0 24 3 1 #" "
0 0 19 3 7 #"\"brown\""
0 0 24 3 2 #"))"
0 0 24 29 1 #"\n"
0 0 24 3 6 #" ("
0 0 24 3 7 #" ("
0 0 14 3 4 #"list"
0 0 24 3 1 #" "
0 6 4 21 83
@ -1655,6 +1578,89 @@
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 15 3 6 #"define"
0 0 24 3 1 #" "
0 0 14 3 9 #"pig-schem"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 9 #"schematic"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 14 3 12 #"wool-mapping"
0 0 24 29 1 #"\n"
0 0 24 3 4 #" ("
0 0 14 3 4 #"list"
0 0 24 3 1 #" "
0 6 4 21 3132
(
#"(#(struct:scale 0.2 0.2 #(struct:scale 5 5 #(struct:translate 8 8 #("
#"struct:bitmap #(#\"\\377\\333Ye\\"
#"377\\334Zf\\377\\331Wc\\377\\333Ye\\377\\332Xd\\377\\333Ye\\377\\331"
#"Wc\\377\\333Ye\\377\\330Vb\\377\\3"
#"32Xd\\377\\330Vb\\377\\330Vb\\377\\332Xd\\377\\333Ye\\377\\332Xd\\37"
#"7\\333Ye\\377\\333Ye\\377\\331Wc\\377\\333Ye\\377\\331Wc\\377\\331Wc"
#"\\377\\331Wc\\377\\331Wc\\377\\330Vb\\377\\334Zf\\377\\331Wc\\377\\3"
#"34Zf\\377\\331Wc\\377\\334Zf\\377\\330Vb\\377\\334Zf\\377\\334Zf\\37"
#"7\\333Ye\\377\\331Wc\\377\\331Wc\\377\\333Ye\\377\\331Wc\\377\\331Wc"
#"\\377\\332Xd\\377\\330Vb\\377\\331Wc\\377\\331Wc\\377\\330Vb\\377\\3"
#"32Xd\\377\\332Xd\\377\\332Xd\\377\\332Xd\\377\\332Xd\\377\\332Xd\\37"
#"7\\334Zf\\377\\330Vb\\377\\332Xd\\377\\330Vb\\377\\331Wc\\377\\333Ye"
#"\\377\\332Xd\\377\\330Vb\\377\\333Ye\\377\\330Vb\\377\\332Xd\\377\\3"
#"31Wc\\377\\331Wc\\377\\332Xd\\377\\331Wc\\377\\331Wc\\377\\333Ye\\37"
#"7\\330Vb\\377\\333Ye\\377\\330Vb\\377\\334Zf\\377\\331Wc\\377\\334Zf"
#"\\377\\333Ye\\377\\331Wc\\377\\332Xd\\377\\332Xd\\377\\334Zf\\377\\3"
#"32Xd\\377\\334Zf\\377\\332Xd\\377\\333Ye\\377\\334Zf\\377\\334Zf\\37"
#"7\\330Vb\\377\\331Wc\\377\\331Wc\\377\\332Xd\\377\\330Vb\\377\\332Xd"
#"\\377\\333Ye\\377\\331Wc\\377\\334Zf\\377\\333Ye\\377\\330Vb\\377\\3"
#"32Xd\\377\\334Zf\\377\\334Zf\\377"
#"\\333Ye\\377\\330Vb\\377\\376\\201\\201\\377\\374\\177\\177\\377\\37"
#"7\\205\\205\\377\\374\\177\\177\\377\\374\\177\\177\\377\\377\\202\\"
#"202\\377\\375\\200\\200\\377\\376\\201\\201\\377\\377\\204\\204\\377"
#"\\377\\205\\205\\377\\331Wc\\377\\333Ye\\377\\331Wc\\377\\332Xd\\377"
#"\\377\\202\\202\\377\\376\\201\\201\\377\\377\\205\\205\\377\\375\\2"
#"00\\200\\377\\377\\377\\377\\377\\"
#"377\\377\\377\\377\\377\\204\\204\\377\\375\\200\\200\\377\\377\\377"
#"\\377\\377\\377\\377\\377\\377\\375\\200\\200\\377\\375\\200\\200\\3"
#"77\\377\\202\\202\\377\\376\\201\\201\\377\\332Xd\\377\\330Vb\\377\\"
#"377\\205\\205\\377\\375\\200\\200\\377\\377\\205\\205\\377\\377\\203"
#"\\203\\377\\0\\306\\0\\377\\0\\306"
#"\\0\\377\\377\\205\\205\\377\\375"
#"\\200\\200\\377\\0\\306\\0\\377\\0"
#"\\306\\0\\377\\377\\202\\202\\377\\374\\177\\177\\377\\377\\205\\205"
#"\\377\\375\\200\\200\\377\\333Ye\\377\\331Wc\\377\\332Xd\\377\\334Zf"
#"\\377\\377\\202\\202\\377\\376\\201\\201\\377\\374gg\\377\\374gg\\37"
#"7\\374gg\\377\\374gg\\377\\374gg\\377\\374gg\\377\\375\\200\\200\\37"
#"7\\377\\203\\203\\377\\330Vb\\377\\331Wc\\377\\331Wc\\377\\331Wc\\37"
#"7\\331Wc\\377\\334Zf\\377\\377\\205\\205\\377\\375\\200\\200\\377\\3"
#"74gg\\377\\0\\0\\0\\377\\374gg\\377\\374gg\\377\\0\\0\\0\\377\\374gg"
#"\\377\\376\\201\\201\\377\\377\\203\\203\\377\\330Vb\\377\\330Vb\\37"
#"7\\330Vb\\377\\332Xd\\377\\331Wc\\377\\330Vb\\377\\377\\202\\202\\37"
#"7\\374\\177\\177\\377\\374gg\\377\\0\\0\\0\\377\\374gg\\377\\374gg\\"
#"377\\0\\0\\0\\377\\374gg\\377\\377\\205\\205\\377\\377\\205\\205\\37"
#"7\\331Wc\\377\\331Wc\\377\\332Xd\\377\\334Zf\\377\\331Wc\\377\\332Xd"
#"\\377\\375\\200\\200\\377\\376\\201\\201\\377\\374gg\\377\\374gg\\37"
#"7\\374gg\\377\\374gg\\377\\374gg\\377\\374gg\\377\\375\\200\\200\\37"
#"7\\377\\204\\204\\377\\330Vb\\377\\334Zf\\377\\334Zf\\377\\330Vb\\37"
#"7\\330Vb\\377\\334Zf\\377\\377\\204\\204\\377\\374\\177\\177\\377\\3"
#"74\\177\\177\\377\\377\\204\\204\\"
#"377\\374\\177\\177\\377\\377\\204\\204\\377\\377\\202\\202\\377\\374"
#"\\177\\177\\377\\377\\204\\204\\37"
#"7\\377\\203\\203\\377\\334Zf\\377\\330Vb\\377\\334Zf\\377\\332Xd\\37"
#"7\\331Wc\\377\\332Xd\\377\\377\\203\\203\\377\\376\\201\\201\\377\\3"
#"77\\205\\205\\377\\377\\205\\205\\"
#"377\\376\\201\\201\\377\\374\\177\\177\\377\\375\\200\\200\\377\\377"
#"\\203\\203\\377\\377\\203\\203\\37"
#"7\\376\\201\\201\\377\\330Vb\\377\\333Ye\\377\\333Ye\\377\\334Zf\\37"
#"7\\332Xd\\377\\331Wc\\377\\0\\0\\"
#"0\\377\\0\\0\\0\\377\\0\\0\\0\\377"
#"\\0\\0\\0\\377\\0\\0\\0\\377\\0\\0\\"
#"0\\377\\0\\0\\0\\377\\0\\0\\0\\377\\0\\0\\0\\377\\0\\0\\0\\377\\333Y"
#"e\\377\\333Ye\\377\\333Ye\" 16 16) 0 1 1 #hash())))) #(struct:bb 16."
#"0 16.0 16.0) #f)"
) 0 0 24 3 3 #")))"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 14 3 16 #"add-behaviour-to"
0 0 24 3 1 #" "
0 0 14 3 11 #"green-block"
@ -1662,11 +1668,20 @@
0 0 24 3 19 #" ("
0 0 14 3 8 #"on-punch"
0 0 24 29 1 #"\n"
0 0 24 3 20 #" ("
0 0 14 3 17 #"on-punch-sequence"
0 0 24 29 1 #"\n"
0 0 24 3 22 #" ("
0 0 14 3 15 #"place-schematic"
0 0 24 3 1 #" "
0 0 14 3 10 #"tree-schem"
0 0 24 3 3 #")))"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 22 #" ("
0 0 14 3 15 #"place-schematic"
0 0 24 3 1 #" "
0 0 14 3 9 #"pig-schem"
0 0 24 3 4 #"))))"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #" "

View File

@ -290,7 +290,7 @@
0 -1 -1 4 1 #"\0"
0 -1 1 #"\0"
1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255
255 0 -1 -1 0 1009 0 28 3 12 #"#lang racket"
255 0 -1 -1 0 1144 0 28 3 12 #"#lang racket"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
@ -1996,6 +1996,50 @@
0 0 17 3 15 #"; \"besided\""
0 0 17 3 10 #" together."
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 15 3 6 #"define"
0 0 24 3 2 #" ("
0 0 14 3 6 #"above*"
0 0 24 3 1 #" "
0 0 28 3 1 #"."
0 0 24 3 1 #" "
0 0 14 3 2 #"is"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 2 #"if"
0 0 24 3 2 #" ("
0 0 14 3 1 #"="
0 0 24 3 1 #" "
0 0 21 3 1 #"1"
0 0 24 3 2 #" ("
0 0 14 3 6 #"length"
0 0 24 3 1 #" "
0 0 14 3 2 #"is"
0 0 24 3 2 #"))"
0 0 24 29 1 #"\n"
0 0 24 3 7 #" ("
0 0 14 3 5 #"first"
0 0 24 3 1 #" "
0 0 14 3 2 #"is"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 7 #" ("
0 0 14 3 5 #"apply"
0 0 24 3 1 #" "
0 0 14 3 5 #"above"
0 0 24 3 1 #" "
0 0 14 3 2 #"is"
0 0 24 3 3 #")))"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 14 3 7 #"provide"
0 0 24 3 1 #" "
0 0 14 3 9 #"transpose"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 15 3 6 #"define"
0 0 24 3 2 #" ("
@ -2012,7 +2056,7 @@
0 0 24 3 1 #" "
0 0 14 3 5 #"apply"
0 0 24 3 1 #" "
0 0 14 3 5 #"above"
0 0 14 3 6 #"above*"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 8 #" ("
@ -2360,7 +2404,7 @@
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 3 #"abs"
0 0 14 3 3 #"sqr"
0 0 24 3 2 #" ("
0 0 14 3 1 #"-"
0 0 24 3 2 #" ("
@ -2789,4 +2833,95 @@
0 0 24 3 1 #" "
0 0 14 3 14 #"unzipped-pairs"
0 0 24 3 5 #")))))"
0 0 24 29 1 #"\n"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 14 3 7 #"provide"
0 0 24 3 1 #" "
0 0 14 3 12 #"wool-mapping"
0 0 24 3 1 #")"
0 0 24 29 1 #"\n"
0 0 24 3 1 #"("
0 0 15 3 6 #"define"
0 0 24 3 1 #" "
0 0 14 3 12 #"wool-mapping"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" ("
0 0 14 3 7 #"mapping"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 7 #"\"white\""
0 0 24 3 1 #" "
0 0 14 3 5 #"white"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 6 #"\"gray\""
0 0 24 3 1 #" "
0 0 14 3 4 #"grey"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 7 #"\"black\""
0 0 24 3 1 #" "
0 0 14 3 5 #"black"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 5 #"\"red\""
0 0 24 3 1 #" "
0 0 14 3 3 #"red"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 8 #"\"yellow\""
0 0 24 3 1 #" "
0 0 14 3 6 #"yellow"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 7 #"\"green\""
0 0 24 3 1 #" "
0 0 14 3 5 #"green"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 6 #"\"cyan\""
0 0 24 3 1 #" "
0 0 14 3 4 #"cyan"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 6 #"\"blue\""
0 0 24 3 1 #" "
0 0 14 3 4 #"blue"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 9 #"\"magenta\""
0 0 24 3 1 #" "
0 0 14 3 7 #"magenta"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 8 #"\"orange\""
0 0 24 3 1 #" "
0 0 14 3 6 #"orange"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 8 #"\"violet\""
0 0 24 3 1 #" "
0 0 14 3 6 #"violet"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 7 #"\"brown\""
0 0 24 3 1 #" "
0 0 14 3 5 #"brown"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 6 #"\"pink\""
0 0 24 3 1 #" "
0 0 14 3 4 #"pink"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 10 #"\"darkgray\""
0 0 24 3 1 #" "
0 0 14 3 9 #"dark_grey"
0 0 24 29 1 #"\n"
0 0 24 3 3 #" "
0 0 19 3 11 #"\"darkgreen\""
0 0 24 3 1 #" "
0 0 14 3 10 #"dark_green"
0 0 24 3 2 #"))"
0 0

35
textures.rkt Normal file
View File

@ -0,0 +1,35 @@
#lang racket
(provide noise)
(provide tri-fract)
(require 2htdp/image)
(define (tri-fract i)
(above i
(beside i i)))
(define (noise img (amount 100))
(color-list->bitmap
(map (curry noisify-color amount) (image->color-list img))
(image-width img)
(image-height img)))
(define (noisify-color amount color)
(make-color
(noisify-number amount (color-red color))
(noisify-number amount (color-green color))
(noisify-number amount (color-blue color))
(color-alpha color)))
(define (noisify-number amount n)
(min
255
(max
0
(- (+ n (random amount))
(/ amount 2)))))