Thicker lines in draw statement?
Author |
Message |
x-ecutioner
|
Posted: Mon Nov 10, 2008 9:10 pm Post subject: 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?
code: |
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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
corriep
|
Posted: Mon Nov 10, 2008 9:17 pm Post subject: Re: Thicker lines in draw statement? |
|
|
Easiest way to do it :
Turing: |
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
|
|
|
|
|
|
![](images/spacer.gif) |
The_Bean
![](http://compsci.ca/v3/uploads/user_avatars/8459755754b4009cee84e9.jpg)
|
Posted: Mon Nov 10, 2008 9:21 pm Post subject: 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.
Turing: |
%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.
Turing: |
%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.
Turing: |
%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
|
|
|
|
|
|
![](images/spacer.gif) |
|
|