2003-10-19 12:50:33 -04:00
|
|
|
;; *** create or destroy regions *************************************
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition create-region () "scx_Create_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-xlib-function set-region (display gc r)
|
|
|
|
"scx_Set_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition destroy-region (r) "scx_Destroy_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
;; *** determine if regions are empty or equal ***********************
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition empty-region? (r) "scx_Empty_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition equal-region? (r1 r2) "scx_Equal_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition point-in-region? (r x y) "scx_Point_In_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define-enumerated-type rect-in-region-type :rect-in-region-type
|
|
|
|
rect-in-region-type? rect-in-region-types rect-in-region-type-name
|
|
|
|
rect-in-region-type-index
|
2003-10-23 08:38:33 -04:00
|
|
|
(out in part))
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define-exported-binding "scx-rect-in-region-type" :rect-in-region-type)
|
|
|
|
(define-exported-binding "scx-rect-in-region-types" rect-in-region-types)
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition rect-in-region? (r x y w h) "scx_Rect_In_Region")
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
;; *** region arithmetic *********************************************
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
;; intersect-region! computes the intersection of SRA and SRB and
|
|
|
|
;; stores the result in the region DR.
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition intersect-region! (sra srb dr)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Intersect_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define (intersect-region sra srb)
|
|
|
|
(let ((dr (create-region)))
|
|
|
|
(intersect-region! sra srb dr)
|
|
|
|
dr))
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition union-region! (sra srb dr)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Union_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define (union-region sra srb)
|
|
|
|
(let ((dr (create-region)))
|
|
|
|
(union-region! sra srb dr)
|
|
|
|
dr))
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition union-rect-with-region! (x y w h src dest)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Union_Rect_With_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define (union-rect-with-region x y w h src)
|
|
|
|
(let ((dr (create-region)))
|
|
|
|
(union-rect-with-region! x y w h src dr)
|
|
|
|
dr))
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition subtract-region! (sra srb dr)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Subtract_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define (subtract-region sra srb)
|
|
|
|
(let ((dr (create-region)))
|
|
|
|
(subtract-region! sra srb dr)
|
|
|
|
dr))
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition xor-region! (sra srb dr)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Xor_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(define (xor-region sra srb)
|
|
|
|
(let ((dr (create-region)))
|
|
|
|
(xor-region! sra srb dr)
|
|
|
|
dr))
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition offset-region! (r dx dy)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Offset_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition shrink-region! (r dx dy)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Shrink_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
;; *** generate regions **********************************************
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
;; points has to be a list of pairs (x . y).
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition polygon-region (points fill-rule)
|
2001-09-25 08:45:12 -04:00
|
|
|
"scx_Polygon_Region")
|
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
;; clip-box returns a list (x y width height)
|
2001-09-25 08:45:12 -04:00
|
|
|
|
2003-10-19 12:50:33 -04:00
|
|
|
(import-lambda-definition clip-box (r)
|
|
|
|
"scx_Clip_Box")
|