diff options
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | pnm.scm | 4 | ||||
-rw-r--r-- | pnm/image.scm | 8 | ||||
-rw-r--r-- | pnm/read.scm | 2 |
4 files changed, 13 insertions, 13 deletions
@@ -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-pixel-ref pbm-image x y) → boolean` +#### `(image-ref 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-pixel-set! pbm-image x y b)` +#### `(image-set! 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-pixel-ref pgm-image x y) → integer` +#### `(image-ref 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-pixel-set! pgm-image x y v)` +#### `(image-set! 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-pixel-ref ppm-image x y) → (values integer integer integer)` +#### `(image-ref 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-pixel-set! ppm-image x y r g b)` +### `(image-set! 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 @@ -25,8 +25,8 @@ image-width image-height image-maxval - image-pixel-ref - image-pixel-set! + image-ref + image-set! image-read pnm-parse-error? image-write) diff --git a/pnm/image.scm b/pnm/image.scm index 15702ba..ceab0cf 100644 --- a/pnm/image.scm +++ b/pnm/image.scm @@ -26,8 +26,8 @@ image-data image-pixel-getter image-pixel-setter - image-pixel-ref - image-pixel-set!) + image-ref + image-set!) (import (scheme base) (scheme case-lambda)) (begin @@ -42,10 +42,10 @@ (pixel-getter image-pixel-getter) (pixel-setter image-pixel-setter)) - (define (image-pixel-ref image x y) + (define (image-ref image x y) ((image-pixel-getter image) x y)) - (define image-pixel-set! + (define image-set! (case-lambda ((image x y v) ((image-pixel-setter image) x y v)) diff --git a/pnm/read.scm b/pnm/read.scm index 42ded91..a2e0555 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-pixel-set! pbm-image x y (= v 1))) + (image-set! pbm-image x y (= v 1))) unexpected-eof-error unexpected-character-error) pbm-image)) |