
Renamed `convert' to `pict-convert', etc., to avoid confusion with `file/convert' bindings. Moved out of `slideshow/pict' to `slideshow/pict-convert', because most `slideshow/pict' clients do not need it.
20 lines
667 B
Racket
20 lines
667 B
Racket
#lang racket/base
|
|
(provide prop:pict-convertible prop:pict-convertible? pict-convertible? pict-convert)
|
|
|
|
(define-values (prop:pict-convertible -pict-convertible? pict-convertible-ref)
|
|
(make-struct-type-property 'pict-convertible))
|
|
|
|
(define-values (prop:pict-convertible? pict-convertible?? pict-convertible?-ref)
|
|
(make-struct-type-property 'pict-convertible?))
|
|
|
|
(define (pict-convertible? x)
|
|
(and (-pict-convertible? x)
|
|
(if (pict-convertible?? x)
|
|
((pict-convertible?-ref x) x)
|
|
#t)))
|
|
|
|
(define (pict-convert v)
|
|
(unless (pict-convertible? v)
|
|
(raise-type-error 'pict-convert "pict-convertible" v))
|
|
((pict-convertible-ref v) v))
|