Re: Thick lines
- Posted by Ralf Nieuwenhuijsen <nieuwen at POP.XS4ALL.NL> May 30, 1997
- 778 views
Patrat wrote: > Hello, I'm trying yo write a drawing program at the moment and a question: > I have bean using draw_line() but that can only draw lines 1 pixel thick > and I nead verible line thicknes, any one know how to do this? Well, all the drawing routines of Euphoria let you go out of the screen without trouble, you then could try drawing circles from the beginning until the end of the line, just calculate the difference. This would create the same effect as seen in many drawing programs. Xstep = beginX - endX Ystep = beginY - endY Further, you need to know the square root of ((Xstep * 2) + (Ystep * 2). Ask about Pythagoras to someone, he's the guy that figurred this out. But with that square root you now the *real* length of the line, Divide Xstep by this value and Ystep too. Store those divided values in atoms called: small_x and small_y [CODE THIS PIECE YOURSELF WITH THE ABOVE EXPLENATION] [I DO NOT KNOW WHICH ROUTINES TO USE, BROWSE THE LIBRARY.DOC] Then simple have a couple of loops like this: for posX = 1 to beginX-endX step small_x for posY = t to beginY-endY step small_y [Here you should draw a circle in the width you want.] end for end for And now you should have be able to make thick lines with beautifull rounded begin and end points. Ralf Nieuwenhuijsen nieuwen at xs4all.nl