
-----------------------------------
x-ecutioner
Mon Nov 10, 2008 9:10 pm

Thicker lines in draw statement?
-----------------------------------
this could either be really simple or really complicated, i think ...

any idea how to make the line thicker in a draw statement for like a circle or a square or a star?

drawbox (Shapes.x - Shapes.add, Shapes.x - Shapes.add, Shapes.x2 + Shapes.add, Shapes.x2 + Shapes.add, Shapes.colorz)
drawoval (Shapes.x - Shapes.add, Shapes.x - Shapes.add, Shapes.ovalxr, Shapes.ovalyr, Shapes.colorz)
drawstar (Shapes.x - Shapes.add, Shapes.x - Shapes.add, Shapes.x2 + Shapes.add, Shapes.x2 + Shapes.add, Shapes.colorz)

thanks

-----------------------------------
corriep
Mon Nov 10, 2008 9:17 pm

Re: Thicker lines in draw statement?
-----------------------------------
Easiest way to do it :

 
var thickness : int := 5 % Replace with anything you want

% Circle 
for i : 1 .. thickness 
drawoval (100, 100, 30 - i, 30 - i, black) 
end for 
% Square 
for i : 1 .. thickness 
drawbox (10 + i, 10 + i, 50 - i, 50 - i, black) 
end for 
% Star 
for i : 1 .. thickness 
drawstar (150 + i, 150 + i, 250 - i, 250 - i, black) 
end for 


-----------------------------------
The_Bean
Mon Nov 10, 2008 9:21 pm

Re: Thicker lines in draw statement?
-----------------------------------
a) Use a for loop to increase/decrease the size by 1 each time for the thickness you want.

%A)
for i : 1 .. 5
    Draw.Box (50 - i, 50 - i, 100 + i, 100 + i, 7)
    %
    Draw.Star (150 - i, 50 - i, 200 + i, 100 + i, 7)
    %
    Draw.Oval (275, 75, 25 + i, 25 + i, 7)
end for

b) Use the 'Fill' version of what your using, and make a smaller version of the same shape inside with the background colour.

%B)
Draw.FillBox (50, 50, 100, 100, 7)
Draw.FillBox (55, 55, 95, 95, 0)
%
Draw.FillStar (150, 50, 200, 100, 7)
Draw.FillStar (160, 60, 190, 90, 0)
%
Draw.FillOval (275, 75, 30, 30, 7)
Draw.FillOval (275, 75, 25, 25, 0)

c) Use Draw.ThickLine, and recreate the image by ureself.

%C)
Draw.ThickLine (50, 50, 100, 50, 5, 7)
Draw.ThickLine (50, 50, 50, 100, 5, 7)
Draw.ThickLine (100, 100, 50, 100, 5, 7)
Draw.ThickLine (100, 100, 100, 50, 5, 7)
%
for i : 0 .. 359 by 72
    Draw.ThickLine (round (cosd (i) * 30) + 175, round (sind (i) * 30) + 75, round (cosd (i + 36) * 15) + 175, round (sind (i + 36) * 15) + 75, 5, 7)
    Draw.ThickLine (round (cosd (i) * 30) + 175, round (sind (i) * 30) + 75, round (cosd (i - 36) * 15) + 175, round (sind (i - 36) * 15) + 75, 5, 7)
end for
%
for i : 0 .. 359
    Draw.ThickLine (round (cosd (i) * 30) + 275, round (sind (i) * 30) + 75, round (cosd (i + 1) * 30) + 275, round (sind (i + 1) * 30) + 75, 5, 7)
end for

