Mike Schaeffer's Blog

Articles with tag: graphics
June 23, 2005

Oddly enough, the search term that brings the most visitors to my little website is "Texaco". I suspect most of those people go away totally unsatisfied, but there is a decent story behind the connection:

About ten years ago, a good friend of mine went to work in Texaco's IT Shop as a summer intern. One of his job responsibilities was to develop an intranet website. I forget the details, but somewhere along the way he decided he wanted to put a fancy banner picture atop the page. At the time, we were both interested in ray tracing, so we decided to throw together a raytraced version of the Texaco Star logo.

Using our copious free time, we found an online copy of the Texaco logo, took measurements of the star and rendered it as a white solid set against a metallic red hemisphere. We even went to the trouble of animating the star so it rotates, generating a bunch of frames and using a GIF tool to put together an animated GIF. The final result was a nicely animated Texaco logo with an "attractive" (This is by 1995 intranet standards, remember) banner to the side.

For some reason, that picture brings more visitors to this site than anything else. If you happen across this site and actually use the image for something you owe its presence to a ten year old accident of fate.

June 3, 2005

This post spoke to the use of ClearType to improve text rendering in vCalc. This "after" screenshot was taken from a laptop running ClearType:

Since ClearType depends on the unique properties of LCD's, it won't look as good on a CRT. (I still think it looks better than normal, though).

May 27, 2005

I just found about it, but I already think it might end up in vCalc. Anti Grain Geometry is a open source 2D rendering library with a very liberal license. The feature set looks pretty comprehesive: it supports anti-aliasing, affine transforms, sub-pixel resolution, and alpha blending. Even better, it's designed as a lightweight set of C++ classes, so it shouldn't bloat or slow down vCalc too much. About the only hole is that it doesn't have any kind of built in text rendering; However, even there there are are detailed instructions for using the Windows True Type renderer to generate glpyhs.

All I need now is time...

May 17, 2005

This is well documented on MSDN, but it's still pretty cool.

I've never been happy with the text quality of the vCalc display: it's jagged and at a font size that doesn't rasterize well on the displays I have access to. Well, as it turns out, this is relatively easy to fix. The LOGFONT structure that GDI uses to select fonts has a field, lfQuality, that is used to select the quality of the text rendering. Back in olden days, this field was used to do things like disallow scaling of bitmap fonts (if you don't know what that is, be thankful: it was awful). These days, it's used to turn on Antialiasing and Cleartype (on winXP). Thus, this one line of code:...

lf.lfQuality = CLEARTYPE_QUALITY;

...transformed this...

...into this.

There's also a setting for anti-aliasing:

lf.lfQuality = ANTIALIAS_QUALITY;

Anti-aliasing (in Windows) dates back to the Windows 95 Plus pack, so this setting should be much more widely supported. However, it's also much less powerful: it doesn't do any of the sub-pixel stuff and it is enabled far less often. In my experimentation, non-bold fonts had to be pretty big before anti-aliasing was used at all.

The other caveat is that this doesn't automatically buy you decent formatting of the text you display. That is, if you're still computing text positioning on per-pixel increments, you'll still get mediocre layout. vCalc does this, but it also has very minimal text layout requirements for now.

Older Articles...