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