aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--pnm.scm4
-rw-r--r--pnm/image.scm8
-rw-r--r--pnm/read.scm2
-rw-r--r--pnm/write.scm6
5 files changed, 16 insertions, 16 deletions
diff --git a/README.md b/README.md
index 35cbc47..4638a7f 100644
--- a/README.md
+++ b/README.md
@@ -48,13 +48,13 @@ Returns the maximum value for pixel intensity in a PBM image, which is
always `#t` for PBM images, indicating binary values (black and
white).
-#### `(image-ref pbm-image x y) → boolean`
+#### `(image-pixel-read pbm-image x y) → boolean`
Returns the value of the pixel at coordinates `(x, y)` in the
specified `image`. The return value is `#t` for a white pixel and `#f`
for a black pixel.
-#### `(image-set! pbm-image x y b)`
+#### `(image-pixel-write! pbm-image x y b)`
Sets the pixel at coordinates `(x, y)` in the specified `image` to
the boolean value `b`. If `b` is `#t`, the pixel is set to white; if
@@ -72,12 +72,12 @@ intensity, defaulting to 255 if not provided.
Returns the maximum pixel intensity value for the specified PGM image.
-#### `(image-ref pgm-image x y) → integer`
+#### `(image-pixel-read pgm-image x y) → integer`
Returns the gray value of the pixel at coordinates `(x, y)` in the
specified PGM image. The value is an integer between 0 and `maxval`.
-#### `(image-set! pgm-image x y v)`
+#### `(image-pixel-write! pgm-image x y v)`
Sets the pixel at coordinates `(x, y)` in the specified PGM image to
the given integer value `v`, which must be between 0 and `maxval`.
@@ -94,13 +94,13 @@ intensity, defaulting to 255 if not provided.
Returns the maximum color intensity value for the specified PPM image.
-#### `(image-ref ppm-image x y) → (values integer integer integer)`
+#### `(image-pixel-read ppm-image x y) → (values integer integer integer)`
Returns the RGB values of the pixel at coordinates `(x, y)` in the
specified PPM image as three integers, representing the red, green,
and blue components, respectively.
-### `(image-set! ppm-image x y r g b)`
+### `(image-pixel-write! ppm-image x y r g b)`
Sets the pixel at coordinates `(x, y)` in the specified PPM image to
the given RGB values `r`, `g`, and `b`, which must be integers between
diff --git a/pnm.scm b/pnm.scm
index 5ccf8c5..ef915ff 100644
--- a/pnm.scm
+++ b/pnm.scm
@@ -25,8 +25,8 @@
image-width
image-height
image-maxval
- image-ref
- image-set!
+ image-pixel-read
+ image-pixel-write!
image-read
pnm-parse-error?
image-write)
diff --git a/pnm/image.scm b/pnm/image.scm
index 4960ec6..4022184 100644
--- a/pnm/image.scm
+++ b/pnm/image.scm
@@ -26,8 +26,8 @@
image-data
image-pixel-reader
image-pixel-writer
- image-ref
- image-set!)
+ image-pixel-read
+ image-pixel-write!)
(import (scheme base)
(scheme case-lambda))
(begin
@@ -42,10 +42,10 @@
(pixel-reader image-pixel-reader)
(pixel-writer image-pixel-writer))
- (define (image-ref image x y)
+ (define (image-pixel-read image x y)
((image-pixel-reader image) x y))
- (define image-set!
+ (define image-pixel-write!
(case-lambda
((image x y v)
((image-pixel-writer image) x y v))
diff --git a/pnm/read.scm b/pnm/read.scm
index 7d2cbdc..d13557e 100644
--- a/pnm/read.scm
+++ b/pnm/read.scm
@@ -71,7 +71,7 @@
(pbm-image (make-pbm-image width height)))
(read-text-raster width height #f in
(lambda (x y v)
- (image-set! pbm-image x y (= v 1)))
+ (image-pixel-write! pbm-image x y (= v 1)))
unexpected-eof-error
unexpected-character-error)
pbm-image))
diff --git a/pnm/write.scm b/pnm/write.scm
index 849e3de..c85fec5 100644
--- a/pnm/write.scm
+++ b/pnm/write.scm
@@ -82,19 +82,19 @@
((ppm)
(write-raster
(lambda (x y)
- (let-values (((r g b) (image-ref image x y)))
+ (let-values (((r g b) (image-pixel-read image x y)))
(write-token (number->string r))
(write-token (number->string g))
(write-token (number->string b))))))
((pgm)
(write-raster
(lambda (x y)
- (let ((v (image-ref image x y)))
+ (let ((v (image-pixel-read image x y)))
(write-token (number->string v))))))
((pbm)
(write-raster
(lambda (x y)
- (let ((b (image-ref image x y)))
+ (let ((b (image-pixel-read image x y)))
(write-token (if b "1" "0"))))))))))
(define (write-string-u8 str out)