Smooth as a baby's bottom #

While fooling around with the dragging between the various sizes, I noticed that drawing a 3 pixel thick border in the 48 x 48 size, and then dragging it over to the 16 x 16 slot (this involved scaling it down) yielded some reasonable looking anti-aliasing (this is because of the way QuickDraw implements copying when the source and target rectangle are of different sizes). Actually I'd kinda noticed this before, but I hadn't really thought about using it to add anti-aliasing.

In any case, as a quick test, I wrote a quick FrameOvalAA (as opposed to the normal FrameOval) function which drew an oval with a 3 x 3 pen and then copied it down to size. Everything seemed to work all right, but it order to get it to look exactly as it was meant, a bit more tweaking was required. The problem is that not only does the oval have to be anti-aliased, but it has to blend in with the background as well. What I ended up doing was to create an 8 bit mask which had the anti-aliased shape in it, and using that to composite the current icon contents and the foreground color. I was originally creating a few scratch GWorlds, but then I realized that I had the canvas gworld used by all the icns editors, so now I'm using different areas of it for the 3x version, the mask and the foreground color. Since it involves 2 additional CopyBits/CopyDeepMask passes, the function probably isn't fast enough for real-time anti-aliasing, so I left in the old (non anti-aliased) code for the oval that is drawn while the user is dragging the mouse.

I figured that since this worked out pretty well, I should do the line tool next. The base idea here was the same too, but it required a little bit more tweaking. The problem was that since, when the line has a thickness greater than 1, it extends beyond the starting and ending points (at least with the line drawing method that QuickDraw uses). I had to add some extra padding, and make sure that vertical and horizontal lines were still being drawn (since they would "fit" in a zero width/height rectangle).

The polygon tool shares some aspects with the line tool, so I moved on to that one. This also required some padding, and since I was using the built-in Mac OS data-type for sotoring them, I had to use some different functions (MapPolygon) to enlarge the polygon to 3x the size.

Then, going back I realized that filled ovals weren't quite behaving as expected. The problem was that the frame wasn't quite covering the edges of the filled center, so most of the anti-aliasing was lost (this was most noticeable when the fill and the frame were of the same color). Some additional hacking was required (and the current code is rather ugly), but the ovals now look good whether they're filled or not.

This lead me to notice two things: 1) a somewhat similar anomaly seems to be happening with the filled polygons too. 2) I was getting frequent freezes when attempting to use the pattern pop-up (the ovals can be filled with patterns too). I'll try to determine if this is because of the beta drivers I'm using for my graphics card (the freeze seems to take place in a function called TerminateGraphicsAcceleration), or if it's my fault. In any case, I'll be dealing with both of these tomorrow.

Anti-aliasing will be even more useful when I add the simultaneous icon and mask drawing. Then I have to combine the anti-aliased mask with the icon mask, and then color with the icon. Rather hard to explain, but much easier to demonstrate visually. I'll see about drawing up some mockups to show what the intended effect is.

No mail from the Apple person (they said they'd contact me by the 15th). If there still isn't anything by tomorrow, I'll email them asking what's up. They haven't been specific at all as to what exactly they want changed in Iconographer, and I'm really curious :p

I think that alternating back and forth between Meshroom and Iconographer is a good idea, because they're really projects at opposite ends of the spectrum. Meshroom (in it's current state) is still in the planning stages (yes, I'm actually trying to have a pretty detailed plan before I start coding) while Iconographer has a complete base and a large amount of features, and now I'm just adding things on (although a big restructuring might come in the future).

Post a Comment