https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5cc4c9b24d38e5789632f…
commit 5cc4c9b24d38e5789632fe5ce5f50d7b2087625e
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Dec 31 11:30:12 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Dec 31 11:30:12 2019 +0900
[SDK][INCLUDE] Implement Gdiplus::CustomLineCap (#2201)
Implement Gdiplus::CustomLineCap and Gdiplus::AdjustableArrowCap. CORE-16585
---
sdk/include/psdk/gdiplusheaders.h | 42 +++++++++++-
sdk/include/psdk/gdipluslinecaps.h | 137 ++++++++++++++++++++++++++++---------
sdk/include/psdk/gdipluspath.h | 1 +
3 files changed, 147 insertions(+), 33 deletions(-)
diff --git a/sdk/include/psdk/gdiplusheaders.h b/sdk/include/psdk/gdiplusheaders.h
index 8ee22310432..915c1cf8f50 100644
--- a/sdk/include/psdk/gdiplusheaders.h
+++ b/sdk/include/psdk/gdiplusheaders.h
@@ -1332,13 +1332,19 @@ class Region : public GdiplusBase
class CustomLineCap : public GdiplusBase
{
public:
- CustomLineCap(const GraphicsPath *fillPath, const GraphicsPath *strokePath, LineCap
baseCap, REAL baseInset);
+ CustomLineCap(const GraphicsPath *fillPath, const GraphicsPath *strokePath, LineCap
baseCap, REAL baseInset = 0);
+
+ ~CustomLineCap();
+
CustomLineCap *
Clone();
+
LineCap
GetBaseCap();
+
REAL
GetBaseInset();
+
Status
GetLastStatus();
@@ -1347,6 +1353,7 @@ class CustomLineCap : public GdiplusBase
LineJoin
GetStrokeJoin();
+
REAL
GetWidthScale();
@@ -1369,7 +1376,38 @@ class CustomLineCap : public GdiplusBase
SetWidthScale(IN REAL widthScale);
protected:
- CustomLineCap();
+ GpCustomLineCap *nativeCap;
+ mutable Status lastStatus;
+
+ CustomLineCap() : nativeCap(NULL), lastStatus(Ok)
+ {
+ }
+
+ CustomLineCap(GpCustomLineCap *nativeCap, Status status)
+ {
+ lastStatus = status;
+ SetNativeCap(nativeCap);
+ }
+
+ void
+ SetNativeCap(GpCustomLineCap *cap)
+ {
+ nativeCap = cap;
+ }
+
+ Status
+ SetStatus(Status status) const
+ {
+ if (status == Ok)
+ lastStatus = status;
+ return status;
+ }
+
+ private:
+ // CustomLineCap is not copyable
+ CustomLineCap(const CustomLineCap &);
+ CustomLineCap &
+ operator=(const CustomLineCap &);
};
#endif /* _GDIPLUSHEADERS_H */
diff --git a/sdk/include/psdk/gdipluslinecaps.h b/sdk/include/psdk/gdipluslinecaps.h
index e65bca009d4..0a0d26bada7 100644
--- a/sdk/include/psdk/gdipluslinecaps.h
+++ b/sdk/include/psdk/gdipluslinecaps.h
@@ -24,79 +24,118 @@ inline CustomLineCap::CustomLineCap(
const GraphicsPath *strokePath,
LineCap baseCap,
REAL baseInset)
+ : nativeCap(NULL)
{
+ nativeCap = NULL;
+ GpPath *nativeFillPath = fillPath ? fillPath->nativePath : NULL;
+ GpPath *nativeStrokePath = strokePath ? strokePath->nativePath : NULL;
+ lastStatus = DllExports::GdipCreateCustomLineCap(nativeFillPath, nativeStrokePath,
baseCap, baseInset, &nativeCap);
}
-inline CustomLineCap *CustomLineCap::Clone(VOID)
+inline CustomLineCap::~CustomLineCap()
{
- return NULL;
+ DllExports::GdipDeleteCustomLineCap(nativeCap);
}
-inline LineCap CustomLineCap::GetBaseCap(VOID)
+inline CustomLineCap *
+CustomLineCap::Clone()
{
- return LineCapFlat;
+ GpCustomLineCap *cap = NULL;
+ SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap, &cap));
+ if (lastStatus != Ok)
+ return NULL;
+
+ CustomLineCap *newLineCap = new CustomLineCap(cap, lastStatus);
+ if (newLineCap == NULL)
+ {
+ SetStatus(DllExports::GdipDeleteCustomLineCap(cap));
+ }
+
+ return newLineCap;
+}
+
+inline LineCap
+CustomLineCap::GetBaseCap()
+{
+ LineCap baseCap;
+ SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap));
+ return baseCap;
}
-inline REAL CustomLineCap::GetBaseInset(VOID)
+inline REAL
+CustomLineCap::GetBaseInset()
{
- return 0;
+ REAL inset;
+ SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset));
+ return inset;
}
-inline Status CustomLineCap::GetLastStatus(VOID)
+inline Status
+CustomLineCap::GetLastStatus()
{
- return Ok;
+ return lastStatus;
}
inline Status
CustomLineCap::GetStrokeCaps(LineCap *startCap, LineCap *endCap)
{
- return Ok;
+#if 1
+ return SetStatus(NotImplemented);
+#else
+ return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap, startCap,
endCap));
+#endif
}
-inline LineJoin CustomLineCap::GetStrokeJoin(VOID)
+inline LineJoin
+CustomLineCap::GetStrokeJoin()
{
- return LineJoinMiter;
+ LineJoin lineJoin;
+ SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap, &lineJoin));
+ return lineJoin;
}
-inline REAL CustomLineCap::GetWidthScale(VOID)
+inline REAL
+CustomLineCap::GetWidthScale()
{
- return 0;
+ REAL widthScale;
+ SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap, &widthScale));
+ return widthScale;
}
inline Status
CustomLineCap::SetBaseCap(LineCap baseCap)
{
- return Ok;
+ return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap, baseCap));
}
inline Status
CustomLineCap::SetBaseInset(REAL inset)
{
- return Ok;
+ return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap, inset));
}
inline Status
CustomLineCap::SetStrokeCap(LineCap strokeCap)
{
- return Ok;
+ return SetStrokeCaps(strokeCap, strokeCap);
}
inline Status
CustomLineCap::SetStrokeCaps(LineCap startCap, LineCap endCap)
{
- return Ok;
+ return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap, startCap,
endCap));
}
inline Status
CustomLineCap::SetStrokeJoin(LineJoin lineJoin)
{
- return Ok;
+ return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin));
}
inline Status
CustomLineCap::SetWidthScale(IN REAL widthScale)
{
- return Ok;
+ return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap, widthScale));
}
class AdjustableArrowCap : public CustomLineCap
@@ -104,51 +143,87 @@ class AdjustableArrowCap : public CustomLineCap
public:
AdjustableArrowCap(REAL height, REAL width, BOOL isFilled)
{
+ GpAdjustableArrowCap *cap = NULL;
+ lastStatus = DllExports::GdipCreateAdjustableArrowCap(height, width, isFilled,
&cap);
+ SetNativeCap(cap);
}
- REAL GetHeight(VOID)
+ REAL
+ GetHeight()
{
- return 0;
+ REAL height;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ SetStatus(DllExports::GdipGetAdjustableArrowCapHeight(cap, &height));
+ return height;
}
- REAL GetMiddleInset(VOID)
+ REAL
+ GetMiddleInset()
{
- return 0;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ REAL middleInset;
+ SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(cap,
&middleInset));
+ return middleInset;
}
- REAL GetWidth(VOID)
+ REAL
+ GetWidth()
{
- return 0;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ REAL width;
+ SetStatus(DllExports::GdipGetAdjustableArrowCapWidth(cap, &width));
+ return width;
}
- BOOL IsFilled(VOID)
+ BOOL
+ IsFilled()
{
- return FALSE;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ BOOL isFilled;
+ SetStatus(DllExports::GdipGetAdjustableArrowCapFillState(cap, &isFilled));
+ return isFilled;
}
Status
SetFillState(BOOL isFilled)
{
- return Ok;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState(cap, isFilled));
}
Status
SetHeight(REAL height)
{
- return Ok;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight(cap, height));
}
Status
SetMiddleInset(REAL middleInset)
{
- return Ok;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(cap,
middleInset));
}
Status
SetWidth(REAL width)
{
- return Ok;
+ GpAdjustableArrowCap *cap = GetNativeAdjustableArrowCap();
+ return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth(cap, width));
+ }
+
+ protected:
+ GpAdjustableArrowCap *
+ GetNativeAdjustableArrowCap() const
+ {
+ return static_cast<GpAdjustableArrowCap *>(nativeCap);
}
+
+ private:
+ // AdjustableArrowCap is not copyable
+ AdjustableArrowCap(const AdjustableArrowCap &);
+ AdjustableArrowCap &
+ operator=(const AdjustableArrowCap &);
};
#endif /* _GDIPLUSLINECAPS_H */
diff --git a/sdk/include/psdk/gdipluspath.h b/sdk/include/psdk/gdipluspath.h
index 5d57df2bf1e..73774dfa01a 100644
--- a/sdk/include/psdk/gdipluspath.h
+++ b/sdk/include/psdk/gdipluspath.h
@@ -25,6 +25,7 @@ class Graphics;
class GraphicsPath : public GdiplusBase
{
friend class Region;
+ friend class CustomLineCap;
public:
GraphicsPath(const Point *points, const BYTE *types, INT count, FillMode fillMode) :
nativePath(NULL)