1 //-----------------------------------------------------------------------------
2 //
3 // ImageLib Sources
4 // Copyright (C) 2000-2002 by Denton Woods
5 // Last modified: 05/21/2002 <--Y2K Compliant! =]
6 //
7 // Filename: src-IL/include/il_pic.h
8 //
9 // Description: Softimage Pic (.pic) functions
10 //
11 //-----------------------------------------------------------------------------
12 
13 
14 #ifndef PIC_H
15 #define PIC_H
16 
17 #include "il_internal.h"
18 
19 #ifdef _MSC_VER
20 #pragma pack(push, packed_struct, 1)
21 #endif
22 typedef struct PIC_HEAD
23 {
24    ILint	Magic;			// PIC_MAGIC_NUMBER
25    ILfloat	Version;		// Version of format
26    ILbyte	Comment[80];	// Prototype description
27    ILbyte	Id[4];			// 'PICT'
28    ILshort	Width;			// Image width, in pixels
29    ILshort	Height;			// Image height, in pixels
30    ILfloat	Ratio;			// Pixel aspect ratio
31    ILshort	Fields;			// Picture field type
32    ILshort	Padding;		// Unused
33 } IL_PACKSTRUCT PIC_HEAD;
34 
35 typedef struct CHANNEL
36 {
37 	ILubyte	Size;
38 	ILubyte	Type;
39 	ILubyte	Chan;
40 	void	*Next;
41 } CHANNEL;
42 #ifdef _MSC_VER
43 #pragma pack(pop,  packed_struct)
44 #endif
45 
46 
47 // Data type
48 #define PIC_UNSIGNED_INTEGER	0x00
49 #define PIC_SIGNED_INTEGER		0x10	// XXX: Not implemented
50 #define PIC_SIGNED_FLOAT		0x20	// XXX: Not implemented
51 
52 
53 // Compression type
54 #define PIC_UNCOMPRESSED		0x00
55 #define PIC_PURE_RUN_LENGTH		0x01
56 #define PIC_MIXED_RUN_LENGTH	0x02
57 
58 // CHANNEL types (OR'd)
59 #define PIC_RED_CHANNEL			0x80
60 #define PIC_GREEN_CHANNEL		0x40
61 #define PIC_BLUE_CHANNEL		0x20
62 #define PIC_ALPHA_CHANNEL		0x10
63 #define PIC_SHADOW_CHANNEL		0x08	// XXX: Not implemented
64 #define PIC_DEPTH_CHANNEL		0x04	// XXX: Not implemented
65 #define PIC_AUXILIARY_1_CHANNEL	0x02	// XXX: Not implemented
66 #define PIC_AUXILIARY_2_CHANNEL	0x01	// XXX: Not implemented
67 
68 ILboolean iIsValidPic(void);
69 ILboolean iCheckPic(PIC_HEAD *Header);
70 ILboolean iLoadPicInternal(void);
71 ILboolean readScanlines(ILuint *image, ILint width, ILint height, CHANNEL *channel, ILuint alpha);
72 ILuint    readScanline(ILubyte *scan, ILint width, CHANNEL *channel,  ILint bytes);
73 ILboolean channelReadRaw(ILubyte *scan, ILint width, ILint noCol, ILint *off, ILint bytes);
74 ILboolean channelReadPure(ILubyte *scan, ILint width, ILint noCol, ILint *off, ILint bytes);
75 ILboolean channelReadMixed(ILubyte *scan, ILint width, ILint noCol, ILint *off, ILint bytes);
76 
77 
78 
79 #endif//PIC_H
80