1 /* 2 * Copyright 2013, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #ifndef PSD_LOADER_H 8 #define PSD_LOADER_H 9 10 #include <stdlib.h> 11 #include <stdio.h> 12 #include <string.h> 13 14 #include <Translator.h> 15 #include <TranslatorFormats.h> 16 #include <TranslationDefs.h> 17 #include <GraphicsDefs.h> 18 #include <InterfaceDefs.h> 19 #include <DataIO.h> 20 #include <File.h> 21 #include <ByteOrder.h> 22 #include <List.h> 23 24 #define PSD_COMPRESSED_RAW 0 25 #define PSD_COMPRESSED_RLE 1 26 27 class PSDLoader { 28 public: 29 PSDLoader(BPositionIO *stream); 30 ~PSDLoader(); 31 32 int Decode(BPositionIO *target); 33 bool IsLoaded(void); 34 bool IsSupported(void); 35 36 private: 37 int32 GetInt32FromStream(BPositionIO *in); 38 int16 GetInt16FromStream(BPositionIO *in); 39 uint8 GetUInt8FromStream(BPositionIO *in); 40 int8 GetInt8FromStream(BPositionIO *in); 41 void SkipStreamBlock(BPositionIO *in, size_t count); 42 43 BPositionIO *fStream; 44 uint8 *fStreamBuffer; 45 size_t fStreamSize; 46 size_t fStreamPos; 47 48 int32 fSignature; 49 int16 fVersion; 50 int16 fChannels; 51 int32 fHeight; 52 int32 fWidth; 53 int16 fDepth; 54 int16 fColorFormat; 55 int16 fCompression; 56 57 bool fLoaded; 58 }; 59 60 61 #endif /* PSD_LOADER_H */ 62