Page 1 of 3
[Module] DrawVectorEx - Module
Posted: Wed Jun 19, 2019 8:54 pm
by Thorsten1867
DrawVectorEx - Module (all OS / 64Bit / DPI)
Simplified use of the VectorDrawing library
Code: Select all
; Draw::AlphaColor_() - similar to RGBA()
; Draw::Box_() - similar to Box()
; Draw::Circle_() - similar to Circle()
; Draw::CircleArc_() - draws a arc of a circle
; Draw::CircleSector_() - draws a circle sector
; Draw::Ellipse_() - similar to Ellipse()
; Draw::EllipseArc_() - draws a arc of a ellipse
; Draw::Font_() - similar to DrawingFont()
; Draw::Line_() - similar to Line()
; Draw::HLine_() - draws a horizontal line
; Draw::VLine_() - draws a vertical line
; Draw::LineXY_() - similar to LineXY()
; Draw::MixColor_() - mixes 2 colours in a mixing ratio of 1% - 99%
; Draw::SetStroke_() - changes the stroke width
; Draw::StartVector_() - similar to StartVectorDrawing()
; Draw::StopVector_() - similar to StopVectorDrawing()
; Draw::Text_() - similar to DrawText()
; Draw::TextHeight_() - similar to TextHeight()
; Draw::TextWidth_() - similar to TextWidth()
Download: DrawVectorExModule.pbi
Re: [Module] DrawVectorEx - Module
Posted: Wed Jun 19, 2019 9:07 pm
by RSBasic
Very nice
Re: [Module] DrawVectorEx - Module
Posted: Sat Nov 16, 2019 4:45 pm
by skywalk
This is very helpful!
Wish I had it before so many code stumbles.
Some of the module elements are called often and should be Macro's.
Code: Select all
;- ===========================================================================
;- DeclareModule
;- ===========================================================================
;Declare.q AlphaColor_(Color.i, Alpha.i)
;Declare.q MixColor_(Color1.i, Color2.i, Factor.i=50)
Macro dpiX(Num_i)
DesktopScaledX(Num_i)
EndMacro
Macro dpiY(Num_i)
DesktopScaledY(Num_i)
EndMacro
Macro AlphaColor_(Color_i, Alpha_i)
RGBA(Red(Color_i), Green(Color_i), Blue(Color_i), Alpha_i)
EndMacro
Macro MixColor_(Color1_i, Color2_i, Factor_i=50)
BlendColor_(Color1_i, Color2_i, Factor_i)
EndMacro
Re: [Module] DrawVectorEx - Module
Posted: Fri Dec 20, 2019 6:22 pm
by IdeasVacuum
OMG - I have had so much trouble getting the Vector Lib to work in the real world, it just isn't intuitive. This Module is going to save my hair (whats left of it).
Re: [Module] DrawVectorEx - Module
Posted: Fri Dec 20, 2019 6:40 pm
by Everything
Isn't this link to Date64Module.pbi ?
Re: [Module] DrawVectorEx - Module
Posted: Sat Dec 21, 2019 12:15 am
by IdeasVacuum
Everything wrote:Isn't this link to Date64Module.pbi ?
It does, but via "Download of PureBasic - Modules" you will find all of Thorsten's Modules, including DrawVectorEx.
Re: [Module] DrawVectorEx - Module
Posted: Sat Dec 21, 2019 12:24 am
by Everything
IdeasVacuum wrote:but via "Download of PureBasic - Modules" you will find all of Thorsten's Modules, including DrawVectorEx
Yes I know, just wanted to point out an error in the module link (just in case)
Re: [Module] DrawVectorEx - Module
Posted: Wed Mar 11, 2020 6:26 pm
by Blue
a direct link :
Thorsten Hoeppner's PB modules (in Github)
Thank you very much,
Thorsten, for clarifying the whole Vector Drawing library.
Studying your code has gotten me to finally understand what I was doing so wrong in regards to vector drawing and DPi awareness.
Most appreciated.
And you should give serious consideration to
Skywalk's suggestion of replacing some of the simpler one-line one-value Procedures with
Macros. It makes a lot of sense.
Re: [Module] DrawVectorEx - Module
Posted: Thu Mar 12, 2020 1:50 am
by IdeasVacuum
Hi Thorsten
An enhancement request - tangent arcs:
Re: [Module] DrawVectorEx - Module
Posted: Thu Mar 12, 2020 8:52 am
by Thorsten1867
Have you the code for tangent arcs?
Re: [Module] DrawVectorEx - Module
Posted: Thu Mar 12, 2020 6:05 pm
by IdeasVacuum
Hi Thorsten
I thought they were supported by GDI+, but I'm wrong, I can't find a mention in Danilo's gDrawing Lib.
I think I should be able to get a handle on it myself. A couple of diagrams showing the geometry rules:
There is an interesting discussion, with code, here:
http://csharphelper.com/blog/2019/10/co ... -arc-in-c/
However in most circumstances the User would have two lines meeting in a sharp corner and the tangent arc would be applied to that corner. In the CAD world it's called a "fillet".
Re: [Module] DrawVectorEx - Module
Posted: Thu Mar 12, 2020 6:35 pm
by freak
Re: [Module] DrawVectorEx - Module
Posted: Thu Mar 12, 2020 7:15 pm
by Thorsten1867
IdeasVacuum wrote:
Do you have some coordinates for the lines to test?
Re: [Module] DrawVectorEx - Module
Posted: Thu Mar 12, 2020 10:00 pm
by IdeasVacuum
A couple of examples:
Re: [Module] DrawVectorEx - Module
Posted: Sat Mar 14, 2020 4:28 pm
by Thorsten1867
Please test!
I hope it does what it should. It's been decades since I did any math.