| 1 | // Copyright (c) 1995-1999 Matra Datavision |
| 2 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
| 3 | // |
| 4 | // The content of this file is subject to the Open CASCADE Technology Public |
| 5 | // License Version 6.5 (the "License"). You may not use the content of this file |
| 6 | // except in compliance with the License. Please obtain a copy of the License |
| 7 | // at http://www.opencascade.org and read it completely before using this file. |
| 8 | // |
| 9 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
| 10 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
| 11 | // |
| 12 | // The Original Code and all software distributed under the License is |
| 13 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
| 14 | // Initial Developer hereby disclaims all such warranties, including without |
| 15 | // limitation, any warranties of merchantability, fitness for a particular |
| 16 | // purpose or non-infringement. Please see the License for the specific terms |
| 17 | // and conditions governing the rights and limitations under the License. |
| 18 | |
| 19 | //============================================================================ |
| 20 | //==== Titre: AlienImage_SGIRGBFileHeader.hxx |
| 21 | //==== Role : The header file of primitve type "SGIRGBFileHeader" |
| 22 | //==== Implementation: This is a primitive type implemented with typedef |
| 23 | //==== typedef SGIRGBSGIRGBFileHeader AlienImage_SGIRGBFileHeader; |
| 24 | //============================================================================ |
| 25 | |
| 26 | #ifndef _AlienImage_SGIRGBFileHeader_HeaderFile |
| 27 | #define _AlienImage_SGIRGBFileHeader_HeaderFile |
| 28 | |
| 29 | //==== Definition de Type ==================================================== |
| 30 | #include <Standard_Type.hxx> |
| 31 | const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_SGIRGBFileHeader); |
| 32 | //============================================================================ |
| 33 | |
| 34 | #define IMAGIC 0732 |
| 35 | |
| 36 | /* colormap of images */ |
| 37 | #define CM_NORMAL 0 /* file contains rows of values which |
| 38 | * are either RGB values (zsize == 3) |
| 39 | * or greyramp values (zsize == 1) */ |
| 40 | #define CM_DITHERED 1 |
| 41 | #define CM_SCREEN 2 /* file contains data which is a screen |
| 42 | * image; getrow returns buffer which |
| 43 | * can be displayed directly with |
| 44 | * writepixels */ |
| 45 | #define CM_COLORMAP 3 /* a colormap file */ |
| 46 | |
| 47 | #define TYPEMASK 0xff00 |
| 48 | #define BPPMASK 0x00ff |
| 49 | #define ITYPE_VERBATIM 0x0000 |
| 50 | #define ITYPE_RLE 0x0100 |
| 51 | #define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE) |
| 52 | #define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM) |
| 53 | #define BPP(type) ((type) & BPPMASK) |
| 54 | #define RLE(bpp) (ITYPE_RLE | (bpp)) |
| 55 | #define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp)) |
| 56 | #define IBUFSIZE(pixels) ((pixels+(pixels>>6))<<2) |
| 57 | #define RLE_NOP 0x00 |
| 58 | |
| 59 | #define ierror(p) (((p)->flags&_IOERR)!=0) |
| 60 | #define ifileno(p) ((p)->file) |
| 61 | #define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p)) |
| 62 | #define putpix(p,x) (--(p)->cnt>=0 \ |
| 63 | ? ((int)(*(p)->ptr++=(unsigned)(x))) \ |
| 64 | : iflsbuf(p,(unsigned)(x))) |
| 65 | |
| 66 | typedef struct { |
| 67 | unsigned short imagic; /* stuff saved on disk . . */ |
| 68 | unsigned short type; |
| 69 | unsigned short dim; |
| 70 | unsigned short xsize; |
| 71 | unsigned short ysize; |
| 72 | unsigned short zsize; |
| 73 | unsigned int min; |
| 74 | unsigned int max; |
| 75 | unsigned int wastebytes; |
| 76 | char name[80]; |
| 77 | unsigned int colormap; |
| 78 | |
| 79 | int file; /* stuff used in core only */ |
| 80 | unsigned short flags; |
| 81 | short dorev; |
| 82 | short x; |
| 83 | short y; |
| 84 | short z; |
| 85 | short cnt; |
| 86 | unsigned short *ptr; |
| 87 | unsigned short *base; |
| 88 | unsigned short *tmpbuf; |
| 89 | unsigned int offset; |
| 90 | unsigned int rleend; /* for rle images */ |
| 91 | unsigned int *rowstart; /* for rle images */ |
| 92 | int *rowsize; /* for rle images */ |
| 93 | } AlienImage_SGIRGBFileHeader; |
| 94 | |
| 95 | AlienImage_SGIRGBFileHeader *iopen(); |
| 96 | AlienImage_SGIRGBFileHeader *icreate(); |
| 97 | |
| 98 | ostream& operator << ( ostream& s, const AlienImage_SGIRGBFileHeader& h ); |
| 99 | |
| 100 | Standard_Boolean operator==(const AlienImage_SGIRGBFileHeader& AnObject, |
| 101 | const AlienImage_SGIRGBFileHeader& AnotherObject) ; |
| 102 | void ShallowDump (const AlienImage_SGIRGBFileHeader& AnObject,Standard_OStream& S) ; |
| 103 | #endif |
| 104 | |