It is currently Thu Oct 01, 2020 3:02 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: [Module] DrawVectorEx - Module
PostPosted: Wed Jun 19, 2019 8:54 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
DrawVectorEx - Module (all OS / 64Bit / DPI)

Simplified use of the VectorDrawing library

Image

Code:
; 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

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Last edited by Thorsten1867 on Thu Mar 12, 2020 8:47 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Wed Jun 19, 2019 9:07 pm 
Offline
Moderator
Moderator

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1112
Location: Gernsbach (Germany)
Very nice Image

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Sat Nov 16, 2019 4:45 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3321
Location: Boston, MA
This is very helpful!
Wish I had it before so many code stumbles. :oops:
Some of the module elements are called often and should be Macro's.
Code:
  ;- ===========================================================================
  ;-   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

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Fri Dec 20, 2019 6:22 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6258
Location: Wales, UK
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). :mrgreen:

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Fri Dec 20, 2019 6:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 07, 2018 6:50 pm
Posts: 198
Thorsten1867 wrote:

Isn't this link to Date64Module.pbi ?


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Sat Dec 21, 2019 12:15 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6258
Location: Wales, UK
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.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Sat Dec 21, 2019 12:24 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 07, 2018 6:50 pm
Posts: 198
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)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Wed Mar 11, 2020 6:26 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Oct 06, 2006 4:41 am
Posts: 720
Location: Canada
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.

_________________
"That's not a bug..." said the programmer. "...It's a feature! "
"Oh! I see..." replied the blind man.


Last edited by Blue on Thu Mar 12, 2020 3:32 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Thu Mar 12, 2020 1:50 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6258
Location: Wales, UK
Hi Thorsten

An enhancement request - tangent arcs:

Image

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Thu Mar 12, 2020 8:52 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Have you the code for tangent arcs?

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Thu Mar 12, 2020 6:05 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6258
Location: Wales, UK
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:

Image

There is an interesting discussion, with code, here:

http://csharphelper.com/blog/2019/10/connect-two-line-segments-with-a-circular-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".

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Thu Mar 12, 2020 6:35 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5813
Location: Germany
Try this: https://www.purebasic.com/documentation ... tharc.html

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Thu Mar 12, 2020 7:15 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
IdeasVacuum wrote:
Image

Do you have some coordinates for the lines to test?

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Thu Mar 12, 2020 10:00 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6258
Location: Wales, UK
A couple of examples:

Image

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] DrawVectorEx - Module
PostPosted: Sat Mar 14, 2020 4:28 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Please test!
I hope it does what it should. It's been decades since I did any math. :?

Image

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Last edited by Thorsten1867 on Sat Mar 14, 2020 8:21 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye