JNevens
JNevens

Reputation: 12002

How to use an image in R5RS

I'm looking for a way to import a .jpg file into R5RS. I would like to use it as background for a game that I'm making.

Thanks!

Upvotes: 2

Views: 246

Answers (2)

Arno Moonens
Arno Moonens

Reputation: 1213

I use the graphics/graphics library. Put it in your file by using this (in racket):

(require graphics/graphics)

This is the usage:

((draw-pixmap viewport) file p [color]) → void?
  viewport : viewport?
  file : path-string?
  p : posn?
  color : (or/c (integer-in 0 299)
                string?
                rgb?)

You can find more help in the Racket documentation

Upvotes: 0

John Clements
John Clements

Reputation: 17223

Many Scheme implementations have support for image files. The R5RS standard, as written, does not. I suggest using Racket, where you can use, e.g.,

(require 2htdp/image)
(bitmap/file "/path/to/foo.jpg")

In fact, there are many parts of building a game that are not going to fit well under the R5RS umbrella. I'm afraid you're almost certainly going to have to pick an implementation, and use features that lie outside of the standard.

Upvotes: 6

Related Questions