1 /*$
2  Copyright (C) 2013-2020 Azel.
3 
4  This file is part of AzPainter.
5 
6  AzPainter is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  AzPainter is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 $*/
19 
20 #ifndef MLIB_PSD_SAVE_H
21 #define MLIB_PSD_SAVE_H
22 
23 #include "mPSDDef.h"
24 
25 typedef struct _mPSDSave mPSDSave;
26 
27 typedef struct
28 {
29 	int width,
30 		height,
31 		img_channels,
32 		bits,		//1,8,16
33 		colmode;
34 }mPSDSaveInfo;
35 
36 typedef struct
37 {
38 	int top,left,bottom,right,
39 		channels;
40 	uint32_t blendmode;
41 	const char *name;
42 	uint8_t opacity,
43 		hide;
44 }mPSDSaveLayerInfo;
45 
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 mPSDSave *mPSDSave_openFile(const char *filename,mPSDSaveInfo *info,mBool packbits);
52 void mPSDSave_close(mPSDSave *p);
53 
54 uint8_t *mPSDSave_getLineImageBuf(mPSDSave *p);
55 
56 void mPSDSave_beginResource(mPSDSave *p);
57 void mPSDSave_writeResource_resolution_dpi(mPSDSave *p,int dpi_horz,int dpi_vert);
58 void mPSDSave_writeResource_currentLayer(mPSDSave *p,int no);
59 void mPSDSave_endResource(mPSDSave *p);
60 
61 void mPSDSave_writeLayerNone(mPSDSave *p);
62 
63 mBool mPSDSave_beginLayer(mPSDSave *p,int num);
64 void mPSDSave_writeLayerInfo(mPSDSave *p,mPSDSaveLayerInfo *info);
65 mBool mPSDSave_endLayerInfo(mPSDSave *p);
66 mBool mPSDSave_beginLayerImage(mPSDSave *p,mBox *box);
67 void mPSDSave_beginLayerImageChannel(mPSDSave *p,int channel_id);
68 void mPSDSave_writeLayerImageChannelLine(mPSDSave *p);
69 void mPSDSave_endLayerImageChannel(mPSDSave *p);
70 void mPSDSave_endLayerImage(mPSDSave *p);
71 void mPSDSave_endLayer(mPSDSave *p);
72 
73 int mPSDSave_getLayerImageMaxWidth(mPSDSave *p);
74 
75 mBool mPSDSave_beginImage(mPSDSave *p);
76 void mPSDSave_beginImageChannel(mPSDSave *p);
77 void mPSDSave_writeImageChannelLine(mPSDSave *p);
78 void mPSDSave_endImageChannel(mPSDSave *p);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
85