14 Rendering
parameter
(dc-for-text-size) → (or/c #f (is-a?/c dc<%>))
(dc-for-text-size dc) → void? dc : (or/c #f (is-a?/c dc<%>))
The drawing context installed in this parameter need not be the same as the ultimate drawing context, but it should measure text in the same way. Under normal circumstances, font metrics are the same for all drawing contexts, so the default value of dc-for-text-size is a bitmap-dc% that draws to a 1-by-1 bitmap.
parameter
→ (list/c (>=/c 0) (>=/c 0) (>=/c 0) (>=/c 0)) (convert-bounds-padding padding) → void? padding : (list/c (>=/c 0) (>=/c 0) (>=/c 0) (>=/c 0))
添加于package pict-lib的1.2版本。
函数
(pict->bitmap pict [ smoothing #:make-bitmap make-a-bitmap]) → (is-a?/c bitmap%) pict : pict-convertible? smoothing : (or/c 'unsmoothed 'smoothed 'aligned) = 'aligned
make-a-bitmap :
(exact-positive-integer? exact-positive-integer? . -> . (is-a?/c bitmap%)) = make-bitmap
The make-a-bitmap function is used to create the bitmap, giving it the size of pict rounded up to integer dimensions. The default function, make-bitmap, creates a bitmap with an alpha channel. Supply make-screen-bitmap, instead, to create a bitmap that is consistent with drawing directly to the screen.
修改于package pict-lib的1.7版本:Added the #:make-bitmap argument.
函数
(pict->argb-pixels pict [smoothing]) → bytes?
pict : pict-convertible? smoothing : (or/c 'unsmoothed 'smoothed 'aligned) = 'aligned
> (pict->argb-pixels (filled-rectangle 1 1)) #"\377\0\0\0"
> (pict->argb-pixels (colorize (filled-rectangle 1 1) "red")) #"\377\377\0\0"
添加于package pict-lib的1.1版本。
函数
(argb-pixels->pict bytes width) → pict?
bytes : bytes? width : exact-nonnegative-integer?
> (let ([b (make-bytes (* 40 40 4) 255)]) (for ([x (in-range (bytes-length b))]) ; when in one of two vertical bands (10-20 & 30-40) (when (or (<= 10 (modulo (quotient x 4) 40) 20) (<= 30 (modulo (quotient x 4) 40) 40)) ; change the red and green fields of the pixel (when (= 1 (modulo x 4)) (bytes-set! b x 0)) (when (= 2 (modulo x 4)) (bytes-set! b x 150)))) (argb-pixels->pict b 40))
添加于package pict-lib的1.1版本。
函数
(make-pict-drawer pict)
→ ((is-a?/c dc<%>) real? real? . -> . void?) pict : pict-convertible?
函数
(show-pict pict [ w h] #:frame-x frame-x #:frame-y frame-y #:frame-style frame-style) → void? pict : pict-convertible? w : (or/c #f exact-nonnegative-integer?) = #f h : (or/c #f exact-nonnegative-integer?) = #f frame-x : (or/c (integer-in -10000 10000) #f) frame-y : (or/c (integer-in -10000 10000) #f)
frame-style :
(listof (or/c 'no-resize-border 'no-caption 'no-system-menu 'hide-menu-bar 'toolbar-button 'float 'metal))
parameter
(current-expected-text-scale scales) → void? scales : (list/c real? real?)