chiark / gitweb /
Imported Upstream version 1.0.0
[e16] / src / eimage.h
1 /*
2  * Copyright (C) 2004-2008 Kim Woelders
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies of the Software, its documentation and marketing & publicity
13  * materials, and acknowledgment shall be given in the documentation, materials
14  * and software packages that this Software was used.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 #ifndef _EIMAGE_H_
24 #define _EIMAGE_H_
25
26 #include <X11/X.h>
27 #include "xtypes.h"
28
29 typedef void        EImage;
30 typedef void        EImageColorModifier;
31
32 typedef struct {
33    int                 left, right, top, bottom;
34 } EImageBorder;
35
36 #define EIMAGE_BLEND            0x0001
37 #define EIMAGE_ANTI_ALIAS       0x0002
38 #define EIMAGE_HIGH_MASK_THR    0x0004
39 #define EIMAGE_ISCALE           0x0f00  /* Intermediate scaling */
40
41 void                EImageInit(void);
42 void                EImageExit(int quit);
43 int                 EImageSetCacheSize(int size);
44
45 EImage             *EImageCreate(int w, int h);
46 EImage             *EImageCreateFromData(int w, int h, unsigned int *data);
47 EImage             *EImageCreateScaled(EImage * im, int sx, int sy,
48                                        int sw, int sh, int dw, int dh);
49
50 void                EImageFree(EImage * im);
51 void                EImageDecache(EImage * im);
52
53 void                EImageSave(EImage * im, const char *file);
54 EImage             *EImageLoad(const char *file);
55
56 void                EImageCheckAlpha(EImage * im);
57
58 void                EImageSetHasAlpha(EImage * im, int has_alpha);
59 void                EImageSetBorder(EImage * im, EImageBorder * border);
60
61 int                 EImageHasAlpha(EImage * im);
62 void                EImageGetSize(EImage * im, int *pw, int *ph);
63 void               *EImageGetData(EImage * im);
64
65 void                EImageFill(EImage * im, int x, int y, int w, int h, int r,
66                                int g, int b, int a);
67 void                EImageOrientate(EImage * im, int orientation);
68
69 void                EImageBlend(EImage * im, EImage * src, int flags,
70                                 int sx, int sy, int sw, int sh,
71                                 int dx, int dy, int dw, int dh,
72                                 int merge_alpha);
73 void                EImageBlendCM(EImage * im, EImage * src,
74                                   EImageColorModifier * icm);
75 void                EImageTile(EImage * im, EImage * tile, int flags, int tw,
76                                int th, int dx, int dy, int dw, int dh, int ox,
77                                int oy);
78
79 EImage             *EImageGrabDrawable(Drawable draw, Pixmap mask,
80                                        int x, int y, int w, int h, int grab);
81 EImage             *EImageGrabDrawableScaled(Win win,
82                                              Drawable draw, Pixmap mask,
83                                              int x, int y, int w, int h,
84                                              int iw, int ih, int grab,
85                                              int get_mask_from_shape);
86
87 void                EImageRenderOnDrawable(EImage * im, Win win, Drawable draw,
88                                            int flags,
89                                            int x, int y, int w, int h);
90
91 void                EImageRenderPixmaps(EImage * im, Win win, int flags,
92                                         Pixmap * pmap, Pixmap * mask,
93                                         int w, int h);
94 void                EImagePixmapsFree(Pixmap pmap, Pixmap mask);
95
96 void                EImageApplyToWin(EImage * im, Win win, int flags,
97                                      int w, int h);
98
99 EImageColorModifier *EImageColorModifierCreate(void);
100 void                EImageColorModifierSetTables(EImageColorModifier * icm,
101                                                  unsigned char *r,
102                                                  unsigned char *g,
103                                                  unsigned char *b,
104                                                  unsigned char *a);
105
106 void                ScaleRect(Win wsrc, Drawable src, Win wdst, Pixmap dst,
107                               int sx, int sy, int sw, int sh,
108                               int dx, int dy, int dw, int dh, int flags);
109 void                ScaleTile(Win wsrc, Drawable src, Win wdst, Pixmap dst,
110                               int dx, int dy, int dw, int dh, int flags);
111
112 void                EDrawableDumpImage(Drawable draw, const char *txt);
113
114 EImage             *ThemeImageLoad(const char *file);
115
116 #endif /* _EIMAGE_H_ */