il_psp.h
Upload User: wmy0603
Upload Date: 2022-05-02
Package Size: 1808k
Code Size: 7k
Development Platform:

Visual C++

  1. //-----------------------------------------------------------------------------
  2. //
  3. // ImageLib Sources
  4. // Copyright (C) 2000-2002 by Denton Woods
  5. // Last modified: 05/02/2002 <--Y2K Compliant! =]
  6. //
  7. // Filename: src-IL/include/il_psp.h
  8. //
  9. // Description: Reads a Paint Shop Pro file.
  10. //
  11. //-----------------------------------------------------------------------------
  12. #ifndef PSP_H
  13. #define PSP_H
  14. #include "il_internal.h"
  15. // Block identifiers
  16. enum PSPBlockID {
  17. PSP_IMAGE_BLOCK = 0, // (0)  General Image Attributes Block (main)
  18. PSP_CREATOR_BLOCK, // (1)  Creator Data Block (main)
  19. PSP_COLOR_BLOCK, // (2)  Color Palette Block (main and sub)
  20. PSP_LAYER_START_BLOCK, // (3)  Layer Bank Block (main)
  21. PSP_LAYER_BLOCK, // (4)  Layer Block (sub)
  22. PSP_CHANNEL_BLOCK, // (5)  Channel Block (sub)
  23. PSP_SELECTION_BLOCK, // (6)  Selection Block (main)
  24. PSP_ALPHA_BANK_BLOCK, // (7)  Alpha Bank Block (main)
  25. PSP_ALPHA_CHANNEL_BLOCK, // (8)  Alpha Channel Block (sub)
  26. PSP_COMPOSITE_IMAGE_BLOCK, // (9)  Composite Image Block (sub)
  27. PSP_EXTENDED_DATA_BLOCK, // (10) Extended Data Block (main)
  28. PSP_TUBE_BLOCK, // (11) Picture Tube Data Block (main)
  29. PSP_ADJUSTMENT_EXTENSION_BLOCK, // (12) Adjustment Layer Block (sub)
  30. PSP_VECTOR_EXTENSION_BLOCK, // (13) Vector Layer Block (sub)
  31. PSP_SHAPE_BLOCK, // (14) Vector Shape Block (sub)
  32. PSP_PAINTSTYLE_BLOCK, // (15) Paint Style Block (sub)
  33. PSP_COMPOSITE_IMAGE_BANK_BLOCK, // (16) Composite Image Bank (main)
  34. PSP_COMPOSITE_ATTRIBUTES_BLOCK, // (17) Composite Image Attr. (sub)
  35. PSP_JPEG_BLOCK, // (18) JPEG Image Block (sub)
  36. PSP_LINESTYLE_BLOCK, // (19) Line Style Block (sub)
  37. PSP_TABLE_BANK_BLOCK, // (20) Table Bank Block (main)
  38. PSP_TABLE_BLOCK, // (21) Table Block (sub)
  39. PSP_PAPER_BLOCK, // (22) Vector Table Paper Block (sub)
  40. PSP_PATTERN_BLOCK, // (23) Vector Table Pattern Block (sub)
  41. };
  42. // Bitmap type
  43. enum PSPDIBType {
  44. PSP_DIB_IMAGE = 0, // Layer color bitmap
  45. PSP_DIB_TRANS_MASK, // Layer transparency mask bitmap
  46. PSP_DIB_USER_MASK, // Layer user mask bitmap
  47. PSP_DIB_SELECTION, // Selection mask bitmap
  48. PSP_DIB_ALPHA_MASK, // Alpha channel mask bitmap
  49. PSP_DIB_THUMBNAIL // Thumbnail bitmap
  50. };
  51. // Channel types
  52. enum PSPChannelType {
  53. PSP_CHANNEL_COMPOSITE = 0, // Channel of single channel bitmap
  54. PSP_CHANNEL_RED, // Red channel of 24 bit bitmap
  55. PSP_CHANNEL_GREEN, // Green channel of 24 bit bitmap
  56. PSP_CHANNEL_BLUE // Blue channel of 24 bit bitmap
  57. };
  58. // Possible metrics used to measure resolution
  59. enum PSP_METRIC { 
  60. PSP_METRIC_UNDEFINED = 0, // Metric unknown
  61. PSP_METRIC_INCH, // Resolution is in inches
  62. PSP_METRIC_CM // Resolution is in centimeters
  63. };
  64. // Possible types of compression.
  65. enum PSPCompression {
  66. PSP_COMP_NONE = 0, // No compression
  67. PSP_COMP_RLE, // RLE compression
  68. PSP_COMP_LZ77, // LZ77 compression
  69. PSP_COMP_JPEG // JPEG compression (only used by thumbnail and composite image)
  70. };
  71. // Picture tube placement mode.
  72. enum TubePlacementMode {
  73. tpmRandom, // Place tube images in random intervals
  74. tpmConstant // Place tube images in constant intervals
  75. };
  76. // Picture tube selection mode.
  77. enum TubeSelectionMode {
  78. tsmRandom, // Randomly select the next image in tube to display
  79. tsmIncremental, // Select each tube image in turn
  80. tsmAngular, // Select image based on cursor direction
  81. tsmPressure, // Select image based on pressure (from pressure-sensitive pad)
  82. tsmVelocity // Select image based on cursor speed
  83. };
  84. // Extended data field types.
  85. enum PSPExtendedDataID {
  86. PSP_XDATA_TRNS_INDEX = 0 // Transparency index field
  87. };
  88. // Creator field types.
  89. enum PSPCreatorFieldID {
  90. PSP_CRTR_FLD_TITLE = 0, // Image document title field
  91. PSP_CRTR_FLD_CRT_DATE, // Creation date field
  92. PSP_CRTR_FLD_MOD_DATE, // Modification date field
  93. PSP_CRTR_FLD_ARTIST, // Artist name field
  94. PSP_CRTR_FLD_CPYRGHT, // Copyright holder name field
  95. PSP_CRTR_FLD_DESC, // Image document description field
  96. PSP_CRTR_FLD_APP_ID, // Creating app id field
  97. PSP_CRTR_FLD_APP_VER, // Creating app version field
  98. };
  99. // Creator application identifiers.
  100. enum PSPCreatorAppID {
  101. PSP_CREATOR_APP_UNKNOWN = 0, // Creator application unknown
  102. PSP_CREATOR_APP_PAINT_SHOP_PRO // Creator is Paint Shop Pro
  103. };
  104. // Layer types.
  105. enum PSPLayerType {
  106. PSP_LAYER_NORMAL = 0, // Normal layer
  107. PSP_LAYER_FLOATING_SELECTION // Floating selection layer
  108. };
  109. // Truth values.
  110. /*enum PSP_BOOLEAN {
  111. FALSE = 0,
  112. TRUE
  113. };*/
  114. #ifdef _MSC_VER
  115. #pragma pack(push, packed_struct, 1)
  116. #endif
  117. typedef struct PSPRECT
  118. {
  119. ILuint x1,y1,x2,y2;
  120. } IL_PACKSTRUCT PSPRECT;
  121. typedef struct PSPHEAD
  122. {
  123. char FileSig[32];
  124. ILushort MajorVersion;
  125. ILushort MinorVersion;
  126. } IL_PACKSTRUCT PSPHEAD;
  127. typedef struct BLOCKHEAD
  128. {
  129. ILubyte HeadID[4];
  130. ILushort BlockID;
  131. ILuint BlockLen;
  132. } IL_PACKSTRUCT BLOCKHEAD;
  133. typedef struct GENATT_CHUNK
  134. {
  135. ILint Width;
  136. ILint Height;
  137. ILdouble Resolution;
  138. ILubyte ResMetric;
  139. ILushort Compression;
  140. ILushort BitDepth;
  141. ILushort PlaneCount;
  142. ILuint ColourCount;
  143. ILubyte GreyscaleFlag;
  144. ILuint SizeOfImage;
  145. ILint ActiveLayer;
  146. ILushort LayerCount;
  147. ILuint GraphicContents;
  148. } IL_PACKSTRUCT GENATT_CHUNK;
  149. typedef struct LAYERINFO_CHUNK
  150. {
  151. ILubyte LayerType;
  152. PSPRECT ImageRect;
  153. PSPRECT SavedImageRect;
  154. ILubyte Opacity;
  155. ILubyte BlendingMode;
  156. ILubyte LayerFlags;
  157. ILubyte TransProtFlag;
  158. ILubyte LinkID;
  159. PSPRECT MaskRect;
  160. PSPRECT SavedMaskRect;
  161. ILubyte MaskLinked;
  162. ILubyte MaskDisabled;
  163. ILubyte InvertMaskBlend;
  164. ILushort BlendRange;
  165. ILubyte SourceBlend1[4];
  166. ILubyte DestBlend1[4];
  167. ILubyte SourceBlend2[4];
  168. ILubyte DestBlend2[4];
  169. ILubyte SourceBlend3[4];
  170. ILubyte DestBlend3[4];
  171. ILubyte SourceBlend4[4];
  172. ILubyte DestBlend4[4];
  173. ILubyte SourceBlend5[4];
  174. ILubyte DestBlend5[4];
  175. } IL_PACKSTRUCT LAYERINFO_CHUNK;
  176. typedef struct LAYERBITMAP_CHUNK
  177. {
  178. ILushort NumBitmaps;
  179. ILushort NumChannels;
  180. } IL_PACKSTRUCT LAYERBITMAP_CHUNK;
  181. typedef struct CHANNEL_CHUNK
  182. {
  183. ILuint CompLen;
  184. ILuint Length;
  185. ILushort BitmapType;
  186. ILushort ChanType;
  187. } IL_PACKSTRUCT CHANNEL_CHUNK;
  188. typedef struct ALPHAINFO_CHUNK
  189. {
  190. PSPRECT AlphaRect;
  191. PSPRECT AlphaSavedRect;
  192. } IL_PACKSTRUCT ALPHAINFO_CHUNK;
  193. typedef struct ALPHA_CHUNK
  194. {
  195. ILushort BitmapCount;
  196. ILushort ChannelCount;
  197. } IL_PACKSTRUCT ALPHA_CHUNK;
  198. #ifdef _MSC_VER
  199. #pragma pack(pop,  packed_struct)
  200. #endif
  201. // Function definitions
  202. ILboolean iLoadPspInternal(void);
  203. ILboolean iCheckPsp(void);
  204. ILboolean iIsValidPsp(void);
  205. ILboolean ReadGenAttributes(void);
  206. ILboolean ParseChunks(void);
  207. ILboolean ReadLayerBlock(ILuint BlockLen);
  208. ILboolean ReadAlphaBlock(ILuint BlockLen);
  209. ILubyte *GetChannel(void);
  210. ILboolean UncompRLE(ILubyte *CompData, ILubyte *Data, ILuint CompLen);
  211. ILboolean ReadPalette(ILuint BlockLen);
  212. ILboolean AssembleImage(void);
  213. ILboolean Cleanup(void);
  214. #endif//PSP_H