Code: Select all
PathMoveTo(200, 200)
PathAddLine(400, 200)
PathAddLine(200, 400)
DrawPath(RGB(255, 0, 0))
Code: Select all
PathMoveTo(200, 200)
PathAddLine(400, 200)
PathAddLine(200, 400)
DrawPath(RGB(255, 0, 0))
Code: Select all
Procedure draw(Window, EventType, *eventData.PG_EventDraw)
DrawClear(RGB(240, 240, 240), 1)
PathMoveTo(200, 200)
PathAddLine(400, 200)
PathAddLine(200, 400)
DrawPath(RGB(255, 0, 0))
PathMoveTo(100, 400)
PathAddLine(200, 400)
PathAddLine(250, 550)
PathAddLine(100, 600)
DrawPath(RGB(0, 255, 0))
EndProcedure
Code: Select all
Procedure draw(Window, EventType, *eventData.PG_EventDraw)
DrawClear(RGB(240, 240, 240), 1)
PathMoveTo(200, 200)
PathAddLine(400, 200)
PathAddLine(200, 400)
;DrawPath(RGB(255, 0, 0))
PathMoveTo(100, 400)
PathAddLine(200, 400)
PathAddLine(250, 550)
PathAddLine(100, 600)
DrawPath(RGB(0, 255, 0))
EndProcedure
Thanks mate!
Code: Select all
PathMoveTo(x.d, y.d, Flags = #Null)
PathAddLine(x.d, y.d, Flags = #Null)
PathAddCurve(x1.d, y1.d, x2.d, y2.d, x3.d, y3.d, Flags = #Null)
PathAddArc(x.d, y.d, rx.d, ry.d, rotationAngle.d = 0, isSweepClockwise.b = #True, isLargeArc.b = #False)
PathClose()
DrawPath(Color.l, Opacity.f = 1, Flags = #Null)
DrawPathFill(Brush, Flags = #Null)
DrawPathStroke(Color.l, Opacity.f = 1, Flags = #Null)
DrawPathStrokeFill(Brush, Flags = #Null)
Code: Select all
Procedure draw(Window, EventType, *eventData.PG_EventDraw)
Static sunBrush
If Not sunBrush
sunBrush = CreateBrushGradientRadial(355, 255, -20, -30, 100, 100, RGB(253, 182, 48), 1, RGB(255, 124, 76), 1)
EndIf
DrawClear(RGB(240, 240, 240), 1)
DrawSetStroke(1, #PG_Stroke_Center)
; sun
PathMoveTo(270, 255)
PathAddArc(440, 255, 85, 85, 0, #True, #False)
DrawPathFill(sunBrush, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
; sun beam 1
PathMoveTo(299, 182)
PathAddCurve(299, 182, 294, 176, 285, 178)
PathAddCurve(276, 179, 272, 173, 272, 173)
; sun beam 2
PathMoveTo(354, 156)
PathAddCurve(354, 156, 358, 149, 354, 142)
PathAddCurve(349, 134, 354, 127, 354, 127)
; sun beam 3
PathMoveTo(322, 164)
PathAddCurve(322, 164, 322, 156, 314, 152)
PathAddCurve(306, 149, 305, 141, 305, 141)
; sun beam 4
PathMoveTo(385, 164)
PathAddCurve(385, 164, 392, 161, 394, 152)
PathAddCurve(395, 144, 402, 141, 402, 142)
; sun beam 5
PathMoveTo(408, 182)
PathAddCurve(408, 182, 416, 184, 422, 178)
PathAddCurve(428, 171, 435, 173, 435, 173)
DrawPathStroke(RGB(0, 0, 0), 1)
; left mountain
PathMoveTo(346, 255)
PathAddLine(267, 177)
PathAddLine(236, 192)
PathAddLine(212, 160)
PathAddLine(156, 255)
PathClose()
DrawPath(RGB(107, 142, 35), 1, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
; river
PathMoveTo(183, 392)
PathAddCurve(238, 284, 472, 345, 356, 303)
PathAddCurve(237, 261, 333, 256, 333, 256)
PathAddCurve(335, 257, 241, 261, 411, 306)
PathAddCurve(574, 350, 288, 324, 296, 392)
DrawPath(RGB(135, 206, 250), 1, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
; right mountain
PathMoveTo(575, 263)
PathAddLine(481, 146)
PathAddLine(449, 181)
PathAddLine(433, 159)
PathAddLine(401, 214)
PathAddLine(381, 199)
PathAddLine(323, 263)
PathClose()
DrawPath(RGB(154, 205, 50), 1, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
EndProcedure
Code: Select all
hr = m_pD2DFactory->CreatePathGeometry(&m_pLeftMountainGeometry);
ID2D1GeometrySink *pSink = NULL;
hr = m_pLeftMountainGeometry->Open(&pSink);
pSink->SetFillMode(D2D1_FILL_MODE_WINDING);
pSink->BeginFigure(
D2D1::Point2F(346,255),
D2D1_FIGURE_BEGIN_FILLED
);
D2D1_POINT_2F points[5] = {
D2D1::Point2F(267, 177),
D2D1::Point2F(236, 192),
D2D1::Point2F(212, 160),
D2D1::Point2F(156, 255),
D2D1::Point2F(346, 255),
};
pSink->AddLines(points, ARRAYSIZE(points));
pSink->EndFigure(D2D1_FIGURE_END_CLOSED);
hr = m_pD2DFactory->CreatePathGeometry(&m_pRightMountainGeometry);
if(SUCCEEDED(hr))
{
ID2D1GeometrySink *pSink = NULL;
hr = m_pRightMountainGeometry->Open(&pSink);
if (SUCCEEDED(hr))
{
pSink->SetFillMode(D2D1_FILL_MODE_WINDING);
pSink->BeginFigure(
D2D1::Point2F(575,263),
D2D1_FIGURE_BEGIN_FILLED
);
D2D1_POINT_2F points[] = {
D2D1::Point2F(481, 146),
D2D1::Point2F(449, 181),
D2D1::Point2F(433, 159),
D2D1::Point2F(401, 214),
D2D1::Point2F(381, 199),
D2D1::Point2F(323, 263),
D2D1::Point2F(575, 263)
};
pSink->AddLines(points, ARRAYSIZE(points));
pSink->EndFigure(D2D1_FIGURE_END_CLOSED);
}
hr = pSink->Close();
SafeRelease(&pSink);
}
hr = m_pD2DFactory->CreatePathGeometry(&m_pSunGeometry);
if(SUCCEEDED(hr))
{
ID2D1GeometrySink *pSink = NULL;
hr = m_pSunGeometry->Open(&pSink);
if (SUCCEEDED(hr))
{
pSink->SetFillMode(D2D1_FILL_MODE_WINDING);
pSink->BeginFigure(
D2D1::Point2F(270, 255),
D2D1_FIGURE_BEGIN_FILLED
);
pSink->AddArc(
D2D1::ArcSegment(
D2D1::Point2F(440, 255), // end point
D2D1::SizeF(85, 85),
0.0f, // rotation angle
D2D1_SWEEP_DIRECTION_CLOCKWISE,
D2D1_ARC_SIZE_SMALL
));
pSink->EndFigure(D2D1_FIGURE_END_CLOSED);
pSink->BeginFigure(
D2D1::Point2F(299, 182),
D2D1_FIGURE_BEGIN_HOLLOW
);
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(299, 182),
D2D1::Point2F(294, 176),
D2D1::Point2F(285, 178)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(276, 179),
D2D1::Point2F(272, 173),
D2D1::Point2F(272, 173)
));
pSink->EndFigure(D2D1_FIGURE_END_OPEN);
pSink->BeginFigure(
D2D1::Point2F(354, 156),
D2D1_FIGURE_BEGIN_HOLLOW
);
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(354, 156),
D2D1::Point2F(358, 149),
D2D1::Point2F(354, 142)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(349, 134),
D2D1::Point2F(354, 127),
D2D1::Point2F(354, 127)
));
pSink->EndFigure(D2D1_FIGURE_END_OPEN);
pSink->BeginFigure(
D2D1::Point2F(322,164),
D2D1_FIGURE_BEGIN_HOLLOW
);
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(322, 164),
D2D1::Point2F(322, 156),
D2D1::Point2F(314, 152)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(306, 149),
D2D1::Point2F(305, 141),
D2D1::Point2F(305, 141)
));
pSink->EndFigure(D2D1_FIGURE_END_OPEN);
pSink->BeginFigure(
D2D1::Point2F(385, 164),
D2D1_FIGURE_BEGIN_HOLLOW
);
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(385,164),
D2D1::Point2F(392,161),
D2D1::Point2F(394,152)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(395,144),
D2D1::Point2F(402,141),
D2D1::Point2F(402,142)
));
pSink->EndFigure(D2D1_FIGURE_END_OPEN);
pSink->BeginFigure(
D2D1::Point2F(408,182),
D2D1_FIGURE_BEGIN_HOLLOW
);
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(408,182),
D2D1::Point2F(416,184),
D2D1::Point2F(422,178)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(428,171),
D2D1::Point2F(435,173),
D2D1::Point2F(435,173)
));
pSink->EndFigure(D2D1_FIGURE_END_OPEN);
}
hr = pSink->Close();
SafeRelease(&pSink);
}
hr = m_pD2DFactory->CreatePathGeometry(&m_pRiverGeometry);
if(SUCCEEDED(hr))
{
ID2D1GeometrySink *pSink = NULL;
hr = m_pRiverGeometry->Open(&pSink);
if (SUCCEEDED(hr))
{
pSink->SetFillMode(D2D1_FILL_MODE_WINDING);
pSink->BeginFigure(
D2D1::Point2F(183, 392),
D2D1_FIGURE_BEGIN_FILLED
);
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(238, 284),
D2D1::Point2F(472, 345),
D2D1::Point2F(356, 303)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(237, 261),
D2D1::Point2F(333, 256),
D2D1::Point2F(333, 256)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(335, 257),
D2D1::Point2F(241, 261),
D2D1::Point2F(411, 306)
));
pSink->AddBezier(
D2D1::BezierSegment(
D2D1::Point2F(574, 350),
D2D1::Point2F(288, 324),
D2D1::Point2F(296, 392)
));
pSink->EndFigure(D2D1_FIGURE_END_OPEN);
}
m_pRenderTarget->BeginDraw();
m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());
m_pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White));
m_pRenderTarget->FillGeometry(m_pSunGeometry, m_pRadialGradientBrush);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::Black, 1.f));
m_pRenderTarget->DrawGeometry(m_pSunGeometry, m_pSceneBrush, 1.f);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::OliveDrab, 1.f));
m_pRenderTarget->FillGeometry(m_pLeftMountainGeometry, m_pSceneBrush);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::Black, 1.f));
m_pRenderTarget->DrawGeometry(m_pLeftMountainGeometry, m_pSceneBrush, 1.f);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::LightSkyBlue, 1.f));
m_pRenderTarget->FillGeometry(m_pRiverGeometry, m_pSceneBrush);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::Black, 1.f));
m_pRenderTarget->DrawGeometry(m_pRiverGeometry, m_pSceneBrush, 1.f);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::YellowGreen, 1.f));
m_pRenderTarget->FillGeometry(m_pRightMountainGeometry, m_pSceneBrush);
m_pSceneBrush->SetColor(D2D1::ColorF(D2D1::ColorF::Black, 1.f));
m_pRenderTarget->DrawGeometry(m_pRightMountainGeometry, m_pSceneBrush, 1.f);
hr = m_pRenderTarget->EndDraw();
Code: Select all
Procedure draw(Window, EventType, *eventData.PG_EventDraw)
Static sunBrush
If Not sunBrush
sunBrush = CreateBrushGradientRadial(355, 255, -20, -30, 100, 100, RGB(253, 182, 48), 1, RGB(255, 124, 76), 1)
EndIf
DrawClear(RGB(240, 240, 240), 1)
DrawSetStroke(1, #PG_Stroke_Center)
; sun
PathMoveTo(270, 255)
PathAddArc(440, 255, 85, 85, 0, #True, #False)
DrawPathFill(sunBrush, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
; sun beam 1
PathMoveTo(299, 182)
PathAddCurve(299, 182, 294, 176, 285, 178)
PathAddCurve(276, 179, 272, 173, 272, 173)
; sun beam 2
PathMoveTo(354, 156)
PathAddCurve(354, 156, 358, 149, 354, 142)
PathAddCurve(349, 134, 354, 127, 354, 127)
; sun beam 3
PathMoveTo(322, 164)
PathAddCurve(322, 164, 322, 156, 314, 152)
PathAddCurve(306, 149, 305, 141, 305, 141)
; sun beam 4
PathMoveTo(385, 164)
PathAddCurve(385, 164, 392, 161, 394, 152)
PathAddCurve(395, 144, 402, 141, 402, 142)
; sun beam 5
PathMoveTo(408, 182)
PathAddCurve(408, 182, 416, 184, 422, 178)
PathAddCurve(428, 171, 435, 173, 435, 173)
DrawPathStroke(RGB(0, 0, 0), 1)
; left mountain
PathMoveTo(346, 255)
PathAddLine(267, 177)
PathAddLine(236, 192)
PathAddLine(212, 160)
PathAddLine(156, 255)
PathClose()
DrawPath(RGB(107, 142, 35), 1, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10)
DrawPathStroke(RGB(0, 0, 0), 0.1)
; river
PathMoveTo(183, 392)
PathAddCurve(238, 284, 472, 345, 356, 303)
PathAddCurve(237, 261, 333, 256, 333, 256)
PathAddCurve(335, 257, 241, 261, 411, 306)
PathAddCurve(574, 350, 288, 324, 296, 392)
DrawPath(RGB(135, 206, 250), 1, #PG_Path_Preserve)
DrawSetStroke(1, #PG_Stroke_Center)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10)
DrawPathStroke(RGB(0, 0, 0), 0.1)
; right mountain
PathMoveTo(575, 263)
PathAddLine(481, 146)
PathAddLine(449, 181)
PathAddLine(433, 159)
PathAddLine(401, 214)
PathAddLine(381, 199)
PathAddLine(323, 263)
PathClose()
DrawPath(RGB(154, 205, 50), 1, #PG_Path_Preserve)
DrawSetStroke(1, #PG_Stroke_Center)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10)
DrawPathStroke(RGB(0, 0, 0), 0.1)
EndProcedure
Thanks mate!
Code: Select all
Procedure draw(Window, EventType, *eventData.PG_EventDraw)
Static sunBrush
If Not sunBrush
sunBrush = CreateBrushGradientRadial(355, 255, -20, -30, 100, 100, RGB(253, 182, 48), 1, RGB(255, 124, 76), 1)
EndIf
DrawClear(RGB(240, 240, 240), 1)
DrawSetStroke(1, #PG_Stroke_Center)
; sun
PathMoveTo(270, 255)
PathAddArc(440, 255, 85, 85, 0, #True, #False)
DrawPathFill(sunBrush, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
; sun beam 1
PathMoveTo(299, 182)
PathAddCurve(299, 182, 294, 176, 285, 178)
PathAddCurve(276, 179, 272, 173, 272, 173)
; sun beam 2
PathMoveTo(354, 156)
PathAddCurve(354, 156, 358, 149, 354, 142)
PathAddCurve(349, 134, 354, 127, 354, 127)
; sun beam 3
PathMoveTo(322, 164)
PathAddCurve(322, 164, 322, 156, 314, 152)
PathAddCurve(306, 149, 305, 141, 305, 141)
; sun beam 4
PathMoveTo(385, 164)
PathAddCurve(385, 164, 392, 161, 394, 152)
PathAddCurve(395, 144, 402, 141, 402, 142)
; sun beam 5
PathMoveTo(408, 182)
PathAddCurve(408, 182, 416, 184, 422, 178)
PathAddCurve(428, 171, 435, 173, 435, 173)
DrawPathStroke(RGB(0, 0, 0), 1)
; left mountain
PathMoveTo(346, 255)
PathAddLine(267, 177)
PathAddLine(236, 192)
PathAddLine(212, 160)
PathAddLine(156, 255)
PathClose()
DrawPath(RGB(107, 142, 35), 1, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10, #PG_Stroke_Outside)
DrawPathStroke(RGB(0, 0, 0), 0.1)
; river
PathMoveTo(183, 392)
PathAddCurve(238, 284, 472, 345, 356, 303)
PathAddCurve(237, 261, 333, 256, 333, 256)
PathAddCurve(335, 257, 241, 261, 411, 306)
PathAddCurve(574, 350, 288, 324, 296, 392)
DrawPath(RGB(135, 206, 250), 1, #PG_Path_Preserve)
DrawSetStroke(1, #PG_Stroke_Center)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10, #PG_Stroke_Outside)
DrawPathStroke(RGB(0, 0, 0), 0.1)
; right mountain
PathMoveTo(575, 263)
PathAddLine(481, 146)
PathAddLine(449, 181)
PathAddLine(433, 159)
PathAddLine(401, 214)
PathAddLine(381, 199)
PathAddLine(323, 263)
PathClose()
DrawPath(RGB(154, 205, 50), 1, #PG_Path_Preserve)
DrawSetStroke(1, #PG_Stroke_Center)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10, #PG_Stroke_Outside)
DrawPathStroke(RGB(0, 0, 0), 0.1)
EndProcedure
Code: Select all
Procedure draw(Window, EventType, *eventData.PG_EventDraw)
Static sunBrush
If Not sunBrush
sunBrush = CreateBrushGradientRadial(355, 255, -20, -30, 100, 100, RGB(253, 182, 48), 1, RGB(255, 124, 76), 1)
EndIf
DrawClear(RGB(240, 240, 240), 1)
DrawSetStroke(1, #PG_Stroke_Center)
; sun
PathMoveTo(270, 255)
PathAddArc(440, 255, 85, 85, 0, #True, #False)
DrawPathFill(sunBrush, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1)
; sun beam 1
PathMoveTo(299, 182)
PathAddCurve(299, 182, 294, 176, 285, 178)
PathAddCurve(276, 179, 272, 173, 272, 173)
; sun beam 2
PathMoveTo(354, 156)
PathAddCurve(354, 156, 358, 149, 354, 142)
PathAddCurve(349, 134, 354, 127, 354, 127)
; sun beam 3
PathMoveTo(322, 164)
PathAddCurve(322, 164, 322, 156, 314, 152)
PathAddCurve(306, 149, 305, 141, 305, 141)
; sun beam 4
PathMoveTo(385, 164)
PathAddCurve(385, 164, 392, 161, 394, 152)
PathAddCurve(395, 144, 402, 141, 402, 142)
; sun beam 5
PathMoveTo(408, 182)
PathAddCurve(408, 182, 416, 184, 422, 178)
PathAddCurve(428, 171, 435, 173, 435, 173)
DrawPathStroke(RGB(0, 0, 0), 1)
; left mountain
PathMoveTo(346, 255)
PathAddLine(267, 177)
PathAddLine(236, 192)
PathAddLine(212, 160)
PathAddLine(156, 255)
PathClose()
DrawPath(RGB(107, 142, 35), 1, #PG_Path_Preserve)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10, #PG_Stroke_Outside | #PG_Stroke_RoundCorner)
DrawPathStroke(RGB(0, 0, 0), 0.1)
; river
PathMoveTo(183, 392)
PathAddCurve(238, 284, 472, 345, 356, 303)
PathAddCurve(237, 261, 333, 256, 333, 256)
PathAddCurve(335, 257, 241, 261, 411, 306)
PathAddCurve(574, 350, 288, 324, 296, 392)
DrawPath(RGB(135, 206, 250), 1, #PG_Path_Preserve)
DrawSetStroke(1, #PG_Stroke_Center)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10, #PG_Stroke_Outside | #PG_Stroke_RoundCorner)
DrawPathStroke(RGB(0, 0, 0), 0.1)
; right mountain
PathMoveTo(575, 263)
PathAddLine(481, 146)
PathAddLine(449, 181)
PathAddLine(433, 159)
PathAddLine(401, 214)
PathAddLine(381, 199)
PathAddLine(323, 263)
PathClose()
DrawPath(RGB(154, 205, 50), 1, #PG_Path_Preserve)
DrawSetStroke(1, #PG_Stroke_Center)
DrawPathStroke(RGB(0, 0, 0), 1, #PG_Path_Preserve)
DrawSetStroke(10, #PG_Stroke_Outside | #PG_Stroke_RoundCorner)
DrawPathStroke(RGB(0, 0, 0), 0.1)
EndProcedure
Haha thanks Andy!AndyMK wrote: Sun Oct 06, 2024 10:05 am WOW! Please do not ditch this project. Is there any documentation for this?