Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing and visualizing pictures in racket without using DrRacket

Tags:

image

lisp

racket

How can import and an .png image and use it for some animation pragmatically without using Insert > Insert Image... option in DrRacket ?

like image 912
Salah Eddine Taouririt Avatar asked Aug 02 '13 02:08

Salah Eddine Taouririt


1 Answers

It depends on which image library you're using.

If you are using the 2htdp image library, use bitmap or bitmap/url. For example, if you have a file named "plane.png" saved in the same directory as your program, write something like

(define plane-image (bitmap "plane.png"))

If you are using the pict library (eg with slideshow), use its bitmap function. If you are using the basic drawing library (racket/draw), then create an instance of the bitmap% class.

like image 50
Ryan Culpepper Avatar answered Oct 18 '22 18:10

Ryan Culpepper