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_IMAGEBUF_H
21 #define MLIB_IMAGEBUF_H
22 
23 typedef struct _mLoadImageSource mLoadImageSource;
24 
25 typedef struct _mImageBuf
26 {
27 	uint8_t *buf;
28 	int w,h,bpp,pitch;
29 }mImageBuf;
30 
31 #define MIMAGEBUF_GETBUFPT(p,x,y)  ((p)->buf + (p)->pitch * (y) + (x) * (p)->bpp)
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 void mImageBufFree(mImageBuf *p);
39 mImageBuf *mImageBufCreate(int w,int h,int bpp);
40 
41 mImageBuf *mImageBufLoadImage(mLoadImageSource *src,mDefEmptyFunc loadfunc,int bpp,char **errmes);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif
48