File: graphicsutilitiesstampmaker.html

package info (click to toggle)
basic256 1.1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 24,460 kB
  • sloc: cpp: 10,148; yacc: 3,023; java: 1,091; lex: 1,051; sh: 117; xml: 33; makefile: 15
file content (141 lines) | stat: -rw-r--r-- 4,841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<head>
    <meta charset="utf-8" />
    <title>graphicsutilitiesstampmaker [BASIC 256 - Language Documentation]</title>
<link rel="stylesheet" type="text/css" href="lib/exe/cssc171c1dfe8519125bb40a349172b001a.css"/>
    </head>
<body>
    <div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_dokuwiki     ">
<div id="dokuwiki__header"><div class="pad group">
    <div class="headings group">
        <h1><a href="start.html"  accesskey="h" title="[H]"><img src="lib/tpl/dokuwiki/images/logo.png" width="64" height="64" alt="" /> <span>BASIC 256 - Language Documentation</span></a></h1>
            </div>
    </div>
            <div class="breadcrumbs">
                            <div class="youarehere"><span class="bchead">You are here: </span><span class="home"><bdi><a href="start.html" class="wikilink1" title="start">start</a></bdi></span> » <bdi><span class="curid"><a href="graphicsutilitiesstampmaker.html" class="wikilink1" title="graphicsutilitiesstampmaker">graphicsutilitiesstampmaker</a></span></bdi></div>
                    </div>
    <hr class="a11y" />
</div></div>
        <div class="wrapper group">
            <div id="dokuwiki__content"><div class="pad group">
                <div class="pageId"><span>graphicsutilitiesstampmaker</span></div>
                <div class="page group">
<h2 class="sectionedit1" id="stampmaker">Stampmaker</h2>
<div class="level2">
<p>
Generates coordenates for stamp and poly instructions
</p>
</div>
<h3 class="sectionedit2" id="description">Description</h3>
<div class="level3">
<p>
It isn&#039;t easy to draw by inserting coordenates {x1,y1,x2,y2……xn,yn} . This program allows to draw, as the coordenates are generated in the test window. It is also possible to draw multiple shapes by copying from the text output window to the edit window on the previousshapes: routine.
</p>
<pre class="code"># 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
 graphsize 800,500
 fastgraphics
penwidth (2)
 print &quot;Shape={&quot;;
 oldx=0
 oldy=0
 n=2
 dim shape(2)
 init= true
 fin = false
 clickclear
font &quot;arial&quot;,15,100
 loop:
gosub previousshapes
gosub drawgraph
 circle mousex,mousey,3
 color red
 circle shape[0],shape[1],4
 color black
 x=floor(clickx/20-19.5)
 y=floor(-clicky/20+12.5)
 if n&gt;3 and shape[n-2]=shape[0] and shape[n-1]=shape[1]then fin=true
 # Checks for new click
 if oldx&lt;&gt;clickx or oldy&lt;&gt;clicky then
 if init = true then print x+&quot;,&quot;+(-y);
 if init = false then
 print &quot;,&quot;+x+&quot;,&quot;+(-y);
 n=n+2
 end if
 init= false
 redim shape(n)
 shape[n-2]= floor(clickx/20+.5)*20
 shape[n-1]= floor(clicky/20+.5)*20
 end if
 oldx=clickx
 oldy=clicky
 if n &gt; 3 then call draw (ref(shape),n,fin)
 refresh
 clg
 goto loop
 subroutine draw(ref(shape),n,fin)
 color black
 for p = 4 to n step 2
 line shape[p-4],shape[p-3],shape[p-2],shape[p-1]
 next p
 if fin = true then
 refresh
 Print &quot;}&quot;
 stamp 0,0,shape
 refresh
 print &quot;Copy paste and run&quot;
 end
 end if
 end subroutine
 drawgraph:
 color black
 for y= 0 to 480 step 20
 for x= 0 to 800 step 20
 circle x,y,2
 if x/100=int(x/100) then
 line x,0,x,480
 text x,0,x/20-20
 end if
 if y/100=int(y/100) then
 line 0,y+40,800,y+40
 text 0,y+40,y/20-10
 end if
 next x
 next y
 line 0,240,800,240
 line 400,0,400,480
 return
# You can copy the shapes to here to do multiple shape compositions
 previousshapes:
 shapea={0,0,0,0,0,0}
 shapeb={0,0,0,0,0,0}
 shapec={0,0,0,0,0,0}
 shaped={0,0,0,0,0,0}
color red
stamp 400,240,20,shapea
color green
stamp 400,240,20,shapeb
color yellow
stamp 400,240,20,shapec
color purple
stamp 400,240,20,shaped
return
</pre>
<p>
Example<br/>
<a href="http://doc.basic256.org/lib/exe/detail.php?id=graphicsutilitiesstampmaker&amp;media=stampmaker.png" class="media" title="stampmaker.png"><img src="lib/exe/stampmaker.png" class="media" title="Stampmaker" alt="Stampmaker" /></a>
</p>
</div>
                                    </div>
                <div class="docInfo"><bdi>graphicsutilitiesstampmaker.txt</bdi> · Last modified: 2013/04/03 14:02 by <bdi>m_santos</bdi></div>
                            </div></div>
            <hr class="a11y" />
        </div>
<div id="dokuwiki__footer"><div class="pad">
    <div class="license">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license" class="urlextern">CC Attribution-Share Alike 3.0 Unported</a></bdi></div>
</div></div>
    </div></div>
    <div id="screen__mode" class="no"></div>
</body>
</html>