[racket] Programatically loading bitmaps with 2htdp/image

From: Rodolfo Carvalho (rhcarvalho at gmail.com)
Date: Sat Jun 4 18:57:15 EDT 2011

Thanks!

#lang racket
(require 2htdp/image 2htdp/universe racket/draw)

(define (make-frame t)
  (crop 300 102 980 422 (read-bitmap (format "~a.png" (add1 (modulo t
13))))))

(animate make-frame)



Works like a charm!

[]'s

Rodolfo Carvalho


On Sat, Jun 4, 2011 at 19:23, Robby Findler <robby at eecs.northwestern.edu>wrote:

> No, not with the 'bitmap' primitive. But if you create a bitmap%
> object, I believe you can pass it to any of the 2htdp/image
> primitives.
>
> Robby
>
> On Saturday, June 4, 2011, Rodolfo Carvalho <rhcarvalho at gmail.com> wrote:
> > Is there a way to do something like this:
> > (define (make-frame t)  (bitmap (format "~a.png" (add1 (modulo t 13)))))
> > (animate make-frame)
> >
> >
> >
> >
> > This code gives me:
> > bitmap: expected the argument to specify a local path (via a string) or a
> module path (e.g. `icons/b-run.png')
> >
> >
> >
> > []'sRodolfo Carvalho
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110604/c95528dc/attachment.html>

Posted on the users mailing list.