(files "pango")
;;(depends-on "../glib/glib.ext")
(export ()
+ color? make-color color-red color-green color-blue color-alpha
+ set-color-red! set-color-green! set-color-blue! set-color-alpha!
+ make-rgba-color guarantee-color
->color pango-color-parse
<pango-layout>
pango-layout-get-context
(C-include "pango")
+(define-syntax error-if-null
+ (syntax-rules ()
+ ((_ ALIEN MESSAGE ...)
+ (if (alien-null? ALIEN)
+ (error MESSAGE ...)))))
+
+(define-integrable (color? object)
+ (and (flo:flonum? object) (fix:= 4 (flo:vector-length object))))
+
+(define-integrable (make-color) (flo:vector-cons 4))
+
+(define-integrable (color-red o) (flo:vector-ref o 0))
+(define-integrable (color-green o) (flo:vector-ref o 1))
+(define-integrable (color-blue o) (flo:vector-ref o 2))
+(define-integrable (color-alpha o) (flo:vector-ref o 3))
+
+(define-integrable (set-color-red! o r) (flo:vector-set! o 0 r))
+(define-integrable (set-color-green! o g) (flo:vector-set! o 1 g))
+(define-integrable (set-color-blue! o b) (flo:vector-set! o 2 b))
+(define-integrable (set-color-alpha! o a) (flo:vector-set! o 3 a))
+
+(define-integrable (make-rgba-color red green blue alpha)
+ (let ((color (make-color)))
+ (set-color-red! color red)
+ (set-color-green! color green)
+ (set-color-blue! color blue)
+ (set-color-alpha! color alpha)
+ color))
+
+(define (guarantee-color object operator)
+ (if (color? object)
+ object
+ (error:wrong-type-argument object "a color" operator)))
+
(define white (make-rgba-color 1. 1. 1. 1.))
(define black (make-rgba-color 0. 0. 0. 1.))
(set-color-alpha! color 1.)
(free rgb)
color))))
-
+\f
(define-class (<pango-layout> (constructor ()))
(<gobject>))