Implement place-images* functions in image library

This commit is contained in:
Vishesh Yadav 2015-05-14 23:39:56 -04:00
parent cc69a9b5db
commit 10c2986836
2 changed files with 26 additions and 2 deletions

View File

@ -1,7 +1,9 @@
#lang s-exp "../lang/base.rkt" #lang s-exp "../lang/base.rkt"
(require "private/main.rkt" (require "private/main.rkt"
"private/color.rkt") "private/color.rkt"
"private/image.rkt")
(provide (all-from-out "private/main.rkt") (provide (all-from-out "private/main.rkt")
(all-from-out "private/color.rkt")) (all-from-out "private/color.rkt")
(all-from-out "private/image.rkt"))

View File

@ -0,0 +1,22 @@
#lang s-exp "../../lang/base.rkt"
;; Image functions that be implemented using racket based on primitives
(require "main.rkt"
"../../lang/for.rkt"
"../../lang/posn.rkt")
(provide place-images
place-images/align)
; place-images : (listof image?) (listof posn?) image? -> image?
(define (place-images images posns scene)
(for/fold ([acc scene])
([img images] [posn posns])
(place-image img (posn-x posn) (posn-y posn) acc)))
; place-images : (listof image?) (listof posn?) x-place? y-place? image? -> image?
(define (place-images/align images posns x-place y-place scene)
(for/fold ([acc scene])
([img images] [posn posns])
(place-image/align img (posn-x posn) (posn-y posn) x-place y-place acc)))