Aqua Enhancements 15
Marsee writes: "Mike Beam looks at two Aqua enhancements -- one seemingly frivolous and the other not: animated window resizing and drawers." O'Reilly's really invested in Mac OS X, and they often have nice articles for developers on a wide range of subjects in their Mac DevCenter.
Re:Windows (Score:1)
Re:Windows (Score:2, Insightful)
I used to work at the university call center. You wouldn't believe the number of people who claimed that Windows lost the program they were working on. It turns out that they would hit the minimize button or some keystroke. Then the application would minimize without warning. By having Aqua show you where things went, you can find them without any knowldege of computers.
Resolution Independance (Score:5, Insightful)
Actually, using floating points is a very good thing for GUI stuff. While it might seem pointless for window sizes, all coordinates in Quartz are floating point. This makes it posible to work in a resolution independant way.
Thinking of the screen as a discret grid is not the way to go if you want to handle anti-aliasing, sub-pixel text positioning, scaling for a screen with a different size/resolution, etc...
Remember that Quartz is used for handling on screen drawing, but also printing -- current printers can have 24 times more resolution than your screen (2400 DPI vs 100)- so if you use the discrete grid of your screen to describe stuff for your printer, you can only adress directly one pixel out of 576.
Re:Resolution Independance (Score:2)
Are you saying that Aqua actually does "anti-aliasing, sub-pixel text positioning, scaling for a screen with a different size/resolution" or that you think it might?
Also, typically floating point operations are much slower than equivalent integer operations. If you need to divide integers, create a rational type. (apologies, my C is rusty)
From there it should be simple to build arithmetic operations for this rational type. Of course, this isn't going to help if you want the square root of a number but you can always build a polynomial type :)
I certainly hope that Mac OS X uses some sort of vector format for printing rather than printing from the screen (a raster display) :)
Slower floating point?? (Score:2, Informative)
Erm. On a 386 maybe. These days FP mults and adds are as quick as (and sometimes faster than)integer ones.
Re:Resolution Independance (Score:1)
Fixed point (Score:4, Informative)
If you really want not to use floating point calculation, then rational numbers are not the way to go. Instead you should use fixed point numbers. Old 68K based macintoshes (without FPUs) relied on those for fast calculation - in fact as far as I remember, the original Quickdraw toolbox relied of fixed point number for geometric calculations (arcs, slopes, etc.).
Basically, the idea is to use integers divided by a fixed number, so that the binary number has a fixed point. For instance if you have 32 bits numbers, you assume they are divided by 65536. This means that you have 16 bits before the point, and 16 bits after. This way for additions and substractions, you can use integer operations, calculation can also use the zero and sign flags of the processor. For mulitplication and division, you need to fiddle the integer system a bit (by multiplying or dividing by 2^16), but this could be done using shift operations, which are quite fast.
The rational structure you propose is not good because a simple addition requires many assembly level operations. For instance to calculate 6/5 + 2/3, you need to do the following calculation:
Rational numbers are good if you want absolute precision, but for they are not very fast - because there is no support for such a format in current processor instruction sets.
As for OS X using a vector format, this is, of course the case. Quarty relies on the PDF abstractions and it does support anti-aliasing, and sub-pixel positioning (I don't know for screen scaling). But having a vector format is not sufficient Quickdraw was also vector based, but used an integer coordinate system. This meant that lines, rectangles and arcs had to have their extremities on round coordinates of the Quickdraw grid - the result was not always very satisfactory.
Publishers like O'Reilly (Score:2, Insightful)
Other, more lukewarm publishers won't sell as many products, and in turn say "See, we were right! OS X isn't as cool as you all thought."
It is a self-fulfilling prophecy, but O'Reilly has seemed to fulfill a good one for themselves, rather than a bad one. Bravo, I say!