00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PSP_H
00015 #define PSP_H
00016
00017 #include "il_internal.h"
00018
00019
00020
00021 enum PSPBlockID {
00022 PSP_IMAGE_BLOCK = 0,
00023 PSP_CREATOR_BLOCK,
00024 PSP_COLOR_BLOCK,
00025 PSP_LAYER_START_BLOCK,
00026 PSP_LAYER_BLOCK,
00027 PSP_CHANNEL_BLOCK,
00028 PSP_SELECTION_BLOCK,
00029 PSP_ALPHA_BANK_BLOCK,
00030 PSP_ALPHA_CHANNEL_BLOCK,
00031 PSP_COMPOSITE_IMAGE_BLOCK,
00032 PSP_EXTENDED_DATA_BLOCK,
00033 PSP_TUBE_BLOCK,
00034 PSP_ADJUSTMENT_EXTENSION_BLOCK,
00035 PSP_VECTOR_EXTENSION_BLOCK,
00036 PSP_SHAPE_BLOCK,
00037 PSP_PAINTSTYLE_BLOCK,
00038 PSP_COMPOSITE_IMAGE_BANK_BLOCK,
00039 PSP_COMPOSITE_ATTRIBUTES_BLOCK,
00040 PSP_JPEG_BLOCK,
00041 PSP_LINESTYLE_BLOCK,
00042 PSP_TABLE_BANK_BLOCK,
00043 PSP_TABLE_BLOCK,
00044 PSP_PAPER_BLOCK,
00045 PSP_PATTERN_BLOCK,
00046 };
00047
00048
00049
00050 enum PSPDIBType {
00051 PSP_DIB_IMAGE = 0,
00052 PSP_DIB_TRANS_MASK,
00053 PSP_DIB_USER_MASK,
00054 PSP_DIB_SELECTION,
00055 PSP_DIB_ALPHA_MASK,
00056 PSP_DIB_THUMBNAIL
00057 };
00058
00059
00060 enum PSPChannelType {
00061 PSP_CHANNEL_COMPOSITE = 0,
00062 PSP_CHANNEL_RED,
00063 PSP_CHANNEL_GREEN,
00064 PSP_CHANNEL_BLUE
00065 };
00066
00067
00068 enum PSP_METRIC {
00069 PSP_METRIC_UNDEFINED = 0,
00070 PSP_METRIC_INCH,
00071 PSP_METRIC_CM
00072 };
00073
00074
00075
00076 enum PSPCompression {
00077 PSP_COMP_NONE = 0,
00078 PSP_COMP_RLE,
00079 PSP_COMP_LZ77,
00080 PSP_COMP_JPEG
00081 };
00082
00083
00084
00085 enum TubePlacementMode {
00086 tpmRandom,
00087 tpmConstant
00088 };
00089
00090
00091 enum TubeSelectionMode {
00092 tsmRandom,
00093 tsmIncremental,
00094 tsmAngular,
00095 tsmPressure,
00096 tsmVelocity
00097 };
00098
00099
00100 enum PSPExtendedDataID {
00101 PSP_XDATA_TRNS_INDEX = 0
00102 };
00103
00104
00105 enum PSPCreatorFieldID {
00106 PSP_CRTR_FLD_TITLE = 0,
00107 PSP_CRTR_FLD_CRT_DATE,
00108 PSP_CRTR_FLD_MOD_DATE,
00109 PSP_CRTR_FLD_ARTIST,
00110 PSP_CRTR_FLD_CPYRGHT,
00111 PSP_CRTR_FLD_DESC,
00112 PSP_CRTR_FLD_APP_ID,
00113 PSP_CRTR_FLD_APP_VER,
00114 };
00115
00116
00117 enum PSPCreatorAppID {
00118 PSP_CREATOR_APP_UNKNOWN = 0,
00119 PSP_CREATOR_APP_PAINT_SHOP_PRO
00120 };
00121
00122
00123 enum PSPLayerType {
00124 PSP_LAYER_NORMAL = 0,
00125 PSP_LAYER_FLOATING_SELECTION
00126 };
00127
00128
00129
00130
00131
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
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