-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
png/graphics/filled-rectangle: Add class printers
* modules/png/graphics/filled-rectangle.scm: Add class printers. * tests/graphics.scm ("<filled-rectangle>: display"): New test.
- Loading branch information
1 parent
5e1422e
commit bb72caf
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;; filled-rectangle.scm -- Filled rectangle implementation. | ||
|
||
;; Copyright (C) 2022 Artyom V. Poptsov <[email protected]> | ||
;; Copyright (C) 2022-2023 Artyom V. Poptsov <[email protected]> | ||
;; | ||
;; This program is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
|
@@ -26,6 +26,7 @@ | |
(define-module (png graphics filled-rectangle) | ||
#:use-module (oop goops) | ||
#:use-module (png image) | ||
#:use-module (png core common) | ||
#:use-module (png graphics graphic) | ||
#:use-module (png graphics pixel) | ||
#:use-module (png graphics point) | ||
|
@@ -42,6 +43,20 @@ | |
(define filled-rectangle-height rectangle-height) | ||
(define filled-rectangle-width rectangle-width) | ||
|
||
|
||
(define-method (%display (filled-rectangle <filled-rectangle>) (port <port>)) | ||
(format port "#<filled-rectangle position: ~a width: ~a height: ~a ~a>" | ||
(filled-rectangle-position filled-rectangle) | ||
(filled-rectangle-width filled-rectangle) | ||
(filled-rectangle-height filled-rectangle) | ||
(object-address/hex-string filled-rectangle))) | ||
|
||
(define-method (display (filled-rectangle <filled-rectangle>) (port <port>)) | ||
(%display filled-rectangle port)) | ||
|
||
(define-method (write (filled-rectangle <filled-rectangle>) (port <port>)) | ||
(%display filled-rectangle port)) | ||
|
||
|
||
(define-method (draw! (image <png-image>) (rectangle <filled-rectangle>)) | ||
(let* ((position (rectangle-position rectangle)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters