anchor.diff:        (int16 x1) (int16 y1) (card16 w) (card16 h))))
   
   ;; fill rectangles, colors.
  +
  +(defun render-triangles-1 (picture op source src-x src-y format coord-sequence)
  +  ;; For performance reasons we do a special typecase on (simple-array
  +  ;; (unsigned-byte 32) (*)), so that it'll be possible to have high
  +  ;; performance rasters.
  +  (macrolet ((guts ()
  +               '(let ((display (picture-display picture)))
  +                 (synchronise-picture-state picture)
  +                 (synchronise-picture-state source)
  +                 (with-buffer-request (display (extension-opcode display "RENDER"))
  +                   (data +X-RenderTriangles+)
  +                   (render-op op)                       ;op
  +                   (card8 0)                            ;pad
  +                   (card16 0)                           ;pad
  +                   (resource-id (picture-id source))
  +                   (resource-id (picture-id picture))
  +                   (picture-format format)
  +                   (int16 src-x)
  +                   (int16 src-y)
  +                   ((sequence :format int32) coord-sequence) ))))
  +    (typecase coord-sequence
  +      ((simple-array (unsigned-byte 32) (*))
  +       (locally
  +           (declare (type (simple-array (unsigned-byte 32) (*)) coord-sequence))
  +         (guts)))
  +      (t
  +       (guts)))))
  +
  +#||
  +(defun render-set-picture-transform (picture mxx mxy dx mxy myy dy &optional (mwx 0) (mwy 0) (dw 1))
  +  ...)
  +||#
  +
  +(defun render-set-picture-transform (picture a b c d e f p q r)
  +  (let ((display (picture-display picture)))
  +    (ensure-render-initialized display)
  +    (synchronise-picture-state picture)
  +    (with-buffer-request (display (extension-opcode display "RENDER"))
  +      (data +X-RenderSetPictureTransform+)
  +      #|
  +      (card8 0) ;; render-op op)                    ;op
  +      (card8 0)                         ;pad
  +      (card16 0)                        ;pad
  +      |#
  +      (resource-id (picture-id picture))
  +      
  +      (card32 a)
  +      (card32 b)
  +      (card32 c)
  +      
  +      (card32 d)
  +      (card32 e)
  +      (card32 f)
  +      
  +      (card32 p)
  +      (card32 q)
  +      (card32 r))))
  +
  +(defun render-query-filters (drawable)
  +  (let ((display (drawable-display drawable)))
  +    (with-buffer-request-and-reply (display (extension-opcode display "RENDER") nil)
  +      ((data +X-RenderQueryFilters+)
  +       (drawable drawable))
  +      (let* ((len (card32-get 4))
  +             (n-aliases (card32-get 8))
  +             (n-filters (card32-get 12))
  +             (off (+ (* 8 4) (* 4 (ceiling (* 2 n-aliases) 4)))))
  +        (print (list :aliases
  +                     (loop for i below n-aliases collect (card16-get (+ (* 8 4) (* i 2))))))
  +        (print (list :foo len n-aliases n-filters
  +                     (loop for i below len
  +                           collect (card8-get (+ off 0 (* 4 i)))
  +                           collect (card8-get (+ off 1 (* 4 i)))
  +                           collect (card8-get (+ off 2 (* 4 i)))
  +                           collect (card8-get (+ off 3 (* 4 i))))))
  +        (print
  +         (labels ((grab-string (j)
  +                    (let ((n (card8-get j)))
  +                      (incf j)
  +                      (values
  +                       (map 'string #'code-char (loop repeat n collect (card8-get j) do (incf j)))
  +                       j))))
  +           (loop repeat n-filters collect
  +                 (multiple-value-bind (s j) (grab-string off)
  +                   (setf off j)
  +                   (intern (string-upcase s) :keyword)))))
  +        #+NIL
  +        (loop for i below n-picture-formats
  +              collect
  +              (let ((off (+ (* 8 4)
  +                            (* i 28)))) ;size of picture-format-info
  +                (make-picture-format
  +                 :display display
  +                 :id         (card32-get (+ off 0))
  +                 :type       (member8-get (+ off 4) :indexed :direct)
  +                 :depth      (card8-get   (+ off 5))
  +                 :red-byte   (byte (integer-length (card16-get (+ off 10)))
  +                                   (card16-get (+ off 8)))
  +                 :green-byte (byte (integer-length (card16-get (+ off 14)))
  +                                   (card16-get (+ off 12)))
  +                 :blue-byte  (byte (integer-length (card16-get (+ off 18)))
  +                                   (card16-get (+ off 16)))
  +                 :alpha-byte (byte (integer-length (card16-get (+ off 22)))
  +                                   (card16-get (+ off 20)))
  +                 :colormap   (let ((cmid (card32-get (+ off 24))))
  +                               (unless (zerop cmid)
  +                                 (lookup-colormap display cmid))))))))))
  +
  +(defun render-set-filter (picture filter)
  +  (let ((display (picture-display picture)))
  +    (ensure-render-initialized display)
  +    (synchronise-picture-state picture)
  +    (with-buffer-request (display (extension-opcode display "RENDER"))
  +      (data +X-RenderSetPictureFilter+)
  +      (resource-id (picture-id picture))
  +      (card16 (length filter))
  +      (card16 0)                        ;pad
  +      ((sequence :format card8) (map 'vector #'char-code filter)))))
  +  
  +
  +
  +#||
  +(defun render-triangle (destination source x1 y1 x2 y2 x3 y3 &key (src-x 0) (src-y 0) (format nil) (op :over))
  +  (render-triangles-1 destination op source ...)
  +  )
  +||#
  +
  +(defun render-trapezoids-1 (picture op source src-x src-y format coord-sequence)
  +  ;; coord-sequence is  top bottom
  +  ;;                    line-1-x1 line-1-y1 line-1-x2 line-1-y2
  +  ;;                    line-2-x1 line-2-y1 line-2-x2 line-2-y2 ...
  +  ;;
  +  (let ((display (picture-display picture)))
  +    (synchronise-picture-state picture)
  +    (synchronise-picture-state source)
  +    (with-buffer-request (display (extension-opcode display "RENDER"))
  +      (data +X-RenderTrapezoids+)
  +      (render-op op)                    ;op
  +      (card8 0)                         ;pad
  +      (card16 0)                        ;pad
  +      (resource-id (picture-id source))
  +      (resource-id (picture-id picture))
  +      (picture-format format)
  +      (int16 src-x)
  +      (int16 src-y)
  +      ((sequence :format int32) coord-sequence) )))
   
   (defun render-composite (op
                            source mask dest
  
positive.code:        (maphash (lambda (k f)
                    (declare (ignore k))
                    (when (and (eql (picture-format-type f) :direct)
                               (eql (dpb -1 (picture-format-red-byte f) 0)
                                    (visual-info-red-mask vi))
                               (eql (dpb -1 (picture-format-green-byte f) 0)
  
negative.code:                (unless (zerop (byte-size (cdr k)))
                   (format bag " ~A~D" (car k) (byte-size (cdr k)))))))))
      (print-unreadable-object (object stream :type t :identity nil)
        (format stream "~D ~S ~S ~S~A"
                (picture-format-id object)
                (picture-format-colormap object)
                (picture-format-depth object)
                (picture-format-type object) abbrev))))
  
  (eval-when (eval compile load)
  