1 module psd; 2 import std.stdio; 3 4 public import psd.parser : parseDocument; 5 public import psd.layer; 6 public import psd.image_resources; 7 8 /** 9 PSD Color Modes 10 */ 11 enum ColorMode : ushort { 12 Bitmap, 13 Grayscale, 14 Indexed, 15 RGB, 16 CMYK, 17 Multichannel, 18 Duotone, 19 Lab 20 } 21 22 /** 23 A photoshop file 24 */ 25 struct PSD { 26 package(psd): 27 size_t colorModeDataSectionOffset; 28 size_t colorModeDataSectionLength; 29 30 size_t imageResourceSectionOffset; 31 size_t imageResourceSectionLength; 32 33 size_t layerMaskInfoSectionOffset; 34 size_t layerMaskInfoSectionLength; 35 36 size_t imageDataSectionOffset; 37 size_t imageDataSectionLength; 38 39 public: 40 41 /** 42 Amount of channels in file 43 */ 44 short channels; 45 46 /** 47 Width of document 48 */ 49 int width; 50 51 /** 52 Height of document 53 */ 54 int height; 55 56 /** 57 Bits per channel 58 */ 59 ushort bitsPerChannel; 60 61 /** 62 Color mode of document 63 */ 64 ColorMode colorMode; 65 66 /** 67 Data for color mode 68 */ 69 ubyte[] colorData; 70 71 /** 72 Whether alpha is merged 73 */ 74 bool mergedAlpha; 75 76 /** 77 Layers 78 */ 79 Layer[] layers; 80 81 /** 82 ImageResourcesData 83 */ 84 ImageResourcesData imageResourcesData; 85 86 /** 87 Full image data encoded as 8-bit RGBA 88 */ 89 ubyte[] fullImage; 90 }