Click here to Skip to main content
15,891,248 members
Articles / Desktop Programming / MFC

SUN Raster File Decoder

Rate me:
Please Sign up or sign in to vote.
2.72/5 (9 votes)
10 Jul 2004CPOL1 min read 51K   674   20  
This article provides information on the decoder for Sun Raster files.
#ifndef INCL_RASDEFINES
#define INCL_RASDEFINES

// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
// If your big endian system isn't being detected, add an OS specific check
#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
	(defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
	defined(__APPLE__)
#define RAS_BIGENDIAN
#endif // BYTE_ORDER

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <string.h>

struct BMP{void *data;};

#ifndef _WINDOWS_
#define _WINDOWS_

#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef NULL
#define NULL 0
#endif

#ifndef SEEK_SET
#define SEEK_SET  0
#define SEEK_CUR  1
#define SEEK_END  2
#endif

typedef long BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef long LONG;

#ifdef WIN32
#pragma pack(push, 1)
#else
#pragma pack(1)
#endif // WIN32

typedef struct tagRGBQUAD {
#ifdef RAS_BIGENDIAN
  BYTE rgbRed;
  BYTE rgbGreen;
  BYTE rgbBlue;
#else
  BYTE rgbBlue;
  BYTE rgbGreen;
  BYTE rgbRed;
#endif // RAS_BIGENDIAN
  BYTE rgbReserved;
} RGBQUAD;

#ifdef WIN32
#pragma pack(pop)
#else
#pragma pack()
#endif // WIN32

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; 

typedef struct tagBITMAPINFO { 
  BITMAPINFOHEADER bmiHeader; 
  RGBQUAD          bmiColors[1];
} BITMAPINFO, *PBITMAPINFO;

#endif // _WINDOWS_

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions