ProGUI V3 Alpha 3 Ready for testing!

Developed or developing a new product in PureBasic? Tell the world about it.
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

Hi guys, quick update. My hand has been forced to get the vector functions working for the GFX API (need to render some polygons in order to mimic CSS borders), I was going to leave this for the time-being but what the hell lol So it's going to work similar to Cairo or the PureBasic vector library instead of how Direct2D does it (which is quite verbose and a different paradigm completely) - it's easier I think how Cairo does it for the end user and fits in well with the DrawXXX set of commands. So currently working in Direct2D (which has been a bit fiddly) for example:

Code: Select all

PathMoveTo(200, 200)
PathAddLine(400, 200)
PathAddLine(200, 400)
DrawPath(RGB(255, 0, 0))
So this should be ready in about a week for Alpha 2.1
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

So for example:

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
Image

And:

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
Image
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by Zach »

looking good man 8)
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

Zach wrote: Mon Sep 30, 2024 4:00 am looking good man 8)
Thanks mate! :)
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

Done a slight re-factor to the Direct2D path code, a list of commands is now maintained instead of 'buidling' the Direct2D geometry and figures incrementally with each PathXXX command. Now when there is a DrawPath command the list is iterated over and the Direct2D geometry built, this simplifies things and allows for the 'fill winding' to be specified as a flag in the DrawPath command as well as allow for #PG_Path_Preserve and easily save and restore path states. This should also have better CPU cache locality and branch predication. The great thing too is the Cairo drivers are pretty much 1 to 1 with the path commands - so not much work needed there.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

Path commands coming along nicely, currently implemented:

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)
With the DrawSetStroke(Width.f, Flags = #Null, DashStartOffset.f = 0) command applying, so defaults to inside stroke with center and outside flags available.

Image

And the code (83 lines) :

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
And here is the C++ Direct2D equivalent code (242 lines and missing brush initialisation code):

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();
https://learn.microsoft.com/en-us/windo ... s-overview
Last edited by PrincieD on Wed Oct 02, 2024 1:15 am, edited 1 time in total.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

And now with a nice 10 pixel inside stroke (Device Independent Pixel - DPI scaling is automatic):

Image

Code:

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
No C++ Direct2D code because it doesn't support inside / outside stroking :lol:
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by idle »

looking good. :D
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

idle wrote: Wed Oct 02, 2024 1:38 amlooking good. :D
Thanks mate! :D
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.0 Ready for testing!

Post by PrincieD »

Outside stroke:

Image

Code:

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
Outside stroke with rounded corners:

Image

Code:

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
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.1 Ready for testing!

Post by PrincieD »

Alpha 2.1 ready for testing, see top of thread! :)

In the "test_path.pb" example try commenting out line 96 "DrawClear(RGB(240, 240, 240), 1)" enable the comment "DrawClear(0, 0)" above and comment out line 219 "window = CreateWindow(0, 0, 800, 600, "Test", #PG_Window_MinimizeWidget | #PG_Window_MaximizeWidget | #PG_Window_Sizeable)" and enable the comment below "window = CreateWindow(0, 0, 800, 600, "Test", #PG_Window_BorderLess | #PG_Window_Sizeable | #PG_Window_BackgroundDrag, 0)" for fun guaranteed! :lol:

https://www.youtube.com/shorts/6hz-ESyDErU

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Re: ProGUI V3 Alpha 2.1 Ready for testing!

Post by AndyMK »

WOW! Please do not ditch this project. Is there any documentation for this?
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.1 Ready for testing!

Post by PrincieD »

AndyMK wrote: Sun Oct 06, 2024 10:05 am WOW! Please do not ditch this project. Is there any documentation for this?
Haha thanks Andy! :) Don't worry I've been working on it solidly for almost a year now and I'm very close to the first beta. No docs at the moment unfortunately (the API is still in flux) but I'll be writing up the docs for the first beta, in the meantime please do take a look at the examples (especially the BorderImg Editor tool) and have a play around :) - most commands (hopefully) are self explanatory (mostly lol)

Cheers!

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V3 Alpha 2.1 Ready for testing!

Post by PrincieD »

Hey guys!

I just wanted to mention that if you already have a V1.xx Gold license, there will be a 20% discount when upgrading to V3. And if you have a Platinum license, the upgrade will be free! - as promised 😃

I’d really appreciate any support, so if you’re thinking of purchasing a V1.xx license, it would really help me out a lot! There’s still some great Win32 code in there along with the Graph Library.

Cheers,

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: ProGUI V3 Alpha 2.1 Ready for testing!

Post by jacdelad »

I just bought the Gold license a few days ago, didn't find a hint how to get the Platinum licence. How did you do this and how much does it cost? Maybe Chris let's me update it to platinum.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Post Reply