clip2icns pre-8.5 Hacking #

(argh, I've written this before, but I crashed, so I have to do it again)

Not much time for coding (big history rough draft was due, among other things). Major thing that happened was that I found (well, some users found, and they were registered so I had to pay attention) that clip2icns refused to work under pre 8.5 systems. It took me about a week to figure out why. The actual crash occured when I disposed of a PixMap in the Make1BitMask function. By selectively commenting out lines I had traced it to the call to CalcCMask (a system function). I beat my head against this for a few days, trying many things (including copying the source to a local PixMap, locking the source/target (again), taking out the customized color search function from CalcCMask, and other stuff). In the end I did a search at DejaNews (an archive of Usenet postings, including comp.sys.mac.programmer.*) and found my answer. It turns out that CalcCMask wants a real BitMap* for the target parameter. I was used to CopyBits, which also wants a BitMap*, but a casted PixMap* works too. Apparently this was changed in Mac OS 8.5, which is why I didn't happen while I was developing the function. And I didn't notice it before since I had used a different method of determining the mask (a much uglier one, which had been inhereted from clip2cicn, the first real (as in distributed) mac program I did, back in early June).

I also had to do a workaround, this time for a documented bug (which was fixed in Mac OS 8.5). Apparently calling CopyDeepMask when the target is a 8 bit (or less) GWorld will yield nothing in it. What I had to do was to use a temporary 32 bit GWorld which I then transferred to the 8 bit by using CopyBits. All of this went into clip2icns 1.5.1. Speaking of clip2icns, the number of registrations has topped 50, so I'm halfway to my (just established) goal of 100.

Post a Comment