- Main Page
- Data Structures
- Files

# /home/dwoods/DevIL/src-IL/include/il_psp.h

    00001 //-----------------------------------------------------------------------------
    00002 //
    00003 // ImageLib Sources
    00004 // Copyright (C) 2000-2002 by Denton Woods
    00005 // Last modified: 05/02/2002 <--Y2K Compliant! =]
    00006 //
    00007 // Filename: src-IL/include/il_psp.h
    00008 //
    00009 // Description: Reads a Paint Shop Pro file.
    00010 //
    00011 //-----------------------------------------------------------------------------
    00012
    00013
    00014 #ifndef PSP_H
    00015 #define PSP_H
    00016
    00017 #include "il_internal.h"
    00018
    00019
    00020 // Block identifiers
    00021 enum PSPBlockID {
    00022         PSP_IMAGE_BLOCK = 0,                    // (0)  General Image Attributes Block (main)
    00023         PSP_CREATOR_BLOCK,                              // (1)  Creator Data Block (main)
    00024         PSP_COLOR_BLOCK,                                // (2)  Color Palette Block (main and sub)
    00025         PSP_LAYER_START_BLOCK,                  // (3)  Layer Bank Block (main)
    00026         PSP_LAYER_BLOCK,                                // (4)  Layer Block (sub)
    00027         PSP_CHANNEL_BLOCK,                              // (5)  Channel Block (sub)
    00028         PSP_SELECTION_BLOCK,                    // (6)  Selection Block (main)
    00029         PSP_ALPHA_BANK_BLOCK,                   // (7)  Alpha Bank Block (main)
    00030         PSP_ALPHA_CHANNEL_BLOCK,                // (8)  Alpha Channel Block (sub)
    00031         PSP_COMPOSITE_IMAGE_BLOCK,              // (9)  Composite Image Block (sub)
    00032         PSP_EXTENDED_DATA_BLOCK,                // (10) Extended Data Block (main)
    00033         PSP_TUBE_BLOCK,                                 // (11) Picture Tube Data Block (main)
    00034         PSP_ADJUSTMENT_EXTENSION_BLOCK, // (12) Adjustment Layer Block (sub)
    00035         PSP_VECTOR_EXTENSION_BLOCK,             // (13) Vector Layer Block (sub)
    00036         PSP_SHAPE_BLOCK,                                // (14) Vector Shape Block (sub)
    00037         PSP_PAINTSTYLE_BLOCK,                   // (15) Paint Style Block (sub)
    00038         PSP_COMPOSITE_IMAGE_BANK_BLOCK, // (16) Composite Image Bank (main)
    00039         PSP_COMPOSITE_ATTRIBUTES_BLOCK, // (17) Composite Image Attr. (sub)
    00040         PSP_JPEG_BLOCK,                                 // (18) JPEG Image Block (sub)
    00041         PSP_LINESTYLE_BLOCK,                    // (19) Line Style Block (sub)
    00042         PSP_TABLE_BANK_BLOCK,                   // (20) Table Bank Block (main)
    00043         PSP_TABLE_BLOCK,                                // (21) Table Block (sub)
    00044         PSP_PAPER_BLOCK,                                // (22) Vector Table Paper Block (sub)
    00045         PSP_PATTERN_BLOCK,                              // (23) Vector Table Pattern Block (sub)
    00046 };
    00047
    00048
    00049 // Bitmap type
    00050 enum PSPDIBType {
    00051         PSP_DIB_IMAGE = 0,      // Layer color bitmap
    00052         PSP_DIB_TRANS_MASK,     // Layer transparency mask bitmap
    00053         PSP_DIB_USER_MASK,      // Layer user mask bitmap
    00054         PSP_DIB_SELECTION,      // Selection mask bitmap
    00055         PSP_DIB_ALPHA_MASK,     // Alpha channel mask bitmap
    00056         PSP_DIB_THUMBNAIL       // Thumbnail bitmap
    00057 };
    00058
    00059 // Channel types
    00060 enum PSPChannelType {
    00061         PSP_CHANNEL_COMPOSITE = 0,      // Channel of single channel bitmap
    00062         PSP_CHANNEL_RED,                        // Red channel of 24 bit bitmap
    00063         PSP_CHANNEL_GREEN,                      // Green channel of 24 bit bitmap
    00064         PSP_CHANNEL_BLUE                        // Blue channel of 24 bit bitmap
    00065 };
    00066
    00067 // Possible metrics used to measure resolution
    00068 enum PSP_METRIC {
    00069         PSP_METRIC_UNDEFINED = 0,       // Metric unknown
    00070         PSP_METRIC_INCH,                        // Resolution is in inches
    00071         PSP_METRIC_CM                           // Resolution is in centimeters
    00072 };
    00073
    00074
    00075 // Possible types of compression.
    00076 enum PSPCompression {
    00077         PSP_COMP_NONE = 0,      // No compression
    00078         PSP_COMP_RLE,           // RLE compression
    00079         PSP_COMP_LZ77,          // LZ77 compression
    00080         PSP_COMP_JPEG           // JPEG compression (only used by thumbnail and composite image)
    00081 };
    00082
    00083
    00084 // Picture tube placement mode.
    00085 enum TubePlacementMode {
    00086         tpmRandom,              // Place tube images in random intervals
    00087         tpmConstant             // Place tube images in constant intervals
    00088 };
    00089
    00090 // Picture tube selection mode.
    00091 enum TubeSelectionMode {
    00092         tsmRandom,              // Randomly select the next image in tube to display
    00093         tsmIncremental, // Select each tube image in turn
    00094         tsmAngular,             // Select image based on cursor direction
    00095         tsmPressure,    // Select image based on pressure (from pressure-sensitive pad)
    00096         tsmVelocity             // Select image based on cursor speed
    00097 };
    00098
    00099 // Extended data field types.
    00100 enum PSPExtendedDataID {
    00101         PSP_XDATA_TRNS_INDEX = 0        // Transparency index field
    00102 };
    00103
    00104 // Creator field types.
    00105 enum PSPCreatorFieldID {
    00106         PSP_CRTR_FLD_TITLE = 0,         // Image document title field
    00107         PSP_CRTR_FLD_CRT_DATE,          // Creation date field
    00108         PSP_CRTR_FLD_MOD_DATE,          // Modification date field
    00109         PSP_CRTR_FLD_ARTIST,            // Artist name field
    00110         PSP_CRTR_FLD_CPYRGHT,           // Copyright holder name field
    00111         PSP_CRTR_FLD_DESC,                      // Image document description field
    00112         PSP_CRTR_FLD_APP_ID,            // Creating app id field
    00113         PSP_CRTR_FLD_APP_VER,           // Creating app version field
    00114 };
    00115
    00116 // Creator application identifiers.
    00117 enum PSPCreatorAppID {
    00118         PSP_CREATOR_APP_UNKNOWN = 0,    // Creator application unknown
    00119         PSP_CREATOR_APP_PAINT_SHOP_PRO  // Creator is Paint Shop Pro
    00120 };
    00121
    00122 // Layer types.
    00123 enum PSPLayerType {
    00124         PSP_LAYER_NORMAL = 0,                   // Normal layer
    00125         PSP_LAYER_FLOATING_SELECTION    // Floating selection layer
    00126 };
    00127
    00128 // Truth values.
    00129 /*enum PSP_BOOLEAN {
    00130         FALSE = 0,
    00131         TRUE
    00132 };*/
    00133
    00134
    00135
    00136 #ifdef _MSC_VER
    00137 #pragma pack(push, packed_struct, 1)
    00138 #endif
    00139 typedef struct PSPRECT
    00140 {
    00141         ILuint x1,y1,x2,y2;
    00142 } IL_PACKSTRUCT PSPRECT;
    00143
    00144 typedef struct PSPHEAD
    00145 {
    00146         char            FileSig[32];
    00147         ILushort        MajorVersion;
    00148         ILushort        MinorVersion;
    00149 } IL_PACKSTRUCT PSPHEAD;
    00150
    00151 typedef struct BLOCKHEAD
    00152 {
    00153         ILubyte         HeadID[4];
    00154         ILushort        BlockID;
    00155         ILuint          BlockLen;
    00156 } IL_PACKSTRUCT BLOCKHEAD;
    00157
    00158 typedef struct GENATT_CHUNK
    00159 {
    00160         ILint           Width;
    00161         ILint           Height;
    00162         ILdouble        Resolution;
    00163         ILubyte         ResMetric;
    00164         ILushort        Compression;
    00165         ILushort        BitDepth;
    00166         ILushort        PlaneCount;
    00167         ILuint          ColourCount;
    00168         ILubyte         GreyscaleFlag;
    00169         ILuint          SizeOfImage;
    00170         ILint           ActiveLayer;
    00171         ILushort        LayerCount;
    00172         ILuint          GraphicContents;
    00173 } IL_PACKSTRUCT GENATT_CHUNK;
    00174
    00175 typedef struct LAYERINFO_CHUNK
    00176 {
    00177         ILubyte         LayerType;
    00178         PSPRECT         ImageRect;
    00179         PSPRECT         SavedImageRect;
    00180         ILubyte         Opacity;
    00181         ILubyte         BlendingMode;
    00182         ILubyte         LayerFlags;
    00183         ILubyte         TransProtFlag;
    00184         ILubyte         LinkID;
    00185         PSPRECT         MaskRect;
    00186         PSPRECT         SavedMaskRect;
    00187         ILubyte         MaskLinked;
    00188         ILubyte         MaskDisabled;
    00189         ILubyte         InvertMaskBlend;
    00190         ILushort        BlendRange;
    00191         ILubyte         SourceBlend1[4];
    00192         ILubyte         DestBlend1[4];
    00193         ILubyte         SourceBlend2[4];
    00194         ILubyte         DestBlend2[4];
    00195         ILubyte         SourceBlend3[4];
    00196         ILubyte         DestBlend3[4];
    00197         ILubyte         SourceBlend4[4];
    00198         ILubyte         DestBlend4[4];
    00199         ILubyte         SourceBlend5[4];
    00200         ILubyte         DestBlend5[4];
    00201 } IL_PACKSTRUCT LAYERINFO_CHUNK;
    00202
    00203 typedef struct LAYERBITMAP_CHUNK
    00204 {
    00205         ILushort        NumBitmaps;
    00206         ILushort        NumChannels;
    00207 } IL_PACKSTRUCT LAYERBITMAP_CHUNK;
    00208
    00209 typedef struct CHANNEL_CHUNK
    00210 {
    00211         ILuint          CompLen;
    00212         ILuint          Length;
    00213         ILushort        BitmapType;
    00214         ILushort        ChanType;
    00215 } IL_PACKSTRUCT CHANNEL_CHUNK;
    00216
    00217 typedef struct ALPHAINFO_CHUNK
    00218 {
    00219         PSPRECT         AlphaRect;
    00220         PSPRECT         AlphaSavedRect;
    00221 } IL_PACKSTRUCT ALPHAINFO_CHUNK;
    00222
    00223 typedef struct ALPHA_CHUNK
    00224 {
    00225         ILushort        BitmapCount;
    00226         ILushort        ChannelCount;
    00227 } IL_PACKSTRUCT ALPHA_CHUNK;
    00228
    00229 #ifdef _MSC_VER
    00230 #pragma pack(pop,  packed_struct)
    00231 #endif
    00232
    00233
    00234 // Function definitions
    00235 ILboolean       iLoadPspInternal(void);
    00236 ILboolean       iCheckPsp(void);
    00237 ILboolean       iIsValidPsp(void);
    00238 ILboolean       ReadGenAttributes(void);
    00239 ILboolean       ParseChunks(void);
    00240 ILboolean       ReadLayerBlock(ILuint BlockLen);
    00241 ILboolean       ReadAlphaBlock(ILuint BlockLen);
    00242 ILubyte         *GetChannel(void);
    00243 ILboolean       UncompRLE(ILubyte *CompData, ILubyte *Data, ILuint CompLen);
    00244 ILboolean       ReadPalette(ILuint BlockLen);
    00245 ILboolean       AssembleImage(void);
    00246 ILboolean       Cleanup(void);
    00247
    00248
    00249
    00250 #endif//PSP_H