CLIM mail archive

[Prev][Next][Index][Thread]

Scaling transformation bug???



    Date: Tue, 22 Sep 1992 19:49 EDT
    From: chee@isi.edu

    Some graphical output is missing in my application when I use a
    scaling transformation, MAKE-SCALING-TRANSFORMATION, it seems that
    with some scaling factor, things don't get drawn at all - is that a
    "feature" or a bug?  This seems to occur only when something get
    scaled to a thickness of 1 pixel.

    The code below will illustrate the bug, you'll see 11 gaps with the
    default case, if you change the argument, Y-SCALE to something else, eg.
    .15, there's only 1 gap.  If it is .2, there is no gap, but the
    thickness varies.  Although the test below only demonstrate the
    problem in the X axes, it occurs in the Y direction as well.

This is not a CLIM bug.  The rasterization rules used by most graphics
systems (such as X Windows and Genera) allow very thin rectangles to end
up invisible, i.e., with no pixels turned on.  In general, very thin
lines are always at least one pixel thick.  You will need to check
explicitly for the case when you are trying to draw a rectangle that is
too thin to rasterize into anything visible.

    platform: SUN IPC     LUCID CL 4.1   CLIM 1.1
    (also in ALLEGRO 4.1 + CLIM 1.1, but no gaps for .15 - prolly due to
    the fact that DECF gives different results! - try
    (loop with i = 0.1 
	  for j from 1 to 10 do (print (decf i .0003))) )

You are ignoring floating point precision issues.

    (defun test (&optional (y-scale .1))
      (let ((window (clim::open-window-stream :width 650 :height 500
		       :parent (clim::open-root-window :clx :host "sunstruck.isi.edu"))))
			    ;;                 change to your machine ^^^^^^^^^^^^^
	(clim::window-expose window)

	(loop do 
	      (clim::window-clear window)
	      (loop for x from 1 to 600 by 20 do
		    (clim::with-drawing-options (window :transformation
							(clim::make-scaling-transformation 1 y-scale))
		      (clim::draw-rectangle* window (1- x) 2000 (+ x 18) 2007)
		      (decf y-scale 0.0003)
		      (clim::finish-output window)))
	      (restart-case (clim::accepting-values (window :own-window t)
				     (setq y-scale (clim::accept 'float :default y-scale
								 :prompt "New Y scaling factor"
								 :stream window)))
	       (abort () (clim::close window) (return-from test))))))

    Chee.



0,,

References:

Main Index | Thread Index