[Y-devel] Cairo 2D drawing library.
Brent Gulanowski brentg at magma.ca
Thu Feb 26 17:21:50 GMT 2004
On Feb 26, 2004, at 12:45 PM, Sebastian Faubel wrote:
>
>> But in, say,
>> a tool bar, complete freedom would be pretty nice. The extreme,
>> however, is something like the dynamic resizing of the dock in Mac OS
>> X. Scaling bitmaps is not that big a deal -- if the images in the dock
>> were vector based, your computer would screech to a halt trying to
>> resize them dynamically.
>
> Scaling a bitmap is more a deal than scaling a vector graphic.
> Upscaling
> a bitmap, you have to recalculate the the missing pixels somehow. This
> looks ugly and needs extra system recources.
Yeah, but you overcome that by storing the bitmap at the maximum size
and only down-scaling. Apple restricts Icons to 128x128 and the icns
format stores also 64x64, 32x32, and 16x16 versions so you can provide
different smaller versions that look better than even a scaled down
version would. This is something I strongly urge Y to do for widgets.
Scaling often results in loss of clarity that has nothing to do with
fidelity of the original drawing.
>
> Upscaling a vetcor graphic you "only" have to recalculate the image,
> which takes up almost the same cpu capacity ( in the VGA or CPU ) but
> ends up in a clean image.
I don't know. My only real experience with this is Adobe Illustrator
but it seems to me that resampling is a much simpler and faster
operation than recalculating vector-based gradients. Some of the icons
in OS X, if rendered with Vectors, would have hundreds or thousands of
vector paths of arbitrary complexity, and some simply could not be
created with vectors at all (those based on photographs or high quality
paintings). The idea that you could dynamically scale two dozen
arbitrarily complex vector images at 20-30 fps without putting an
unacceptable load on the system is hard to believe.
I admit I have a slow computer (dual-867), but turning on dock
magnification and runnning the cursor over the dock causes what looks
like significant CPU load (by watching the admittedly low-res CPU
monitor). Even though some of the work is done in the GPU, the CPU
still has to calculate the nice scaling factors as the mouse moves,
which is a fair bit of work. Re-drawing vectors at that rate would be
impossible even on a dual G5. The GPU wouldn't be any help at all! I
have seen this kind of slowdown in the Aqua U.I. itself -- Aqua already
has full support for arbitrarily complex vector drawing, using
NSBezierPath. This is how Mail can put a little badge on its dock icon
with the number of new messages you have. You can quickly crush the
system by trying to dynamically redraw some set of bezier paths over
and over again in an animation-style scenario.
Granted this is not common and caching will be liberally used, but the
simple act of starting with a large enough bitmap is itself a kind of
caching, and is sufficient in almost all cases. I can certainly think
of exceptions, and none of my points are arguments against *having*
full vector support. I'm just asking for realism.
If you can prove me wrong, of course, I'd be happy :-), since I'm a
huge fan of ridiculously powerful graphics rendering systems, and I
think the Cairo stuff is fantastic. Screen shots are here:
https://freedesktop.org/~keithp/screenshots/
They are sweet indeed.
Cheers,
--
Brent Gulanowski brentg at magma.ca
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved