(default)))))
(define (make-standard-palette)
- (define pal (make-legacy-string (+ 4 (* 4 256))))
+ (define pal (make-bytevector (+ 4 (* 4 256))))
(define i 0)
(define (alloc r g b f)
(let ((base (fix:+ 4 (fix:* i 4))))
- (vector-8b-set! pal base r)
- (vector-8b-set! pal (+ base 1) g)
- (vector-8b-set! pal (+ base 2) b)
- (vector-8b-set! pal (+ base 3) f)
+ (bytevector-u8-set! pal base r)
+ (bytevector-u8-set! pal (+ base 1) g)
+ (bytevector-u8-set! pal (+ base 2) b)
+ (bytevector-u8-set! pal (+ base 3) f)
(set! i (1+ i))))
;; RGB intensities scaled to look good. Notice that 128 is in the list
(if (not (= r g b))
(alloc (vector-ref cv r) (vector-ref cv g) (vector-ref cv b)
PC_NOCOLLAPSE)))))
- (vector-8b-set! pal 0 #x00)
- (vector-8b-set! pal 1 #x03)
- (vector-8b-set! pal 2 (fix:and i 255))
- (vector-8b-set! pal 3 (fix:lsh i -8))
+ (bytevector-u8-set! pal 0 #x00)
+ (bytevector-u8-set! pal 1 #x03)
+ (bytevector-u8-set! pal 2 (fix:and i 255))
+ (bytevector-u8-set! pal 3 (fix:lsh i -8))
(create-palette pal)
)
(define (make-grayscale-palette)
- (define pal (make-legacy-string (+ 4 (* 4 256))))
+ (define pal (make-bytevector (+ 4 (* 4 256))))
(define i 0)
(define (alloc r g b f)
(let ((base (fix:+ 4 (fix:* i 4))))
- (vector-8b-set! pal base r)
- (vector-8b-set! pal (fix:+ base 1) g)
- (vector-8b-set! pal (fix:+ base 2) b)
- (vector-8b-set! pal (fix:+ base 3) f)
+ (bytevector-u8-set! pal base r)
+ (bytevector-u8-set! pal (fix:+ base 1) g)
+ (bytevector-u8-set! pal (fix:+ base 2) b)
+ (bytevector-u8-set! pal (fix:+ base 3) f)
(set! i (1+ i))))
(alloc 0 0 0 0) ; Black is matched
((> grey 254))
(alloc grey grey grey PC_NOCOLLAPSE))
(alloc 255 255 255 0) ; White is matched
- (vector-8b-set! pal 0 #x00)
- (vector-8b-set! pal 1 #x03)
- (vector-8b-set! pal 2 (fix:and i 255))
- (vector-8b-set! pal 3 (fix:lsh i -8))
+ (bytevector-u8-set! pal 0 #x00)
+ (bytevector-u8-set! pal 1 #x03)
+ (bytevector-u8-set! pal 2 (fix:and i 255))
+ (bytevector-u8-set! pal 3 (fix:lsh i -8))
(create-palette pal)
)
(define (make-grayscale-128-palette)
- (define pal (make-legacy-string (+ 4 (* 4 256))))
+ (define pal (make-bytevector (+ 4 (* 4 256))))
(define i 0)
(define (alloc r g b f)
(let ((base (fix:+ 4 (fix:* i 4))))
- (vector-8b-set! pal base r)
- (vector-8b-set! pal (fix:+ base 1) g)
- (vector-8b-set! pal (fix:+ base 2) b)
- (vector-8b-set! pal (fix:+ base 3) f)
+ (bytevector-u8-set! pal base r)
+ (bytevector-u8-set! pal (fix:+ base 1) g)
+ (bytevector-u8-set! pal (fix:+ base 2) b)
+ (bytevector-u8-set! pal (fix:+ base 3) f)
(set! i (1+ i))))
(alloc 0 0 0 0) ; Black is matched
((> grey 254))
(alloc grey grey grey PC_NOCOLLAPSE))
(alloc 255 255 255 0) ; White is matched
- (vector-8b-set! pal 0 #x00)
- (vector-8b-set! pal 1 #x03)
- (vector-8b-set! pal 2 (fix:and i 255))
- (vector-8b-set! pal 3 (fix:lsh i -8))
+ (bytevector-u8-set! pal 0 #x00)
+ (bytevector-u8-set! pal 1 #x03)
+ (bytevector-u8-set! pal 2 (fix:and i 255))
+ (bytevector-u8-set! pal 3 (fix:lsh i -8))
(create-palette pal)
)
(loop (+ i 1)))))))))
(define (convert-palette external)
- (let ((s (make-legacy-string (+ 4 (* 4 256))))
+ (let ((s (make-bytevector (+ 4 (* 4 256))))
(n-entries (vector-length external)))
- (vector-8b-set! s 0 #x00)
- (vector-8b-set! s 1 #x03)
- (vector-8b-set! s 2 (fix:and #xFF n-entries))
- (vector-8b-set! s 3 (fix:and #xFF (fix:lsh n-entries -8)))
+ (bytevector-u8-set! s 0 #x00)
+ (bytevector-u8-set! s 1 #x03)
+ (bytevector-u8-set! s 2 (fix:and #xFF n-entries))
+ (bytevector-u8-set! s 3 (fix:and #xFF (fix:lsh n-entries -8)))
(do ((i 0 (fix:+ i 1))
(j 4 (fix:+ j 4)))
((fix:= i n-entries))
(let ((elt (vector-ref external i)))
(let ((rgb (remainder elt #x1000000))
(bits (quotient elt #x1000000)))
- (vector-8b-set! s j (fix:and #xFF elt))
- (vector-8b-set! s (fix:+ j 1) (fix:and #xFF (fix:lsh elt -8)))
- (vector-8b-set! s (fix:+ j 2) (fix:and #xFF (fix:lsh elt -16)))
- (vector-8b-set! s (fix:+ j 3)
- (if (or (fix:= 0 rgb) (fix:= #xFFFFFF rgb))
- 0
- bits)))))
+ (bytevector-u8-set! s j (fix:and #xFF elt))
+ (bytevector-u8-set! s (fix:+ j 1) (fix:and #xFF (fix:lsh elt -8)))
+ (bytevector-u8-set! s (fix:+ j 2) (fix:and #xFF (fix:lsh elt -16)))
+ (bytevector-u8-set! s (fix:+ j 3)
+ (if (or (fix:= 0 rgb) (fix:= #xFFFFFF rgb))
+ 0
+ bits)))))
(create-palette s)))
(define (client-width->window-width w)
(define (make-C-point-vector window vec)
(let* ((n (vector-length vec))
- (s (make-legacy-string (* 4 n))))
+ (s (make-bytevector (* 4 n))))
(define (loop i)
(if (fix:< i n)
(begin
(rgb-hex spec 2))
((string? spec)
(let ((pair
- (list-search-positive color-table
- (lambda (pair) (string-ci=? (car pair) spec)))))
+ (find (lambda (pair) (string-ci=? (car pair) spec))
+ color-table)))
(if pair
(cdr pair)
(graphics-error "Unknown color name:" spec))))
(declare (usual-integrations))
-(define-integrable int32-offset-ref
+(define-integrable int32-offset-ref
(ucode-primitive int32-offset-ref 2))
-(define-integrable int32-offset-set!
+(define-integrable int32-offset-set!
(ucode-primitive int32-offset-set! 3))
-(define-integrable uint32-offset-ref
+(define-integrable uint32-offset-ref
(ucode-primitive uint32-offset-ref 2))
-(define-integrable uint32-offset-set!
+(define-integrable uint32-offset-set!
(ucode-primitive uint32-offset-set! 3))
-(define-integrable byte-offset-ref vector-8b-ref)
-(define-integrable byte-offset-set! vector-8b-set!)
+(define-integrable byte-offset-ref bytevector-u8-ref)
+(define-integrable byte-offset-set! bytevector-u8-set!)
(define-integrable (loword dword) (modulo dword 65536))
(define-integrable (hiword dword) (integer-floor dword 65536))
(define-integrable (set-rect/bottom! r v) (int32-offset-set! (rect/mem r) 12 v))
(define (make-rect left top right bottom)
- (define r (%make-rect (make-legacy-string 16)))
+ (define r (%make-rect (make-bytevector 16)))
(set-rect/left! r left)
(set-rect/top! r top)
(set-rect/right! r right)
(byte-offset-set! (paintstruct/mem r) 28 (bool->int v)))
(define (make-paintstruct)
- (define r (%make-paintstruct (make-legacy-string 64)))
+ (define r (%make-paintstruct (make-bytevector 64)))
r)
(define-windows-type paintstruct
(pp-field 'f-restore paintstruct/f-restore)
(pp-field 'f-inc-update paintstruct/f-inc-update)
)
-