QB64 Phoenix Edition
How do I paint a shape? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: How do I paint a shape? (/showthread.php?tid=1790)

Pages: 1 2 3


RE: How do I paint a shape? - TempodiBasic - 06-28-2023

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!


RE: How do I paint a shape? - TempodiBasic - 06-28-2023

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!