[Y-devel] Re: Measuring lengths (pixels or something else?)

Mikko Rantalainen mira at cc.jyu.fi
Fri Feb 27 09:27:20 GMT 2004


Chris Amshey <ychris at amshey.net> wrote:
> On Wed, Feb 25, 2004 at 04:31:57PM -0500, Aaron wrote:
> 
>>> of what underlying libraries/techniques/etc to display
>>> things, in terms of the x and y axis, are we measuring in
>>> pixels? dpi? some other quantity? we should decide this now
>>> if possible, so we can have internal consistancy in our x,y
>>> scheme.
> 
> We currently measure in pixels, and I think we should continue to
>  measure in pixels - the floating point math and rasterization
> efforts involved in any other scheme will cause poor performance
> and strange artifacts. We should (and don't yet, AFAIK) have a
> dpi value readily available at all levels so that scaling can be
> built in.

I think not using floating point because "it causes poor 
performance" is premature optimization. Look at resent benchmarks. 
Most new CPUs achieve best throughput with floating point numbers. 
True, actual rendering of pixels must be done with integer math 
because you cannot use floating point for pointers. However, 
positioning and sizing widgets should be done with floating point 
numbers, IMO. As for the origin and length, I think it doesn't 
matter where the origin is, but I think that we should use 
mathematical coordinates like OpenGL does: positive numbers to 
towards right and top, just like in any math book. For nicer scaling 
with future high resolution displays, I think defining the screen to 
be always 1.0 in high and the width would be dependant on aspect 
ratio so that 1.0 would be equal length in all directions.

Another nice length measurement would be to follow HTML/CSS and use 
base font size as basic measurement (em). That way, if the user 
thinks that the UI looks too small, he just adjusts the default font 
size and everything scales accordingly.

-- 
Mikko



More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved