https://git.reactos.org/?p=reactos.git;a=commitdiff;h=094960e38676ef82c8e7e6...
commit 094960e38676ef82c8e7e69e2b4be16dac2d5aa3 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Tue Dec 31 11:34:28 2019 +0900 Commit: GitHub noreply@github.com CommitDate: Tue Dec 31 11:34:28 2019 +0900
[SDK][INCLUDE] Implement Gdiplus::ImageAttributes (#2202)
CORE-16585 --- sdk/include/psdk/gdiplusimageattributes.h | 165 ++++++++++++++++++++---------- 1 file changed, 112 insertions(+), 53 deletions(-)
diff --git a/sdk/include/psdk/gdiplusimageattributes.h b/sdk/include/psdk/gdiplusimageattributes.h index 61e07d4b3d1..e68e1908558 100644 --- a/sdk/include/psdk/gdiplusimageattributes.h +++ b/sdk/include/psdk/gdiplusimageattributes.h @@ -22,166 +22,225 @@ class ImageAttributes : public GdiplusBase { public: - ImageAttributes(VOID) + ImageAttributes() : nativeImageAttr(NULL) { + lastStatus = DllExports::GdipCreateImageAttributes(&nativeImageAttr); }
- Status ClearBrushRemapTable(VOID) + ~ImageAttributes() { - return NotImplemented; + DllExports::GdipDisposeImageAttributes(nativeImageAttr); }
Status - ClearColorKey(ColorAdjustType type) + ClearBrushRemapTable() { - return NotImplemented; + return ClearRemapTable(ColorAdjustTypeBrush); }
Status - ClearColorMatrices(ColorAdjustType type) + ClearColorKey(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesColorKeys(nativeImageAttr, type, FALSE, NULL, NULL)); }
Status - ClearColorMatrix(ColorAdjustType type) + ClearColorMatrices(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, type, FALSE, NULL, NULL, ColorMatrixFlagsDefault)); }
Status - ClearGamma(ColorAdjustType type) + ClearColorMatrix(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, type, FALSE, NULL, NULL, ColorMatrixFlagsDefault)); }
Status - ClearNoOp(ColorAdjustType type) + ClearGamma(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesGamma(nativeImageAttr, type, FALSE, 0.0)); }
Status - ClearOutputChannel(ColorAdjustType type) + ClearNoOp(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesNoOp(nativeImageAttr, type, FALSE)); }
Status - ClearOutputChannelColorProfile(ColorAdjustType type) + ClearOutputChannel(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus( + DllExports::GdipSetImageAttributesOutputChannel(nativeImageAttr, type, FALSE, ColorChannelFlagsLast)); }
Status - ClearRemapTable(ColorAdjustType type) + ClearOutputChannelColorProfile(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus( + DllExports::GdipSetImageAttributesOutputChannelColorProfile(nativeImageAttr, type, FALSE, NULL)); }
Status - ClearThreshold(ColorAdjustType type) + ClearRemapTable(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesRemapTable(nativeImageAttr, type, FALSE, 0, NULL)); }
- ImageAttributes *Clone(VOID) + Status + ClearThreshold(ColorAdjustType type = ColorAdjustTypeDefault) { - return NULL; + return SetStatus(DllExports::GdipSetImageAttributesThreshold(nativeImageAttr, type, FALSE, 0.0)); + } + + ImageAttributes * + Clone() + { + GpImageAttributes *clone = NULL; + SetStatus(DllExports::GdipCloneImageAttributes(nativeImageAttr, &clone)); + if (lastStatus != Ok) + return NULL; + + ImageAttributes *newImageAttr = new ImageAttributes(clone, lastStatus); + if (newImageAttr == NULL) + SetStatus(DllExports::GdipDisposeImageAttributes(clone)); + + return newImageAttr; }
Status - GetAdjustedPalette(ColorPalette *colorPalette, ColorPalette colorAdjustType) + GetAdjustedPalette(ColorPalette *colorPalette, ColorAdjustType colorAdjustType) { - return NotImplemented; + return SetStatus( + DllExports::GdipGetImageAttributesAdjustedPalette(nativeImageAttr, colorPalette, colorAdjustType)); }
- Status GetLastStatus(VOID) + Status + GetLastStatus() { - return NotImplemented; + return lastStatus; }
Status - Reset(ColorAdjustType type) + Reset(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipResetImageAttributes(nativeImageAttr, type)); }
Status SetBrushRemapTable(UINT mapSize, ColorMap *map) { - return NotImplemented; + return SetRemapTable(mapSize, map, ColorAdjustTypeBrush); }
Status - SetColorKey(const Color &colorLow, const Color &colorHigh, ColorAdjustType type) + SetColorKey(const Color &colorLow, const Color &colorHigh, ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesColorKeys( + nativeImageAttr, type, TRUE, colorLow.GetValue(), colorHigh.GetValue())); }
Status SetColorMatrices( const ColorMatrix *colorMatrix, const ColorMatrix *grayMatrix, - ColorMatrixFlags mode, - ColorAdjustType type) + ColorMatrixFlags mode = ColorMatrixFlagsDefault, + ColorAdjustType type = ColorAdjustTypeDefault) + { + return SetStatus( + DllExports::GdipSetImageAttributesColorMatrix(nativeImageAttr, type, TRUE, colorMatrix, grayMatrix, mode)); + } + + Status + SetColorMatrix( + const ColorMatrix *colorMatrix, + ColorMatrixFlags mode = ColorMatrixFlagsDefault, + ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus( + DllExports::GdipSetImageAttributesColorMatrix(nativeImageAttr, type, TRUE, colorMatrix, NULL, mode)); }
Status - SetColorMatrix(const ColorMatrix *colorMatrix, ColorMatrixFlags mode, ColorAdjustType type) + SetGamma(REAL gamma, ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesGamma(nativeImageAttr, type, TRUE, gamma)); }
Status - SetGamma(REAL gamma, ColorAdjustType type) + SetNoOp(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesNoOp(nativeImageAttr, type, TRUE)); }
Status - SetNoOp(ColorAdjustType type) + SetOutputChannel(ColorChannelFlags channelFlags, ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesOutputChannel(nativeImageAttr, type, TRUE, channelFlags)); }
Status - SetOutputChannel(ColorChannelFlags channelFlags, ColorAdjustType type) + SetOutputChannelColorProfile(const WCHAR *colorProfileFilename, ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( + nativeImageAttr, type, TRUE, colorProfileFilename)); }
Status - SetOutputChannelColorProfile(const WCHAR *colorProfileFilename, ColorAdjustType type) + SetRemapTable(UINT mapSize, const ColorMap *map, ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesRemapTable(nativeImageAttr, type, TRUE, mapSize, map)); }
Status - SetRemapTable(UINT mapSize, const ColorMap *map, ColorAdjustType type) + SetThreshold(REAL threshold, ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesThreshold(nativeImageAttr, type, TRUE, threshold)); }
Status - SetThreshold(REAL threshold, ColorAdjustType type) + SetToIdentity(ColorAdjustType type = ColorAdjustTypeDefault) { - return NotImplemented; + return SetStatus(DllExports::GdipSetImageAttributesToIdentity(nativeImageAttr, type)); }
Status - SetToIdentity(ColorAdjustType type) + SetWrapMode(WrapMode wrap, const Color &color = Color(), BOOL clamp = FALSE) + { + ARGB argb = color.GetValue(); + return SetStatus(DllExports::GdipSetImageAttributesWrapMode(nativeImageAttr, wrap, argb, clamp)); + } + + protected: + GpImageAttributes *nativeImageAttr; + mutable Status lastStatus; + + ImageAttributes(GpImageAttributes *imageAttr, Status status) : nativeImageAttr(imageAttr), lastStatus(status) { - return NotImplemented; + } + + VOID + SetNativeImageAttr(GpImageAttributes *imageAttr) + { + nativeImageAttr = imageAttr; }
Status - SetWrapMode(WrapMode wrap, const Color &color, BOOL clamp) + SetStatus(Status status) const { - return NotImplemented; + if (status != Ok) + lastStatus = status; + return status; } + + private: + // ImageAttributes is not copyable + ImageAttributes(const ImageAttributes &); + ImageAttributes & + operator=(const ImageAttributes &); };
#endif /* _GDIPLUSIMAGEATTRIBUTES_H */