Click to See Complete Forum and Search --> : Opinions on this image resize program....


James2007
February 5th, 2007, 01:39 PM
Ironically, in the course of writing this program, I may have found a bug in Paint and Windows Picture-Fax Viewer. (Although I have already notified Microsoft)

Take a look if you will.

(Note: The bug in Paint and Picture-Fax I am speaking of is that my program saves valid bitmaps, but Picture-Fax cannot view them. Paint can open them, but the colors are messed up. However, I write the data as stated valid for a 24 bit color bitmap, and MS's own LoadImage API correctly loads the bitmaps I write out. How do I know that? I am using LoadImage and I can reload those bitmaps that I save out.)

The 'color distortion' associated from 'shrinking' bitmaps with StretchDIBits or StretchBlt in certain situations is non-existent in this application. I wrote my own custom 'Scale' function for my Image class.

This application is tiny at only 14KB. (14336 bytes) :)

James2007
February 6th, 2007, 12:03 PM
Kind of a funny note, yet not.

Here is the 'bug' thing I was talking about.

Apparently, there is nothing wrong with Paint and those programs.

However, there is an issue with LoadImage due to the BITMAP specification.

I had a bug in my program of setting the bfOffBits member to sizeof(BITMAPINFOHEADER) + sizeof(BITMAPINFOHEADER). (should be sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER).

The bfOffBits member of the BITMAPFILEHEADER structure, was defined to be less than what it should have been.

LoadImage assumed the bitmap bits were at what could be considered 'default' offset in the data file.

But that is wrong. LoadImage should have rejected the file, but it did not.

Because of the nature of the bfOffBits member. It's defined to be where the bitmap data in the file starts. This allows a programmer to insert their own data structs into the file (as long as it's AFTER the BITMAPINFOHEADER structure.)

THAT is the bug with LoadImage. It should have rejected the file, when it did not because of the nature of the *.BMP file format.

A bug in my program ends up exposing a bug in the LoadImage API. And I thought it was with their programs. >_<

Bugs are not supposed to expose bugs. :lol:

James2007
February 19th, 2007, 02:38 PM
Sigh.....

No opinions?

ovidiucucu
February 19th, 2007, 05:07 PM
First opinion: it flickers when resizing the window. :D
Well, now serious... post the source code, then we can discuss.