13459199eSGerasim Troeglazov /* 23459199eSGerasim Troeglazov * Copyright 2013, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved. 33459199eSGerasim Troeglazov * Distributed under the terms of the MIT License. 43459199eSGerasim Troeglazov */ 53459199eSGerasim Troeglazov 63459199eSGerasim Troeglazov 73459199eSGerasim Troeglazov #ifndef PSD_WRITER_H 83459199eSGerasim Troeglazov #define PSD_WRITER_H 93459199eSGerasim Troeglazov 103459199eSGerasim Troeglazov #include <stdlib.h> 113459199eSGerasim Troeglazov #include <stdio.h> 123459199eSGerasim Troeglazov #include <string.h> 133459199eSGerasim Troeglazov 143459199eSGerasim Troeglazov #include <Translator.h> 153459199eSGerasim Troeglazov #include <TranslatorFormats.h> 163459199eSGerasim Troeglazov #include <TranslationDefs.h> 173459199eSGerasim Troeglazov #include <GraphicsDefs.h> 183459199eSGerasim Troeglazov #include <InterfaceDefs.h> 193459199eSGerasim Troeglazov #include <String.h> 203459199eSGerasim Troeglazov #include <DataIO.h> 213459199eSGerasim Troeglazov #include <File.h> 223459199eSGerasim Troeglazov #include <ByteOrder.h> 233459199eSGerasim Troeglazov #include <List.h> 243459199eSGerasim Troeglazov 253459199eSGerasim Troeglazov #include "PSDLoader.h" 26*5a65c297SGerasim Troeglazov #include "DataArray.h" 273459199eSGerasim Troeglazov 283459199eSGerasim Troeglazov class PSDWriter { 293459199eSGerasim Troeglazov public: 303459199eSGerasim Troeglazov PSDWriter(BPositionIO *stream); 313459199eSGerasim Troeglazov ~PSDWriter(); 323459199eSGerasim Troeglazov 337983058dSGerasim Troeglazov bool IsReady(void); 347983058dSGerasim Troeglazov void SetCompression(int16 compression); 357983058dSGerasim Troeglazov status_t Encode(BPositionIO *target); 363459199eSGerasim Troeglazov 373459199eSGerasim Troeglazov private: 383459199eSGerasim Troeglazov void _WriteInt32ToStream(BPositionIO *stream, int32); 393459199eSGerasim Troeglazov void _WriteUInt32ToStream(BPositionIO *stream, uint32); 403459199eSGerasim Troeglazov void _WriteInt16ToStream(BPositionIO *stream, int16); 413459199eSGerasim Troeglazov void _WriteUInt16ToStream(BPositionIO *stream, uint16); 423459199eSGerasim Troeglazov void _WriteInt8ToStream(BPositionIO *stream, int8); 433459199eSGerasim Troeglazov void _WriteUInt8ToStream(BPositionIO *stream, uint8); 443459199eSGerasim Troeglazov void _WriteFillBlockToStream(BPositionIO *stream, 453459199eSGerasim Troeglazov uint8 val, size_t count); 463459199eSGerasim Troeglazov void _WriteBlockToStream(BPositionIO *stream, 473459199eSGerasim Troeglazov uint8 *block, size_t count); 483459199eSGerasim Troeglazov 49*5a65c297SGerasim Troeglazov BDataArray* PackBits(uint8 *buff, int32 len); 50*5a65c297SGerasim Troeglazov 513459199eSGerasim Troeglazov BPositionIO *fStream; 527983058dSGerasim Troeglazov size_t fBitmapDataPos; 537983058dSGerasim Troeglazov 547983058dSGerasim Troeglazov color_space fColorSpace; 557983058dSGerasim Troeglazov int32 fInRowBytes; 567983058dSGerasim Troeglazov int16 fChannels; 577983058dSGerasim Troeglazov int32 fWidth; 587983058dSGerasim Troeglazov int32 fHeight; 597983058dSGerasim Troeglazov int16 fCompression; 607983058dSGerasim Troeglazov 617983058dSGerasim Troeglazov bool fReady; 623459199eSGerasim Troeglazov }; 633459199eSGerasim Troeglazov 643459199eSGerasim Troeglazov 653459199eSGerasim Troeglazov #endif /* PSD_WRITER_H */ 66