This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Looking for a few good words
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
In the beginning, there was the "Find Text" dialog. Many years went by with different variants and tweaks. Then came the Firefox trick of doing "less/more" like searches right in line. And now Apple has a nice integrated help thing that shows up for searching text. It's pretty cool me thinks.
So I thought to myself, could I do something like that for VisualWorks?
You still have to use Ctrl-l, I didn't touch that part of the issue. Just what happens when you actually do open a "find" session. It was a fun little afternoon project. It of course, uses Cairo to do this. Some ask "why not just implement VW VM primitives to do alpha blending. Why do I need a big solution like Cairo." My response is basically that alpha blending is a foundation for doing other things. Just because you can do alpha blending doesn't mean you can do the other things. It *may* provide a piece of the solution. A couple of things the above is doing that go above and beyond just having an alpha pixel channel:
Interpixellation - One thing the above is does not restrict drawing primitives to be pixel aligned. So you can draw lines half way between two pixels.
Gradients - There are two different overlay gradients used on the current selection to give it the glossy button look.
Grouping (buffering) - One thing that's easy in the above is to build a temporary surface to draw on, one that goes fast. It blinks when it updates because we have to use the VW invalidate mechanism for the underlying view. But the "fog" is actually 11 repeated draws, with a low alpha value, and the "holes" are grown bigger on each redraw, so it gives us the faded fog effect around the holes. But you don't see any of those because of the stack based grouping mechanism.
Negative Clip - Speaking of those holes... isn't that a neat trick? I didn't have to draw an alpha plane, but was able to specify that using paths instead. Be reversing the direction of the hole rectangles (with rounded edges) relative to the top rectangle path, and using the composite for a clip, we get a clip shape with "holes" in it.