[mcclim-devel] how to do pixel-by-pixel output?

Nikodemus Siivola nikodemus at random-state.net
Tue Jan 22 23:28:38 UTC 2008


I realize this may be a case of "Doctor, it hurts when I do this..", but
I'm hoping there is some medicine to be had.

I'm displaying images from my raytracer on a canvas as they are being rendered.
I don't require per pixel updating -- any buffering scheme that updates the
screen "every once in a while" is fine by me.

Below is what I have now, and it sucks royally: DRAW-PIXEL* calls take ~8
seconds on a 400*600 region, and everything else takes < 1 second... (on CLX
backend.)

(defun render-scene (scene medium)
  (let* ((pixmap nil)
         (region (sheet-region medium))
         (width (bounding-rectangle-width region))
         (height (bounding-rectangle-height region))
         (end (- width 1)))
    (unwind-protect
         (progn
           (setf pixmap (allocate-pixmap medium width height))
           (raylisp::render scene (raylisp::scene-default-camera scene)
                            width height
                            (lambda (color x y)
                              (declare (type (simple-array
single-float (3)) color)
                                       (type fixnum x y))
                              (progn
                                (draw-point* pixmap x y :ink
(make-rgb-color (aref color 0) (aref color 1) (aref color 2)))
                                (when (= x end)
                                  (copy-from-pixmap pixmap 0 y width 1
medium 0 y))))
                            :normalize-camera t))
      (when pixmap (deallocate-pixmap pixmap)))))

What I would like (and what the above tries to do, but fails) is to get hold of
a some sort of object onto which I can efficiently blast colors pixel
by pixel, and
then update the screen using a convenient-for-me interval.

Cheers,

 -- Nikodemus



More information about the mcclim-devel mailing list