Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The DRAW statement in QuickBASIC 4.5
#1
Here is an awesome QuickBASIC program that uses the DRAW statement throughout! Comments?

Code:
'SCOTT.BAS is the GEORGE C. SCOTT PORTRAIT program by J.Ventling that
'appeared in Color Computer News of April, 1982, p.15, with some
'modifications by R.A.Esquivel on 06 May 1988 and on 28 Jan 2006.

CLS
SCREEN 9 'Works with Screens 9, 10, 11 or 12
S = 4


'draw the letters "GEORGE"
G$ = "G2D11F2R7E2U4L3 D R2D3LDL7ULU11RUR7DRD3RU3H2L7"
E$ = "D15R11UL10U6R6UL6U6R10UL11"
O$ = "G2D11F2R7E2U11H2L7;BDDLD11RDR7URU11LUL7BU"
R$ = "R9F2D4G2L5F7LH7L2D7LU15;BFR8DRD4LDL8U6BU"

G1$ = "BM134,47;" + G$
E1$ = "BM+ 14, 0;" + E$
O1$ = "BM+ 18, 0;" + O$
R1$ = "BM+ 15, 0;" + R$
G2$ = "BM+ 17, 0;" + G$
E2$ = "BM+ 15, 0;" + E$

DRAW G1$ + E1$ + O1$ + R1$ + G2$ + E2$


'draw the letter C with a dot, "C."
C$ = "G2D11F2R7E2U3LD3LDL7ULU11RUR7DRD3RU3H2L7"

DRAW "BM+ 30,+0;" + C$
DRAW "BM+ 15,+0;BD15U2L2D2R2" '.


'draw the letter outlines for "SCOTT"
S$ = "G4D5F4R7F2D4G2L6H2U3L3D4F4R8E4U6H4L7H2U3E2R6F2D3R3U4H4L8"
C$ = "G4D16F4R7E4U4L3D3G2L5H2U14E2R5F2D2R3U3H4L7"
O$ = "G4D16F4R7E4U16H4L7;BF3BLLG2D14F2R5E2U14H2L5BE3"
T$ = "D3R6D21RR3U21R6U3L16"

S1$ = "BM+  0,0;" + S$
C1$ = "BM+ 20,0;" + C$
O1$ = "BM+ 19,0;" + O$
T1$ = "BM +12,0;" + T$
T2$ = "BM +21,0;" + T$

DRAW "BM-110,7" + S1$ + C1$ + O1$ + T1$ + T2$


'now, fill-in the outlines for "SCOTT"
U = 92 + 1: V = 92:
PSET (152, U): PSET (172, U): PSET (192, U)
PSET (212, U): PSET (232, U)

PAINT (152, V): PAINT (172, V): PAINT (192, V)
PAINT (212, V): PAINT (232, V)



'draw the portrait's outline
DRAW  _
"BM1,1;BM+31,  0 DRD3M26,7R4ERFD2G2L2FR3D3F2R10D2L4GL6D2F2RF3R8DG2L7GD2FERER2D2FND2R2ERF2DR4D2L4GD4L5HLDF3DFRFR3FR14FR2FR5FRF2D3G2D2R2DF3DGFD4F2DF3D4FDFD4F2DFDFD3GDG2F3DFDF4D2FDFDF2RFDRF2D5FRE2UEUEU5HU2M87,57U5E4UHU2EUM97,34U2EU2EU7HUHUH2U3HUH3EU2M90,0" _

DRAW "BM1,1 BM+33,  6 R5ER2FG2LGL5U3"
DRAW "BM1,1 BM+40,190 M+3,-23 E2U3EU3EU3EU2H2LUEUH2U4EU 2H3U1H2 HLHUHUHU2H2GU2HUH4LHL2U2HLH4L2U2HUHLHLH2URE2UFR3F3RFRFRF3RFREUF2R9ER3ERERE6HGLGL4DLUR2U3HE2HL2DLEUR2DR2ERE2UEH"
DRAW "BM1,1 BM+41,  5 R4D2L4U2"
DRAW "BM1,1 BM+50, 64 L4GLD2FRE4"
DRAW "BM1,1 BM+54, 83 L3G3L2UL5DL4H3U2R4DR5U2H2U3E2U3NLD2R2D4RD2R2FEREU2RFEU4NLDRD2F2RDLD5FD5G3DFD6FD4FRED5F2DGD2GD2GFRG3DG2DFG2D6F6RDLG2D2G2L4DL3G3DG2D2LD6LD6FDF2RFDG2D6F2D1F2D1"
DRAW "BM1,1 BM+67,191 M+19,-10U2L3DL3DL2UL5UL3UL2R4DR4DR3UE2HLHL2HLHERER5E2UEUE2R3FGDGD3F2DGDG2D5FD3FD3"
DRAW "BM1,1 BM+68, 83 GD3FD4R2FR2U2HU2HUH3"
DRAW "BM1,1 BM+68,157 G2L2DRUR5HLU"
DRAW "BM1,1 BM+84,116 DF3DF2REU2H4L3"
DRAW "BM1,1 BM+90,139 D4GD2G2LGL2G3DGD3GDFRER2ER4F2RERUE3UM-6,-14"

'Draw a box around the portrait:
LINE (1, 1)-(300, 192), , B

'PAINT (FILL-IN) the portrait
PAINT (48, 24): PAINT (72, 92): PAINT (88, 120)'forehead & nose
PAINT (47, 67): PAINT (48, 112): PAINT (48, 190)'eye & cheek
PAINT (82, 188)'chin
PAINT (72, 192)
PAINT (88, 156): PAINT (88, 174): PAINT (88, 192)'mouth


'end of program
LOCATE 23, 1
PRINT "PRESS ANY KEY TO END PROGRAM"
K$ = "": WHILE K$ = "": K$ = INKEY$: WEND
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#2
Great!

I did'nt kmow QB Draw could do that....Is there more "DRAW art" of this quality out there?

FB fails completely at rendering it..
Antoni
Reply
#3
Antoni, thank you for taking the time, and for your comments.

As far as I am concerned, this is the only program of this type that I know of. And, the original one, which I have, and could present here, if required, is a BASIC program, with each line starting with a line number. It was presented for use on the 16K Color Computer, but, maybe it existed before that time (1982). And, other than my understanding of the the DRAWing of the letters, and my separating each part (DRAW the letters, DRAW the outline, etc.), I don't think I could do much more. I think it would take a person with a good, artistic sense to come up with another such example, using the DRAW the outline and PAINT the inside concept.

I do have a few old (1982) BASIC programs for the TRS-80 Color Computer that use DRAW statements almost exclusively, but they are simpler drawings, Three of them create a YACHT, a YAWL, and a DRAGGER. They would first have to be "translated" to be able to run in QuickBASIC, though.

A few other programs that I have that use the DRAW statement are more on the order of engineering programs that DRAW beam outlines and such.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#4
thats very nice. could be a good challenge to write a program that converts a line drawing into draw statements.
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#5
I have a simple line-based picture of a yacht. Think it's worth while to post it in the Challenges forum?
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#6
For those interested in making the program work in fb:

1.- add a
Code:
DRAW "s4"
before all draws,
2.- remove the spaces between the "M" and the "+" signs in
Code:
T1$ = "BM +12,0;" + T$
T2$ = "BM +21,0;" + T$
It should work then both in QB and FB
Antoni
Reply
#7
Works nicely in FB with the changes Antoni Gual suggested.

...Really cool portarait ^^
/post]
Reply
#8
Lillo solved the problem with FB and this example! Next testing version 0.16 should render it correctly without any changes in the source.
Antoni
Reply
#9
Here, to make it easier, here's the modified version for FB. Even I got it working.

Code:
'SCOTT.BAS is the GEORGE C. SCOTT PORTRAIT program by J.Ventling that
'appeared in Color Computer News of April, 1982, p.15, with some
'modifications by R.A.Esquivel on 06 May 1988 and on 28 Jan 2006.

CLS
SCREEN 9 'Works with Screens 9, 10, 11 or 12
S = 4


'draw the letters "GEORGE"
G$ = "G2D11F2R7E2U4L3 D R2D3LDL7ULU11RUR7DRD3RU3H2L7"
E$ = "D15R11UL10U6R6UL6U6R10UL11"
O$ = "G2D11F2R7E2U11H2L7;BDDLD11RDR7URU11LUL7BU"
R$ = "R9F2D4G2L5F7LH7L2D7LU15;BFR8DRD4LDL8U6BU"

G1$ = "BM134,47;" + G$
E1$ = "BM+ 14, 0;" + E$
O1$ = "BM+ 18, 0;" + O$
R1$ = "BM+ 15, 0;" + R$
G2$ = "BM+ 17, 0;" + G$
E2$ = "BM+ 15, 0;" + E$

DRAW "s4"
DRAW G1$ + E1$ + O1$ + R1$ + G2$ + E2$


'draw the letter C with a dot, "C."
C$ = "G2D11F2R7E2U3LD3LDL7ULU11RUR7DRD3RU3H2L7"
DRAW "s4"
DRAW "BM+ 30,+0;" + C$
DRAW "s4"
DRAW "BM+ 15,+0;BD15U2L2D2R2" '.


'draw the letter outlines for "SCOTT"
S$ = "G4D5F4R7F2D4G2L6H2U3L3D4F4R8E4U6H4L7H2U3E2R6F2D3R3U4H4L8"
C$ = "G4D16F4R7E4U4L3D3G2L5H2U14E2R5F2D2R3U3H4L7"
O$ = "G4D16F4R7E4U16H4L7;BF3BLLG2D14F2R5E2U14H2L5BE3"
T$ = "D3R6D21RR3U21R6U3L16"

S1$ = "BM+  0,0;" + S$
C1$ = "BM+ 20,0;" + C$
O1$ = "BM+ 19,0;" + O$
T1$ = "BM+ 12,0;" + T$
T2$ = "BM+ 21,0;" + T$

DRAW "s4"
DRAW "BM-110,7" + S1$ + C1$ + O1$ + T1$ + T2$


'now, fill-in the outlines for "SCOTT"
U = 92 + 1: V = 92:
PSET (152, U): PSET (172, U): PSET (192, U)
PSET (212, U): PSET (232, U)

PAINT (152, V): PAINT (172, V): PAINT (192, V)
PAINT (212, V): PAINT (232, V)



'draw the portrait's outline
DRAW "s4"
DRAW  _
"BM1,1;BM+31,  0 DRD3M26,7R4ERFD2G2L2FR3D3F2R10D2L4GL6D2F2RF3R8DG2L7GD2FERER2D2FND2R2ERF2DR4D2L4GD4L5HLDF3DFRFR3FR14FR2FR5FRF2D3G2D2R2DF3DGFD4F2DF3D4FDFD4F2DFDFD3GDG2F3DFDF4D2FDFDF2RFDRF2D5FRE2UEUEU5HU2M87,57U5E4UHU2EUM97,34U2EU2EU7HUHUH2U3HUH3EU2M90,0" _
DRAW "BM1,1 BM+33,  6 R5ER2FG2LGL5U3"
DRAW "s4"
DRAW "BM1,1 BM+40,190 M+3,-23 E2U3EU3EU3EU2H2LUEUH2U4EU 2H3U1H2 HLHUHUHU2H2GU2HUH4LHL2U2HLH4L2U2HUHLHLH2URE2UFR3F3RFRFRF3RFREUF2R9ER3ERERE6HGLGL4DLUR2U3HE2HL2DLEUR2DR2ERE2UEH"
DRAW "s4"
DRAW "BM1,1 BM+41,  5 R4D2L4U2"
DRAW "s4"
DRAW "BM1,1 BM+50, 64 L4GLD2FRE4"
DRAW "s4"
DRAW "BM1,1 BM+54, 83 L3G3L2UL5DL4H3U2R4DR5U2H2U3E2U3NLD2R2D4RD2R2FEREU2RFEU4NLDRD2F2RDLD5FD5G3DFD6FD4FRED5F2DGD2GD2GFRG3DG2DFG2D6F6RDLG2D2G2L4DL3G3DG2D2LD6LD6FDF2RFDG2D6F2D1F2D1"
DRAW "s4"
DRAW "BM1,1 BM+67,191 M+19,-10U2L3DL3DL2UL5UL3UL2R4DR4DR3UE2HLHL2HLHERER5E2UEUE2R3FGDGD3F2DGDG2D5FD3FD3"
DRAW "s4"
DRAW "BM1,1 BM+68, 83 GD3FD4R2FR2U2HU2HUH3"
DRAW "s4"
DRAW "BM1,1 BM+68,157 G2L2DRUR5HLU"
DRAW "s4"
DRAW "BM1,1 BM+84,116 DF3DF2REU2H4L3"
DRAW "s4"
DRAW "BM1,1 BM+90,139 D4GD2G2LGL2G3DGD3GDFRER2ER4F2RERUE3UM-6,-14"

'Draw a box around the portrait:
LINE (1, 1)-(300, 192), , B

'PAINT (FILL-IN) the portrait
PAINT (48, 24): PAINT (72, 92): PAINT (88, 120)'forehead & nose
PAINT (47, 67): PAINT (48, 112): PAINT (48, 190)'eye & cheek
PAINT (82, 188)'chin
PAINT (72, 192)
PAINT (88, 156): PAINT (88, 174): PAINT (88, 192)'mouth


'end of program
LOCATE 23, 1
PRINT "PRESS ANY KEY TO END PROGRAM"
K$ = "": WHILE K$ = "": K$ = INKEY$: WEND

BTW, That's nice. Smile

>anarky
Screwing with your reality since 1998.
Reply
#10
Thanks to all who have modified the program so it works in either QuickBASIC or in FreeBasic.

I have experimented some more with this program, and have found that:

1. The program works fine also for all graphic SCREENs, except 7, so, I have added these,
and remarked out two lines near the end, to avoid overwriting the portrait for the larger
screens, such as 1, 8 and 13.

2. Subtituted a NEXT...FOR loop to fill-in the letters SCOTT, instead of the previous four lines
that contained various colons ( : ).
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)