ReactOS 0.4.15-dev-7711-g5627da4
gdiplusimageattributes.h
Go to the documentation of this file.
1/*
2 * GdiPlusImageAttributes.h
3 *
4 * Windows GDI+
5 *
6 * This file is part of the w32api package.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAIMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 */
18
19#ifndef _GDIPLUSIMAGEATTRIBUTES_H
20#define _GDIPLUSIMAGEATTRIBUTES_H
21
23{
24 public:
25 friend class TextureBrush;
26
28 {
29 lastStatus = DllExports::GdipCreateImageAttributes(&nativeImageAttr);
30 }
31
33 {
34 DllExports::GdipDisposeImageAttributes(nativeImageAttr);
35 }
36
37 Status
39 {
41 }
42
43 Status
45 {
46 return SetStatus(DllExports::GdipSetImageAttributesColorKeys(nativeImageAttr, type, FALSE, NULL, NULL));
47 }
48
49 Status
51 {
52 return SetStatus(DllExports::GdipSetImageAttributesColorMatrix(
54 }
55
56 Status
58 {
59 return SetStatus(DllExports::GdipSetImageAttributesColorMatrix(
61 }
62
63 Status
65 {
66 return SetStatus(DllExports::GdipSetImageAttributesGamma(nativeImageAttr, type, FALSE, 0.0));
67 }
68
69 Status
71 {
72 return SetStatus(DllExports::GdipSetImageAttributesNoOp(nativeImageAttr, type, FALSE));
73 }
74
75 Status
77 {
78 return SetStatus(
79 DllExports::GdipSetImageAttributesOutputChannel(nativeImageAttr, type, FALSE, ColorChannelFlagsLast));
80 }
81
82 Status
84 {
85 return SetStatus(
86 DllExports::GdipSetImageAttributesOutputChannelColorProfile(nativeImageAttr, type, FALSE, NULL));
87 }
88
89 Status
91 {
92 return SetStatus(DllExports::GdipSetImageAttributesRemapTable(nativeImageAttr, type, FALSE, 0, NULL));
93 }
94
95 Status
97 {
98 return SetStatus(DllExports::GdipSetImageAttributesThreshold(nativeImageAttr, type, FALSE, 0.0));
99 }
100
103 {
104 GpImageAttributes *clone = NULL;
105 SetStatus(DllExports::GdipCloneImageAttributes(nativeImageAttr, &clone));
106 if (lastStatus != Ok)
107 return NULL;
108
109 ImageAttributes *newImageAttr = new ImageAttributes(clone, lastStatus);
110 if (newImageAttr == NULL)
111 SetStatus(DllExports::GdipDisposeImageAttributes(clone));
112
113 return newImageAttr;
114 }
115
116 Status
117 GetAdjustedPalette(ColorPalette *colorPalette, ColorAdjustType colorAdjustType)
118 {
119 return SetStatus(
120 DllExports::GdipGetImageAttributesAdjustedPalette(nativeImageAttr, colorPalette, colorAdjustType));
121 }
122
123 Status
125 {
126 return lastStatus;
127 }
128
129 Status
131 {
132 return SetStatus(DllExports::GdipResetImageAttributes(nativeImageAttr, type));
133 }
134
135 Status
137 {
138 return SetRemapTable(mapSize, map, ColorAdjustTypeBrush);
139 }
140
141 Status
142 SetColorKey(const Color &colorLow, const Color &colorHigh, ColorAdjustType type = ColorAdjustTypeDefault)
143 {
144 return SetStatus(DllExports::GdipSetImageAttributesColorKeys(
145 nativeImageAttr, type, TRUE, colorLow.GetValue(), colorHigh.GetValue()));
146 }
147
148 Status
150 const ColorMatrix *colorMatrix,
151 const ColorMatrix *grayMatrix,
154 {
155 return SetStatus(
156 DllExports::GdipSetImageAttributesColorMatrix(nativeImageAttr, type, TRUE, colorMatrix, grayMatrix, mode));
157 }
158
159 Status
161 const ColorMatrix *colorMatrix,
164 {
165 return SetStatus(
166 DllExports::GdipSetImageAttributesColorMatrix(nativeImageAttr, type, TRUE, colorMatrix, NULL, mode));
167 }
168
169 Status
171 {
172 return SetStatus(DllExports::GdipSetImageAttributesGamma(nativeImageAttr, type, TRUE, gamma));
173 }
174
175 Status
177 {
178 return SetStatus(DllExports::GdipSetImageAttributesNoOp(nativeImageAttr, type, TRUE));
179 }
180
181 Status
183 {
184 return SetStatus(DllExports::GdipSetImageAttributesOutputChannel(nativeImageAttr, type, TRUE, channelFlags));
185 }
186
187 Status
189 {
190 return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile(
191 nativeImageAttr, type, TRUE, colorProfileFilename));
192 }
193
194 Status
196 {
197 return SetStatus(DllExports::GdipSetImageAttributesRemapTable(nativeImageAttr, type, TRUE, mapSize, map));
198 }
199
200 Status
202 {
203 return SetStatus(DllExports::GdipSetImageAttributesThreshold(nativeImageAttr, type, TRUE, threshold));
204 }
205
206 Status
208 {
209 return SetStatus(DllExports::GdipSetImageAttributesToIdentity(nativeImageAttr, type));
210 }
211
212 Status
214 {
215 ARGB argb = color.GetValue();
216 return SetStatus(DllExports::GdipSetImageAttributesWrapMode(nativeImageAttr, wrap, argb, clamp));
217 }
218
219 protected:
222
224 {
225 }
226
227 VOID
229 {
230 nativeImageAttr = imageAttr;
231 }
232
233 Status
235 {
236 if (status != Ok)
238 return status;
239 }
240
241 private:
242 // ImageAttributes is not copyable
246
247 // get native
248 friend inline GpImageAttributes *&
250 {
251 return const_cast<ImageAttributes *>(ia)->nativeImageAttr;
252 }
253};
254
255#endif /* _GDIPLUSIMAGEATTRIBUTES_H */
Status ClearOutputChannel(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetColorMatrices(const ColorMatrix *colorMatrix, const ColorMatrix *grayMatrix, ColorMatrixFlags mode=ColorMatrixFlagsDefault, ColorAdjustType type=ColorAdjustTypeDefault)
Status SetToIdentity(ColorAdjustType type=ColorAdjustTypeDefault)
Status Reset(ColorAdjustType type=ColorAdjustTypeDefault)
Status ClearRemapTable(ColorAdjustType type=ColorAdjustTypeDefault)
VOID SetNativeImageAttr(GpImageAttributes *imageAttr)
ImageAttributes(GpImageAttributes *imageAttr, Status status)
Status SetColorKey(const Color &colorLow, const Color &colorHigh, ColorAdjustType type=ColorAdjustTypeDefault)
Status ClearGamma(ColorAdjustType type=ColorAdjustTypeDefault)
Status ClearNoOp(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetRemapTable(UINT mapSize, const ColorMap *map, ColorAdjustType type=ColorAdjustTypeDefault)
Status SetOutputChannel(ColorChannelFlags channelFlags, ColorAdjustType type=ColorAdjustTypeDefault)
Status ClearOutputChannelColorProfile(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetBrushRemapTable(UINT mapSize, ColorMap *map)
Status ClearColorMatrices(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetColorMatrix(const ColorMatrix *colorMatrix, ColorMatrixFlags mode=ColorMatrixFlagsDefault, ColorAdjustType type=ColorAdjustTypeDefault)
Status ClearColorKey(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetThreshold(REAL threshold, ColorAdjustType type=ColorAdjustTypeDefault)
Status SetOutputChannelColorProfile(const WCHAR *colorProfileFilename, ColorAdjustType type=ColorAdjustTypeDefault)
Status ClearColorMatrix(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetGamma(REAL gamma, ColorAdjustType type=ColorAdjustTypeDefault)
friend GpImageAttributes *& getNat(const ImageAttributes *ia)
ImageAttributes * Clone()
GpImageAttributes * nativeImageAttr
ImageAttributes(const ImageAttributes &)
Status SetWrapMode(WrapMode wrap, const Color &color=Color(), BOOL clamp=FALSE)
Status SetNoOp(ColorAdjustType type=ColorAdjustTypeDefault)
ImageAttributes & operator=(const ImageAttributes &)
Status ClearThreshold(ColorAdjustType type=ColorAdjustTypeDefault)
Status SetStatus(Status status) const
Status GetAdjustedPalette(ColorPalette *colorPalette, ColorAdjustType colorAdjustType)
Definition: _map.h:48
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
float REAL
Definition: types.h:41
#define wrap(journal, var)
Definition: recovery.c:207
unsigned int BOOL
Definition: ntddk_ex.h:94
ColorChannelFlags
Definition: gdipluscolor.h:25
@ ColorChannelFlagsLast
Definition: gdipluscolor.h:30
ColorAdjustType
@ ColorAdjustTypeBrush
@ ColorAdjustTypeDefault
ColorMatrixFlags
@ ColorMatrixFlagsDefault
WrapMode
Definition: gdiplusenums.h:206
DWORD ARGB
Status
Definition: gdiplustypes.h:25
@ Ok
Definition: gdiplustypes.h:26
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum clamp
Definition: glext.h:6216
GLuint color
Definition: glext.h:6243
GLenum mode
Definition: glext.h:6217
unsigned int UINT
Definition: ndis.h:50
Definition: ps.c:97
__wchar_t WCHAR
Definition: xmlstorage.h:180