xref: /haiku/src/add-ons/translators/psd/PSDWriter.h (revision 3459199e5dd0e7fbf1c93fd1aa270ecb5d490fa1)
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_WRITER_H
8 #define PSD_WRITER_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 <String.h>
20 #include <DataIO.h>
21 #include <File.h>
22 #include <ByteOrder.h>
23 #include <List.h>
24 
25 #include "PSDLoader.h"
26 
27 class PSDWriter {
28 public:
29 					PSDWriter(BPositionIO *stream);
30 					~PSDWriter();
31 
32 	status_t		EncodeFromRGBA(BPositionIO *target, uint8 *buff,
33 						int32 layers, int32 width, int32 height);
34 
35 private:
36 	void			_WriteInt32ToStream(BPositionIO *stream, int32);
37 	void			_WriteUInt32ToStream(BPositionIO *stream, uint32);
38 	void			_WriteInt16ToStream(BPositionIO *stream, int16);
39 	void			_WriteUInt16ToStream(BPositionIO *stream, uint16);
40 	void			_WriteInt8ToStream(BPositionIO *stream, int8);
41 	void			_WriteUInt8ToStream(BPositionIO *stream, uint8);
42 	void			_WriteFillBlockToStream(BPositionIO *stream,
43 						uint8 val, size_t count);
44 	void			_WriteBlockToStream(BPositionIO *stream,
45 						uint8 *block, size_t count);
46 
47 	BPositionIO 	*fStream;
48 };
49 
50 
51 #endif	/* PSD_WRITER_H */
52