oekaki 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +75 -272
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a09f62f15a3a495f91d9cb3bd904426a1869f290
|
4
|
+
data.tar.gz: be368a699cc8e4d65fea1931baa83e73bde40538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b698597033ca899b7f6f7bce212233c23b3bbae2d935ee4a49da0fd04fd4a474f7cc1db77b4cfda2c5bc129fcd8b3d28f3e8e15218e39d2cca6e44cfafd5293c
|
7
|
+
data.tar.gz: 3dbd6f21732fb3c2fe8b4c3b510d8c8577f60bba12aa2ed7179ada0b481a55ae519aa389a23af47bf0072e534a9d29b6478fb025a2175e494a3356bbb0dbbc37
|
data/README
CHANGED
@@ -1,281 +1,84 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
|
6
|
-
<style type="text/css">
|
7
|
-
body {padding-bottom: 30px;}
|
8
|
-
.highlight table td { padding: 5px; }
|
9
|
-
pre { margin: 20px; padding: 20px; width: 70%; font-size: 1.3em;}
|
10
|
-
.highlight {
|
11
|
-
color: #faf6e4;
|
12
|
-
background-color: #122b3b;
|
13
|
-
}
|
14
|
-
.highlight .gl {
|
15
|
-
color: #dee5e7;
|
16
|
-
background-color: #4e5d62;
|
17
|
-
}
|
18
|
-
.highlight .c, .highlight .cd, .highlight .cm, .highlight .c1, .highlight .cs {
|
19
|
-
color: #6c8b9f;
|
20
|
-
font-style: italic;
|
21
|
-
}
|
22
|
-
.highlight .cp {
|
23
|
-
color: #b2fd6d;
|
24
|
-
font-weight: bold;
|
25
|
-
font-style: italic;
|
26
|
-
}
|
27
|
-
.highlight .err {
|
28
|
-
color: #fefeec;
|
29
|
-
background-color: #cc0000;
|
30
|
-
}
|
31
|
-
.highlight .gr {
|
32
|
-
color: #fefeec;
|
33
|
-
background-color: #cc0000;
|
34
|
-
}
|
35
|
-
.highlight .k, .highlight .kd, .highlight .kv {
|
36
|
-
color: #f6dd62;
|
37
|
-
font-weight: bold;
|
38
|
-
}
|
39
|
-
.highlight .o, .highlight .ow {
|
40
|
-
color: #4df4ff;
|
41
|
-
}
|
42
|
-
.highlight .p, .highlight .pi {
|
43
|
-
color: #4df4ff;
|
44
|
-
}
|
45
|
-
.highlight .gd {
|
46
|
-
color: #cc0000;
|
47
|
-
}
|
48
|
-
.highlight .gi {
|
49
|
-
color: #b2fd6d;
|
50
|
-
}
|
51
|
-
.highlight .ge {
|
52
|
-
font-style: italic;
|
53
|
-
}
|
54
|
-
.highlight .gs {
|
55
|
-
font-weight: bold;
|
56
|
-
}
|
57
|
-
.highlight .gt {
|
58
|
-
color: #dee5e7;
|
59
|
-
background-color: #4e5d62;
|
60
|
-
}
|
61
|
-
.highlight .kc {
|
62
|
-
color: #f696db;
|
63
|
-
font-weight: bold;
|
64
|
-
}
|
65
|
-
.highlight .kn {
|
66
|
-
color: #ffb000;
|
67
|
-
font-weight: bold;
|
68
|
-
}
|
69
|
-
.highlight .kp {
|
70
|
-
color: #ffb000;
|
71
|
-
font-weight: bold;
|
72
|
-
}
|
73
|
-
.highlight .kr {
|
74
|
-
color: #ffb000;
|
75
|
-
font-weight: bold;
|
76
|
-
}
|
77
|
-
.highlight .gh {
|
78
|
-
color: #ffb000;
|
79
|
-
font-weight: bold;
|
80
|
-
}
|
81
|
-
.highlight .gu {
|
82
|
-
color: #ffb000;
|
83
|
-
font-weight: bold;
|
84
|
-
}
|
85
|
-
.highlight .kt {
|
86
|
-
color: #b2fd6d;
|
87
|
-
font-weight: bold;
|
88
|
-
}
|
89
|
-
.highlight .no {
|
90
|
-
color: #b2fd6d;
|
91
|
-
font-weight: bold;
|
92
|
-
}
|
93
|
-
.highlight .nc {
|
94
|
-
color: #b2fd6d;
|
95
|
-
font-weight: bold;
|
96
|
-
}
|
97
|
-
.highlight .nd {
|
98
|
-
color: #b2fd6d;
|
99
|
-
font-weight: bold;
|
100
|
-
}
|
101
|
-
.highlight .nn {
|
102
|
-
color: #b2fd6d;
|
103
|
-
font-weight: bold;
|
104
|
-
}
|
105
|
-
.highlight .bp {
|
106
|
-
color: #b2fd6d;
|
107
|
-
font-weight: bold;
|
108
|
-
}
|
109
|
-
.highlight .ne {
|
110
|
-
color: #b2fd6d;
|
111
|
-
font-weight: bold;
|
112
|
-
}
|
113
|
-
.highlight .nl {
|
114
|
-
color: #ffb000;
|
115
|
-
font-weight: bold;
|
116
|
-
}
|
117
|
-
.highlight .nt {
|
118
|
-
color: #ffb000;
|
119
|
-
font-weight: bold;
|
120
|
-
}
|
121
|
-
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx {
|
122
|
-
color: #f696db;
|
123
|
-
font-weight: bold;
|
124
|
-
}
|
125
|
-
.highlight .ld {
|
126
|
-
color: #f696db;
|
127
|
-
font-weight: bold;
|
128
|
-
}
|
129
|
-
.highlight .ss {
|
130
|
-
color: #f696db;
|
131
|
-
font-weight: bold;
|
132
|
-
}
|
133
|
-
.highlight .s, .highlight .sb, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .sr, .highlight .s1 {
|
134
|
-
color: #fff0a6;
|
135
|
-
font-weight: bold;
|
136
|
-
}
|
137
|
-
.highlight .se {
|
138
|
-
color: #4df4ff;
|
139
|
-
font-weight: bold;
|
140
|
-
}
|
141
|
-
.highlight .sc {
|
142
|
-
color: #4df4ff;
|
143
|
-
font-weight: bold;
|
144
|
-
}
|
145
|
-
.highlight .si {
|
146
|
-
color: #4df4ff;
|
147
|
-
font-weight: bold;
|
148
|
-
}
|
149
|
-
.highlight .nb {
|
150
|
-
font-weight: bold;
|
151
|
-
}
|
152
|
-
.highlight .ni {
|
153
|
-
color: #999999;
|
154
|
-
font-weight: bold;
|
155
|
-
}
|
156
|
-
.highlight .w {
|
157
|
-
color: #BBBBBB;
|
158
|
-
}
|
159
|
-
.highlight .nf {
|
160
|
-
color: #a8e1fe;
|
161
|
-
}
|
162
|
-
.highlight .py {
|
163
|
-
color: #a8e1fe;
|
164
|
-
}
|
165
|
-
.highlight .na {
|
166
|
-
color: #a8e1fe;
|
167
|
-
}
|
168
|
-
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi {
|
169
|
-
color: #a8e1fe;
|
170
|
-
font-weight: bold;
|
171
|
-
}
|
172
|
-
</style>
|
173
|
-
</head>
|
174
|
-
<body>
|
175
|
-
|
176
|
-
<h1>Sample</h1>
|
177
|
-
|
178
|
-
<pre class="highlight">
|
1
|
+
|
2
|
+
require 'oekaki'
|
3
|
+
include Math
|
179
4
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
<span class="no">L</span> <span class="o">=</span> <span class="mi">400</span>
|
184
|
-
<span class="no">R1</span> <span class="o">=</span> <span class="mi">150</span><span class="p">;</span> <span class="no">R2</span> <span class="o">=</span> <span class="p">(</span><span class="no">L</span> <span class="o">-</span> <span class="no">R1</span> <span class="o">*</span> <span class="mi">2</span><span class="p">)</span> <span class="o">/</span> <span class="mi">2</span> <span class="o">-</span> <span class="mi">5</span>
|
185
|
-
<span class="no">STP1</span> <span class="o">=</span> <span class="p">(</span><span class="no">PI</span> <span class="o">/</span> <span class="mi">180</span><span class="p">)</span> <span class="o">*</span> <span class="mi">0</span><span class="o">.</span><span class="mi">5</span><span class="p">;</span> <span class="no">STP2</span> <span class="o">=</span> <span class="p">(</span><span class="no">PI</span> <span class="o">/</span> <span class="mi">180</span><span class="p">)</span> <span class="o">*</span> <span class="mi">10</span>
|
186
|
-
|
187
|
-
<span class="no">Oekaki</span><span class="p">.</span><span class="nf">app</span> <span class="ss">width: </span><span class="no">L</span><span class="p">,</span> <span class="ss">height: </span><span class="no">L</span> <span class="k">do</span>
|
188
|
-
<span class="n">draw</span> <span class="k">do</span>
|
189
|
-
<span class="n">color</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
190
|
-
<span class="n">rectangle</span><span class="p">(</span><span class="kp">true</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="no">L</span><span class="p">,</span> <span class="no">L</span><span class="p">)</span>
|
191
|
-
<span class="k">end</span>
|
192
|
-
|
193
|
-
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
|
5
|
+
L = 400
|
6
|
+
R1 = 150; R2 = (L - R1 * 2) / 2 - 5
|
7
|
+
STP1 = (PI / 180) * 0.5; STP2 = (PI / 180) * 10
|
194
8
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
|
201
|
-
<span class="k">end</span>
|
9
|
+
Oekaki.app width: L, height: L do
|
10
|
+
draw do
|
11
|
+
color(0, 0, 0)
|
12
|
+
rectangle(true, 0, 0, L, L)
|
13
|
+
end
|
202
14
|
|
203
|
-
|
204
|
-
<span class="no">Gtk</span><span class="p">.</span><span class="nf">main_quit</span> <span class="k">if</span> <span class="n">e</span><span class="p">.</span><span class="nf">keyval</span> <span class="o">==</span> <span class="no">Gdk</span><span class="o">::</span><span class="no">Keyval</span><span class="o">::</span><span class="no">GDK_Return</span>
|
205
|
-
<span class="k">end</span>
|
206
|
-
<span class="k">end</span>
|
207
|
-
|
208
|
-
</pre>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
<pre class="highlight">
|
214
|
-
|
215
|
-
<span class="nb">require</span> <span class="s1">'oekaki'</span>
|
216
|
-
|
217
|
-
<span class="no">Oekaki</span><span class="p">.</span><span class="nf">app</span> <span class="ss">width: </span><span class="mi">300</span><span class="p">,</span> <span class="ss">height: </span><span class="mi">300</span> <span class="k">do</span>
|
218
|
-
<span class="n">draw</span> <span class="k">do</span>
|
219
|
-
<span class="n">white</span> <span class="o">=</span> <span class="n">color</span><span class="p">(</span><span class="mi">65535</span><span class="p">,</span> <span class="mi">65535</span><span class="p">,</span> <span class="mi">65535</span><span class="p">)</span>
|
220
|
-
<span class="n">red</span> <span class="o">=</span> <span class="n">color</span><span class="p">(</span><span class="mi">65535</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
221
|
-
<span class="n">blue</span> <span class="o">=</span> <span class="n">color</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">65535</span><span class="p">)</span>
|
15
|
+
i = 0
|
222
16
|
|
223
|
-
|
17
|
+
timer(20) do
|
18
|
+
x = L / 2 + (R1 * cos(STP1 * i) + R2 * cos(STP2 * i))
|
19
|
+
y = L / 2 - (R1 * sin(STP1 * i) + R2 * sin(STP2 * i))
|
20
|
+
color(0, 65535, 0)
|
21
|
+
arc(false, x, y, 3, 3, 0, 64 * 360)
|
22
|
+
i += 1
|
23
|
+
end
|
224
24
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
<span class="n">save_pic</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="s2">"sample.png"</span><span class="p">)</span> <span class="c1">#画像ファイルに保存</span>
|
233
|
-
<span class="k">end</span>
|
234
|
-
<span class="k">end</span>
|
235
|
-
|
236
|
-
</pre>
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
<pre class="highlight">
|
25
|
+
key_in do |w, e|
|
26
|
+
Gtk.main_quit if e.keyval == Gdk::Keyval::GDK_Return
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
require 'oekaki'
|
241
32
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
33
|
+
Oekaki.app width: 300, height: 300 do
|
34
|
+
draw do
|
35
|
+
white = color(65535, 65535, 65535)
|
36
|
+
red = color(65535, 0, 0)
|
37
|
+
blue = color(0, 0, 65535)
|
38
|
+
|
39
|
+
rectangle(true, 0, 0, 300, 300, white)
|
40
|
+
|
41
|
+
ar = []
|
42
|
+
50.times {ar << [rand(300), rand(300)]} #線の数は50本(配列に座標を入れる)
|
43
|
+
polygon(true, ar, blue) #多角形を描く
|
44
|
+
|
45
|
+
text("Polygon", 180, 260, 20 * 1000, red) #文字列を描く
|
46
|
+
|
47
|
+
img = get_pic(0, 0, 300, 300) #画像の取り込み
|
48
|
+
save_pic(img, "sample.png") #画像ファイルに保存
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
require 'oekaki'
|
262
54
|
|
263
|
-
|
264
|
-
<span class="no">Gtk</span><span class="p">.</span><span class="nf">main_quit</span> <span class="k">if</span> <span class="n">e</span><span class="p">.</span><span class="nf">keyval</span> <span class="o">==</span> <span class="no">Gdk</span><span class="o">::</span><span class="no">Keyval</span><span class="o">::</span><span class="no">GDK_Return</span>
|
265
|
-
<span class="k">end</span>
|
55
|
+
L = 400
|
266
56
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
57
|
+
Oekaki.app width: L, height: L, title: "Circle Fall" do
|
58
|
+
timer(10) do
|
59
|
+
show = proc do |y|
|
60
|
+
x = rand(L - 10)
|
61
|
+
color(rand(65535), rand(65535), rand(65535))
|
62
|
+
arc(true, x, y, 10, 10, 0, 64 * 360)
|
63
|
+
end
|
64
|
+
|
65
|
+
show.call(0) if rand < 0.15
|
66
|
+
show.call(rand(L - 10)) if rand < 0.05
|
67
|
+
|
68
|
+
img = get_pic(0, 0, L, L)
|
69
|
+
show_pic(img, 0, 1)
|
70
|
+
color(0, 0, 0)
|
71
|
+
rectangle(true, 0, 0, L, 1)
|
72
|
+
end
|
73
|
+
|
74
|
+
key_in do |w, e|
|
75
|
+
Gtk.main_quit if e.keyval == Gdk::Keyval::GDK_Return
|
76
|
+
end
|
77
|
+
|
78
|
+
draw do
|
79
|
+
color(0, 0, 0)
|
80
|
+
rectangle(true, 0, 0, L, L)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
281
84
|
|