
-----------------------------------
jolly50
Sat Nov 03, 2007 6:33 am

Drawfill
-----------------------------------
Hey,

I'm trying to learn about drawfill. So I printed a house and i'm trying to fill the house with colors, my problem is that i cannot fill the roof where I used lines instead of boxes.

So here is my code:



setscreen ("graphics")


% The House Foundation
drawbox (250,250,350,100,2)
drawfill (275,200,2,2)

% The House Roof
drawline (250,250,300,310,2)
drawline (300,310,350,250,2)

% The House Door
drawbox (280,100,310,150,2)

% The House Windows
drawbox (275,200,295,225,2)
drawbox (315,200,335,225,2)

% The House Chimney
drawline (325,281,325,291,2)
drawline (335,291,335,267,2)
drawline (325,291,335,291,2)
%Smoke
drawline (328,293,328,303,2)
drawline (332,305,332,315,2)
drawline (329,316,329,326,2)



Should I keep the lines or is there another way to draw a triangle?

-----------------------------------
HeavenAgain
Sat Nov 03, 2007 11:33 am

RE:Drawfill
-----------------------------------
theres something called drawfillbox, you can look that up, it bascially just ... draw and fill the box
setscreen ("graphics")


% The House Foundation
drawfillbox (250,250,350,100,2)


% The House Roof
drawline (250,250,300,310,2)
drawline (300,310,350,250,2)

% The House Door
drawbox (280,100,310,150,2)

% The House Windows
drawbox (275,200,295,225,2)
drawbox (315,200,335,225,2)

% The House Chimney
drawline (325,281,325,291,2)
drawline (335,291,335,267,2)
drawline (325,291,335,291,2)
drawfill (275,275,1,2)
%Smoke
drawline (328,293,328,303,2)
drawline (332,305,332,315,2)
drawline (329,316,329,326,2) 
:roll:

-----------------------------------
CodeMonkey2000
Sat Nov 03, 2007 11:38 am

RE:Drawfill
-----------------------------------
Is this an assignment or are you doing this for fun? I remember way back in grade 9 we had to draw animate a stupid clown winking using turing's draw module. What the hell does that have to do with proper programming concepts? It's just pointless.

-----------------------------------
Supernal
Sat Nov 03, 2007 11:40 am

RE:Drawfill
-----------------------------------
I had to do this exact same project in Grd. 9.
As well as a space ship blasting off, then we finally started with simple calculators and stuff.

-----------------------------------
jolly50
Sat Nov 03, 2007 12:30 pm

RE:Drawfill
-----------------------------------
ok I'm trying to fill the chimney and make it red, but somethings wrong......


setscreen ("graphics")


% The House Foundation
drawfillbox (250,250,350,100,2)

% The House Roof
drawline (250,250,300,310,2)
drawline (300,310,350,250,2)
drawfill (275,275,yellow,2) 

% The House Door
drawfillbox (280,100,310,150,6)


% The House Windows
drawfillbox (275,200,295,225,6)
drawfillbox (315,200,335,225,6)

% The House Chimney
drawline (325,281,325,291,2)
drawline (335,291,335,267,2)
drawline (325,291,335,291,2)
drawfill (330,286,4,7)
%Smoke
drawline (328,293,328,303,8)
drawline (332,305,332,315,8)
drawline (329,316,329,326,8)



what am i doing wrong

-----------------------------------
CodeMonkey2000
Sat Nov 03, 2007 12:36 pm

RE:Drawfill
-----------------------------------
Use the drawfillpolygon procedure.

-----------------------------------
jolly50
Sat Nov 03, 2007 1:20 pm

RE:Drawfill
-----------------------------------
can you put down an example of a drawfillpolygon because the help menu doesnt really help me

-----------------------------------
CodeMonkey2000
Sat Nov 03, 2007 3:04 pm

Re: Drawfill
-----------------------------------
Basically you have two parallel arrays with the same dimensions. The first array contains all your x coordinates, the second contains the y. So X(1) and Y(1) together make one coordinate. Now you pass these in to drawfillpolygon, then you pass in how many sides your polygon has (this is generally equivalent to the upper bounds of the arrays). For you it's:
var x : array 1 .. 4 of int := init (325, 325, 335, 335)
var y : array 1 .. 4 of int := init (281, 291, 291, 267)
Draw.FillPolygon (x, y, 4, brightblue)

-----------------------------------
jolly50
Sat Nov 03, 2007 8:49 pm

RE:Drawfill
-----------------------------------
ok... that makes more sense then the help menu... thanks

-----------------------------------
Clayton
Sun Nov 04, 2007 9:04 am

RE:Drawfill
-----------------------------------
The arrays don't necessarily have to be parrallel ;)


var pentagon : 
    record
        x : array 1 .. 5 of int
        y : array 1 .. 5 of int
    end record

//assign variables

Draw.FillPolygon (pentagon.x, pentagon.y, upper (pentagon.x), red)


:)
