This shows you the differences between two versions of the page.
graphicsutilitiesstampmaker [2016/01/01 22:37] |
graphicsutilitiesstampmaker [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Stampmaker ===== | ||
+ | Generates coordenates for stamp and poly instructions | ||
+ | ==== Description ==== | ||
+ | It isn't easy to draw by inserting coordenates {x1, | ||
+ | |||
+ | < | ||
+ | # Draw a shape then copy then copy the array to your program and use it as a stamp or a poly. The shape is completed when you return to the initial point (Red) | ||
+ | |||
+ | # Draw a shape then copy the array and use it for Stamps | ||
+ | | ||
+ | | ||
+ | penwidth (2) | ||
+ | print " | ||
+ | | ||
+ | | ||
+ | n=2 | ||
+ | dim shape(2) | ||
+ | init= true | ||
+ | fin = false | ||
+ | | ||
+ | |||
+ | |||
+ | font " | ||
+ | loop: | ||
+ | gosub previousshapes | ||
+ | gosub drawgraph | ||
+ | | ||
+ | color red | ||
+ | | ||
+ | color black | ||
+ | |||
+ | | ||
+ | | ||
+ | if n>3 and shape[n-2]=shape[0] and shape[n-1]=shape[1]then fin=true | ||
+ | # Checks for new click | ||
+ | if oldx<> | ||
+ | if init = true then print x+"," | ||
+ | if init = false then | ||
+ | print "," | ||
+ | n=n+2 | ||
+ | end if | ||
+ | init= false | ||
+ | redim shape(n) | ||
+ | | ||
+ | | ||
+ | end if | ||
+ | | ||
+ | | ||
+ | if n > 3 then call draw (ref(shape), | ||
+ | | ||
+ | clg | ||
+ | goto loop | ||
+ | |||
+ | |||
+ | | ||
+ | color black | ||
+ | for p = 4 to n step 2 | ||
+ | line shape[p-4], | ||
+ | next p | ||
+ | |||
+ | |||
+ | if fin = true then | ||
+ | | ||
+ | Print " | ||
+ | stamp 0,0,shape | ||
+ | |||
+ | | ||
+ | print "Copy paste and run" | ||
+ | end | ||
+ | end if | ||
+ | end subroutine | ||
+ | |||
+ | | ||
+ | |||
+ | color black | ||
+ | for y= 0 to 480 step 20 | ||
+ | for x= 0 to 800 step 20 | ||
+ | |||
+ | | ||
+ | if x/ | ||
+ | line x,0,x,480 | ||
+ | text x,0,x/20-20 | ||
+ | end if | ||
+ | if y/ | ||
+ | line 0, | ||
+ | text 0, | ||
+ | end if | ||
+ | |||
+ | next x | ||
+ | next y | ||
+ | line 0, | ||
+ | line 400, | ||
+ | |||
+ | | ||
+ | |||
+ | # You can copy the shapes to here to do multiple shape compositions | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | color red | ||
+ | stamp 400, | ||
+ | color green | ||
+ | stamp 400, | ||
+ | color yellow | ||
+ | stamp 400, | ||
+ | color purple | ||
+ | stamp 400, | ||
+ | return | ||
+ | |||
+ | |||
+ | </ | ||
+ | Example\\ | ||
+ | {{: |