Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I paint a shape?
#21
Hi
taking the code from #10 Bplus post
I translate all the graphic commands into DRAW instructions. Then I modify this for showing how S make easy to do so much copy at different width 
Code: (Select All)
Screen _NewImage(1200, 820, 32)
Dim colr As _Unsigned Long
colr = _RGB32(0, 255, 255)
Draw "s4" ' default setting of Draw
Draw "C" + Str$(colr) + "bm300,200" + "R100F100D100G100L100H100U100E100" + "bm +10,+10 p" + Str$(_RGBA32(0, 0, 255, 255)) + "," + Str$(colr)
_Delay 1
Draw "S2C" + Str$(colr) + "bm200,100" + "R100F100D100G100L100H100U100E100" + "bm +10,+10 p" + Str$(_RGBA32(0, 0, 255, 255)) + "," + Str$(colr)
_Delay 1
Draw "s1C" + Str$(colr) + "bm50,30" + "R100F100D100G100L100H100U100E100" + "bm +10,+10 p" + Str$(_RGBA32(0, 0, 255, 255)) + "," + Str$(colr)
_Delay 1
Draw "s6C" + Str$(colr) + "bm600,300" + "R100F100D100G100L100H100U100E100" + "bm +10,+10 p" + Str$(_RGBA32(0, 0, 255, 255)) + "," + Str$(colr)
As we can observe we need not PSET or similar graphic command to move the graphic cursor on the screen,
moreover done the closed shape we must move into it and it is easy using Blind Move with relative cohordinates (like STEP option of the other graphic instructions)
at the end we can fill with a color until the edge of a specific color the shape using Pcolortodraw, colorof edge
and at last changing S setting we change the dimension of the shape to draw
Happy coding with Draw!
Reply
#22
Here a more complex shape
a fir tree
Code: (Select All)
Screen _NewImage(1200, 820, 32)
Dim colr As _Unsigned Long
colr = _RGB32(0, 255, 255)
Draw "s6" ' default setting of Draw
Draw "C" + Str$(colr) + "bm600,300" + "g50r10g75r15g100r225D100L50u100r50bm-2,+8 p " + Str$(_RGBA(139, 100, 11, 255)) + "," + Str$(colr) + "c" + Str$(colr) + " bm+2,-8 r175h100r15h75r10h50" + "bm +0,+15 p" + Str$(_RGBA32(0, 255, 0, 255)) + "," + Str$(colr)
_Delay 1
Draw "S2C" + Str$(colr) + "bm200,100" + "g50r10g75r15g100r225D100L50u100r50bm-4,+8 p " + Str$(_RGBA(139, 100, 11, 255)) + "," + Str$(colr) + "c" + Str$(colr) + " bm+4,-8 r175h100r15h75r10h50" + "bm +0,+15 p" + Str$(_RGBA32(0, 255, 0, 255)) + "," + Str$(colr)
_Delay 1

Draw "s1C" + Str$(colr) + "bm50,30" + "g50r10g75r15g100r225D100L50u100r50bm-4,+8 p " + Str$(_RGBA(139, 100, 11, 255)) + "," + Str$(colr) + "c" + Str$(colr) + " bm+4,-8 r175h100r15h75r10h50" + "bm +0,+15 p" + Str$(_RGBA32(0, 255, 0, 255)) + "," + Str$(colr)
_Delay 1

Draw "s4C" + Str$(colr) + "bm800,300" + "g50r10g75r15g100r225D100L50u100r50bm-2,+10 p " + Str$(_RGBA(139, 100, 11, 255)) + "," + Str$(colr) + "c" + Str$(colr) + " bm+2,-10 r175h100r15h75r10h50" + "bm +0,+15 p" + Str$(_RGBA32(0, 255, 0, 255)) + "," + Str$(colr)
you can build a wood!
Reply




Users browsing this thread: 1 Guest(s)