Friday, July 4, 2008

Reading Bitmap Objects II

[build 0027] Looking at the problem with the images it initially seemed like it might be a problem with bounds calculations. Initially I suspected my implementation of CRect intersection operation, that I had added to get the image import code to link, might be at fault. This was a hunch despite the fact that I had written Unit Tests for this essentially trivial function. Like many hunches it was quite wrong.

Later stepping through the code it occurred to me that I could have interchanged a hight and width when reading image dimensions. Again no problem - however I was not far wrong. As I stepped through the code where the DIB is set up from the CGImage I spotted this:
In a move that defies belief (rookie error) all the test images I worked with were 100px x 100px. Corrected results are a little better:

No comments: