C++ MFC

Moderators: Lundin
Number of threads: 3354
Number of posts: 9032

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Windows Bmp or OS/2 Bmp ? Or Signed or Unsigned integer ? Posted by gyanarora on 26 Mar 2002 at 9:27 PM
Hi friend
How can I differntiate between OS/2 and windows Bitmap file.
Actually I have a Bmpviewer which works well for all versions of Bmp But when I try to open an OS/2 Bmp it starts performing operations without providing any output or error message.
I don't want to support OS/2 Images But want to display proper message for example "This Bmp is not supported".
So I need to differentiate these two types.

Or more specifically-

In file format specfication I have found that in Bmp width and Height of windows bitmap are signed data but in OS/2 these are unsigned.
So now more specifially I want to differentiate signed and Unsigned data types.
Regards
--Gyan

Report
Re: Windows Bmp or OS/2 Bmp ? Or Signed or Unsigned integer ? Posted by pingpong on 29 Mar 2002 at 11:57 PM
I dont know about signed and unsigned, but Windows BMP files have this layout:

BITMAPFILEHEADER
BITMAPINFOHEADER, BITMAPV4HEADER or BITMAPV5HEADER
RGBQUAD (if any)
DATA

While OS/2 BMP's have this layout:
BITMAPFILEHEADER
BITMAPCOREHEADER
RGBTRIPLE (if any)
DATA

As you can see, OS/2 bitmaps always have the same kind of second header. First DWORD in this second header is the size. So, after you read BITMAPFILEHEADER from the disk, read a DWORD, and if it's sizeof(BITMAPCOREHEADER) then this file is OS/2.

: Hi friend
: How can I differntiate between OS/2 and windows Bitmap file.
: Actually I have a Bmpviewer which works well for all versions of Bmp But when I try to open an OS/2 Bmp it starts performing operations without providing any output or error message.
: I don't want to support OS/2 Images But want to display proper message for example "This Bmp is not supported".
: So I need to differentiate these two types.
:
: Or more specifically-
:
: In file format specfication I have found that in Bmp width and Height of windows bitmap are signed data but in OS/2 these are unsigned.
: So now more specifially I want to differentiate signed and Unsigned data types.
: Regards
: --Gyan
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.