Add image-draw-image!, image-width, image-height

This commit is contained in:
Feufochmar 2020-07-19 19:00:33 +02:00
parent f707ff6829
commit 1660f991a7
1 changed files with 14 additions and 0 deletions

View File

@ -12,11 +12,14 @@
make-image
bounding-box
make-sprite-bank
image-width
image-height
image-draw-rectangle!
image-draw-square!
image-draw-line!
image-draw-ellipse!
image-draw-circle!
image-draw-image!
image-draw-sprite!
image-save)
@ -68,6 +71,13 @@
boxes))))
; Operations on images
; Width
(define (image-width img)
(send (send img get-bitmap) get-width))
; Height
(define (image-height img)
(send (send img get-bitmap) get-height))
; Draw a rectangle
(define (image-draw-rectangle! img x y width height [brush #f] [pen #f])
(if pen
@ -111,6 +121,10 @@
(* 2 radius) (* 2 radius)
brush pen))
; Draw an image on an image
(define (image-draw-image! img src x y)
(send img draw-bitmap (send src get-bitmap) x y))
; Draw a sprite on an image, from the bank and name of the sprite
(define (image-draw-sprite! img x y spt-bank spt-name)
(define box (hash-ref (sprite-bank-sprites spt-bank) spt-name))