From 10c29868367bfa3607176f13ffc59abe9f9a144e Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Thu, 14 May 2015 23:39:56 -0400 Subject: [PATCH] Implement place-images* functions in image library --- whalesong/image/main.rkt | 6 ++++-- whalesong/image/private/image.rkt | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 whalesong/image/private/image.rkt diff --git a/whalesong/image/main.rkt b/whalesong/image/main.rkt index d059ea8..5d954fc 100644 --- a/whalesong/image/main.rkt +++ b/whalesong/image/main.rkt @@ -1,7 +1,9 @@ #lang s-exp "../lang/base.rkt" (require "private/main.rkt" - "private/color.rkt") + "private/color.rkt" + "private/image.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")) diff --git a/whalesong/image/private/image.rkt b/whalesong/image/private/image.rkt new file mode 100644 index 0000000..490e551 --- /dev/null +++ b/whalesong/image/private/image.rkt @@ -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)))