added pinhole support to cropping primitives and to frame
This commit is contained in:
parent
9b720b9c0d
commit
cc96864868
|
@ -299,13 +299,17 @@
|
||||||
(crop/internal x1 y1 w h image)))
|
(crop/internal x1 y1 w h image)))
|
||||||
|
|
||||||
(define (crop/internal x1 y1 width height image)
|
(define (crop/internal x1 y1 width height image)
|
||||||
(let* ([points (rectangle-points width height)])
|
(let ([points (rectangle-points width height)]
|
||||||
|
[ph (send image get-pinhole)])
|
||||||
(make-image (make-crop points
|
(make-image (make-crop points
|
||||||
(make-translate (- x1) (- y1) (image-shape image)))
|
(make-translate (- x1) (- y1) (image-shape image)))
|
||||||
(make-bb width
|
(make-bb width
|
||||||
height
|
height
|
||||||
(min height (get-baseline image)))
|
(min height (get-baseline image)))
|
||||||
#f)))
|
#f
|
||||||
|
(and ph
|
||||||
|
(make-point (- (point-x ph) x1)
|
||||||
|
(- (point-y ph) y1))))))
|
||||||
|
|
||||||
;; place-image : image x y scene -> scene
|
;; place-image : image x y scene -> scene
|
||||||
(define/chk (place-image image1 x1 y1 image2)
|
(define/chk (place-image image1 x1 y1 image2)
|
||||||
|
@ -366,7 +370,8 @@
|
||||||
(make-bb (get-right image)
|
(make-bb (get-right image)
|
||||||
(get-bottom image)
|
(get-bottom image)
|
||||||
(get-baseline image))
|
(get-baseline image))
|
||||||
#f))
|
#f
|
||||||
|
(send image get-pinhole)))
|
||||||
|
|
||||||
;; scale : I number -> I
|
;; scale : I number -> I
|
||||||
;; scales the I by the given factor
|
;; scales the I by the given factor
|
||||||
|
|
|
@ -1664,8 +1664,22 @@
|
||||||
=>
|
=>
|
||||||
60)
|
60)
|
||||||
|
|
||||||
;; crop
|
(test (pinhole-x (crop 2 2 8 10
|
||||||
;; frame
|
(center-pinhole (rectangle 10 12 'solid 'red))))
|
||||||
|
=>
|
||||||
|
3)
|
||||||
|
(test (pinhole-y (crop 2 2 8 10
|
||||||
|
(center-pinhole (rectangle 10 12 'solid 'red))))
|
||||||
|
=>
|
||||||
|
4)
|
||||||
|
|
||||||
|
(test (pinhole-x (frame (center-pinhole (rectangle 10 12 'solid 'red))))
|
||||||
|
=>
|
||||||
|
5)
|
||||||
|
(test (pinhole-y (frame (center-pinhole (rectangle 10 12 'solid 'red))))
|
||||||
|
=>
|
||||||
|
6)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user