Menu

loading bitmap file in linux

Dr deo
2009-08-29
2012-09-26
  • Dr deo

    Dr deo - 2009-08-29

    am trying to load a bitmap file in linux to use for texturing in opengl. The problem is that i cant find the alternate declarations for structures like BITMAPINFOHEADER, BITMAPFILEHEADER,DWORD,WORD,LONG...
    I got the following from msdn.com

    typedef struct tagBITMAPFILEHEADER {
    WORD bfType;
    DWORD bfSize;
    WORD bfReserved1;
    WORD bfReserved2;
    DWORD bfOffBits;
    } BITMAPFILEHEADER;

    typedef struct tagBITMAPINFOHEADER {
    DWORD biSize;
    LONG biWidth;
    LONG biHeight;
    WORD biPlanes;
    WORD biBitCount;
    DWORD biCompression;
    DWORD biSizeImage;
    LONG biXPelsPerMeter;
    LONG biYPelsPerMeter;
    DWORD biClrUsed;
    DWORD biClrImportant;
    }BITMAPINFOHEADER, *PBITMAPINFOHEADER;

    but i still need to define DWORD, LONG, WORD using their C/C++ equivalents.
    some thing like.....
    typedef char BYTE
    typedef ???? DWORD

                     Thanks.                 Dr Deo
    
     
    • cpns

      cpns - 2009-08-30

      Re you in the right place? This is teh Dev-C++ forum. Dev-C++ on Linux was abandoned long-ago.

      Lets be clear: Are you attempting to port some Windows code to Linux? If you want to know how those types and structures are defined, you simply need to look in the header in which they are defined. None of that is hidden from you.

      That said MSDN also documents all these at http://msdn.microsoft.com/en-us/library/cc230309%28PROT.10%29.aspx You would most safely define them in terms of <stdint.h> types in Linux. Then it would be 32/64 bit portable. http://www.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html

      Of course the simplest way to port this may be to use Wine, or just utilise an existing bitmap manipulation library of which there must be many.

      "bitmap" is not itself a file format, it is merely an adjective that might be applied to any number of formats. You'd have to be specific, but you could generate it 'clean' and avoid any possible copyright issues by using the documented format specification. Assuming a Windows Bitmap (.bmp) file then http://www.wotsit.org/list.asp?search=windows+bitmap for example.

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.