PICTs, PNGs, and bitmaps

I spent a lot of time working through the issues of replacing the use of PICTs (Macintosh image format) with other standardized image formats this week. As I have written before, Apple has deprecated (made obsolete) the use of most of the Quickdraw imaging and drawing APIs in the Macintosh, effective in OS X 10.4. While they're still supported, they could go away at any time; so... I had to come up with another way of translating calculator screen images (which are simple bitmap byte arrays) into something displayable on a Macintosh, and able to be moved around the network. To do this, I'm using the new Quartz 2D API in Mac OS X. I can now create images by "painting" the pixels. I also found another way ( looking at some code written by another engineer ), but that method had the bad luck of not being able to translate from a core image in Quartz to anything other than a 1-bit deep TIFF image. I needed to be able to move from calculator screens to TIFF, GIF, PNG, and JPEG. My "painting" a color image from the pixel map seems to work for this capability.

Going the other way is a bit trickier. I came up with a method of taking the bitmap data from the various image formats and parsing through them to figure a threshold value for translating a potentially color image into a black and white bitmap. I've currently set the threshold at about 38% of black vs white. So far, it looks pretty good.

I've also been working with a few other things that are new to this release. Getting the software ready for the new Intel-based Macintosh systems means I've had to go through and fix a few data structures that are passed around the system via Apple Events. Contents of the data structure have to be stored in a fixed format to deal with "endian" issues. So, enter Core Endian "flippers". I've got one written to deal with the calculator directory structure that gets passed around. From preliminary testing, it looks like its working as advertised.

Next week, I'll be getting ready to start work on another project (part-time) that needs my expertise and ability. Back to my roots in embedded work and, unfortunately, back onto a Windows-based platform for developmental tools for this project. Oh well... necessary evil I guess... Happy

|