From a9221abd8f8826e6a71435c631901cad1342401b Mon Sep 17 00:00:00 2001 From: Luke Iannini Date: Sun, 1 Feb 2009 07:58:46 +0000 Subject: added initial prototype of a complex-shape drawing app (for creating the coordinate lists used by [drawpolygon] and friends) svn path=/trunk/abstractions/ds-gui/; revision=10709 --- ds-designer-help.pd | 6 + ds-designer.pd | 364 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 370 insertions(+) create mode 100644 ds-designer-help.pd create mode 100644 ds-designer.pd diff --git a/ds-designer-help.pd b/ds-designer-help.pd new file mode 100644 index 0000000..c396379 --- /dev/null +++ b/ds-designer-help.pd @@ -0,0 +1,6 @@ +#N canvas 346 399 450 300 10; +#X obj 48 133 ds-designer; +#X text 9 20 ds-designer: a tool for drawing complex shapes with [drawpolygon]/[filledpolygon]/[drawcurve]/[filledcurve] +; +#X text 252 252 2009 Luke Iannini; +#X text 257 267 proyekto.net; diff --git a/ds-designer.pd b/ds-designer.pd new file mode 100644 index 0000000..dd2b067 --- /dev/null +++ b/ds-designer.pd @@ -0,0 +1,364 @@ +#N struct 1002.vertex.array.template float x float y array vertex.array +1002.vertex.template; +#N struct 1002.vertex.template float x float y float vert.x float vert.y +; +#N struct 1002.intersection.template float x float y float vert.x float +vert.y; +#N struct 1002.grid.y.template float y; +#N struct 1002.grid.x.template float x; +#N canvas 916 311 479 259 10; +#N canvas 400 22 515 519 \$0.canvas 1; +#X scalar 1002.vertex.array.template 0 0 \; 100 50 2 1 \; 150 100 3 +2 \; 200 50 4 1 \; 250 100 5 2 \; 200 150 4 3 \; 250 200 5 4 \; 200 +250 4 5 \; 150 200 3 4 \; 100 250 2 5 \; 50 200 1 4 \; 100 150 2 3 +\; 50 100 1 2 \; \;; +#X scalar 1002.intersection.template 0 0 0 0 \;; +#X scalar 1002.intersection.template 50 0 1 0 \;; +#X scalar 1002.intersection.template 100 0 2 0 \;; +#X scalar 1002.intersection.template 150 0 3 0 \;; +#X scalar 1002.intersection.template 200 0 4 0 \;; +#X scalar 1002.intersection.template 250 0 5 0 \;; +#X scalar 1002.intersection.template 300 0 6 0 \;; +#X scalar 1002.intersection.template 350 0 7 0 \;; +#X scalar 1002.intersection.template 400 0 8 0 \;; +#X scalar 1002.intersection.template 450 0 9 0 \;; +#X scalar 1002.intersection.template 0 50 0 1 \;; +#X scalar 1002.intersection.template 50 50 1 1 \;; +#X scalar 1002.intersection.template 100 50 2 1 \;; +#X scalar 1002.intersection.template 150 50 3 1 \;; +#X scalar 1002.intersection.template 200 50 4 1 \;; +#X scalar 1002.intersection.template 250 50 5 1 \;; +#X scalar 1002.intersection.template 300 50 6 1 \;; +#X scalar 1002.intersection.template 350 50 7 1 \;; +#X scalar 1002.intersection.template 400 50 8 1 \;; +#X scalar 1002.intersection.template 450 50 9 1 \;; +#X scalar 1002.intersection.template 0 100 0 2 \;; +#X scalar 1002.intersection.template 50 100 1 2 \;; +#X scalar 1002.intersection.template 100 100 2 2 \;; +#X scalar 1002.intersection.template 150 100 3 2 \;; +#X scalar 1002.intersection.template 200 100 4 2 \;; +#X scalar 1002.intersection.template 250 100 5 2 \;; +#X scalar 1002.intersection.template 300 100 6 2 \;; +#X scalar 1002.intersection.template 350 100 7 2 \;; +#X scalar 1002.intersection.template 400 100 8 2 \;; +#X scalar 1002.intersection.template 450 100 9 2 \;; +#X scalar 1002.intersection.template 0 150 0 3 \;; +#X scalar 1002.intersection.template 50 150 1 3 \;; +#X scalar 1002.intersection.template 100 150 2 3 \;; +#X scalar 1002.intersection.template 150 150 3 3 \;; +#X scalar 1002.intersection.template 200 150 4 3 \;; +#X scalar 1002.intersection.template 250 150 5 3 \;; +#X scalar 1002.intersection.template 300 150 6 3 \;; +#X scalar 1002.intersection.template 350 150 7 3 \;; +#X scalar 1002.intersection.template 400 150 8 3 \;; +#X scalar 1002.intersection.template 450 150 9 3 \;; +#X scalar 1002.intersection.template 0 200 0 4 \;; +#X scalar 1002.intersection.template 50 200 1 4 \;; +#X scalar 1002.intersection.template 100 200 2 4 \;; +#X scalar 1002.intersection.template 150 200 3 4 \;; +#X scalar 1002.intersection.template 200 200 4 4 \;; +#X scalar 1002.intersection.template 250 200 5 4 \;; +#X scalar 1002.intersection.template 300 200 6 4 \;; +#X scalar 1002.intersection.template 350 200 7 4 \;; +#X scalar 1002.intersection.template 400 200 8 4 \;; +#X scalar 1002.intersection.template 450 200 9 4 \;; +#X scalar 1002.intersection.template 0 250 0 5 \;; +#X scalar 1002.intersection.template 50 250 1 5 \;; +#X scalar 1002.intersection.template 100 250 2 5 \;; +#X scalar 1002.intersection.template 150 250 3 5 \;; +#X scalar 1002.intersection.template 200 250 4 5 \;; +#X scalar 1002.intersection.template 250 250 5 5 \;; +#X scalar 1002.intersection.template 300 250 6 5 \;; +#X scalar 1002.intersection.template 350 250 7 5 \;; +#X scalar 1002.intersection.template 400 250 8 5 \;; +#X scalar 1002.intersection.template 450 250 9 5 \;; +#X scalar 1002.intersection.template 0 300 0 6 \;; +#X scalar 1002.intersection.template 50 300 1 6 \;; +#X scalar 1002.intersection.template 100 300 2 6 \;; +#X scalar 1002.intersection.template 150 300 3 6 \;; +#X scalar 1002.intersection.template 200 300 4 6 \;; +#X scalar 1002.intersection.template 250 300 5 6 \;; +#X scalar 1002.intersection.template 300 300 6 6 \;; +#X scalar 1002.intersection.template 350 300 7 6 \;; +#X scalar 1002.intersection.template 400 300 8 6 \;; +#X scalar 1002.intersection.template 450 300 9 6 \;; +#X scalar 1002.intersection.template 0 350 0 7 \;; +#X scalar 1002.intersection.template 50 350 1 7 \;; +#X scalar 1002.intersection.template 100 350 2 7 \;; +#X scalar 1002.intersection.template 150 350 3 7 \;; +#X scalar 1002.intersection.template 200 350 4 7 \;; +#X scalar 1002.intersection.template 250 350 5 7 \;; +#X scalar 1002.intersection.template 300 350 6 7 \;; +#X scalar 1002.intersection.template 350 350 7 7 \;; +#X scalar 1002.intersection.template 400 350 8 7 \;; +#X scalar 1002.intersection.template 450 350 9 7 \;; +#X scalar 1002.intersection.template 0 400 0 8 \;; +#X scalar 1002.intersection.template 50 400 1 8 \;; +#X scalar 1002.intersection.template 100 400 2 8 \;; +#X scalar 1002.intersection.template 150 400 3 8 \;; +#X scalar 1002.intersection.template 200 400 4 8 \;; +#X scalar 1002.intersection.template 250 400 5 8 \;; +#X scalar 1002.intersection.template 300 400 6 8 \;; +#X scalar 1002.intersection.template 350 400 7 8 \;; +#X scalar 1002.intersection.template 400 400 8 8 \;; +#X scalar 1002.intersection.template 450 400 9 8 \;; +#X scalar 1002.intersection.template 0 450 0 9 \;; +#X scalar 1002.intersection.template 50 450 1 9 \;; +#X scalar 1002.intersection.template 100 450 2 9 \;; +#X scalar 1002.intersection.template 150 450 3 9 \;; +#X scalar 1002.intersection.template 200 450 4 9 \;; +#X scalar 1002.intersection.template 250 450 5 9 \;; +#X scalar 1002.intersection.template 300 450 6 9 \;; +#X scalar 1002.intersection.template 350 450 7 9 \;; +#X scalar 1002.intersection.template 400 450 8 9 \;; +#X scalar 1002.intersection.template 450 450 9 9 \;; +#X scalar 1002.grid.y.template 0 \;; +#X scalar 1002.grid.y.template 50 \;; +#X scalar 1002.grid.y.template 100 \;; +#X scalar 1002.grid.y.template 150 \;; +#X scalar 1002.grid.y.template 200 \;; +#X scalar 1002.grid.y.template 250 \;; +#X scalar 1002.grid.y.template 300 \;; +#X scalar 1002.grid.y.template 350 \;; +#X scalar 1002.grid.y.template 400 \;; +#X scalar 1002.grid.y.template 450 \;; +#X scalar 1002.grid.x.template 0 \;; +#X scalar 1002.grid.x.template 50 \;; +#X scalar 1002.grid.x.template 100 \;; +#X scalar 1002.grid.x.template 150 \;; +#X scalar 1002.grid.x.template 200 \;; +#X scalar 1002.grid.x.template 250 \;; +#X scalar 1002.grid.x.template 300 \;; +#X scalar 1002.grid.x.template 350 \;; +#X scalar 1002.grid.x.template 400 \;; +#X scalar 1002.grid.x.template 450 \;; +#X restore 40 29 pd \$0.canvas; +#N canvas 738 215 412 554 grid 0; +#X obj 138 151 ds-begin pd-\$0.canvas; +#X obj 82 171 f; +#X obj 107 171 + 1; +#X obj 82 143 until; +#X msg 82 114 10; +#X obj 82 225 append \$0.grid.x.template x; +#X obj 110 254 append \$0.grid.y.template y; +#X msg 137 114 0; +#X msg 187 70 clear; +#X obj 187 101 s pd-\$0.canvas; +#X obj 206 381 ds-begin pd-\$0.canvas; +#X obj 35 380 f; +#X obj 60 380 + 1; +#X obj 35 359 until; +#X msg 205 344 0; +#X obj 35 317 t b b b; +#X msg 35 338 100; +#X obj 35 425 t a a; +#X obj 82 87 t b b b b; +#X obj 36 476 t a a; +#X obj 35 505 append \$0.intersection.template x y vert.x vert.y; +#X obj 35 401 * 50; +#X obj 82 193 * 50; +#X obj 35 451 mod 500; +#X obj 86 475 / 50; +#X obj 155 477 * 50; +#X obj 155 451 div 500; +#X obj 35 9 inlet; +#X obj 122 315 s \$0.init-canvas; +#X obj 66 30 loadbang; +#X obj 35 46 t b b; +#X obj 250 22 loadbang; +#X msg 250 48 vis 1; +#X obj 77 9 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X connect 0 0 5 1; +#X connect 0 0 6 1; +#X connect 1 0 2 0; +#X connect 1 0 22 0; +#X connect 2 0 1 1; +#X connect 3 0 1 0; +#X connect 4 0 3 0; +#X connect 7 0 1 1; +#X connect 8 0 9 0; +#X connect 10 0 20 4; +#X connect 11 0 12 0; +#X connect 11 0 21 0; +#X connect 12 0 11 1; +#X connect 13 0 11 0; +#X connect 14 0 11 1; +#X connect 15 0 16 0; +#X connect 15 1 10 0; +#X connect 15 2 14 0; +#X connect 15 2 28 0; +#X connect 16 0 13 0; +#X connect 17 0 23 0; +#X connect 17 1 26 0; +#X connect 18 0 4 0; +#X connect 18 1 0 0; +#X connect 18 2 7 0; +#X connect 18 3 8 0; +#X connect 19 0 20 0; +#X connect 19 1 24 0; +#X connect 21 0 17 0; +#X connect 22 0 5 0; +#X connect 22 0 6 0; +#X connect 23 0 19 0; +#X connect 24 0 20 2; +#X connect 25 0 20 1; +#X connect 26 0 20 3; +#X connect 26 0 25 0; +#X connect 27 0 30 0; +#X connect 29 0 30 0; +#X connect 30 0 15 0; +#X connect 30 1 18 0; +#X connect 31 0 32 0; +#X connect 32 0 9 0; +#X connect 33 0 30 0; +#X restore 250 186 pd grid; +#N canvas 853 469 450 300 \$0.grid.x.template 0; +#X obj 53 55 struct \$0.grid.x.template float x; +#X obj 54 113 drawpolygon 0 1 0 0 0 500; +#X restore 233 27 pd \$0.grid.x.template; +#N canvas 853 450 450 300 \$0.grid.y.template 0; +#X obj 53 55 struct \$0.grid.y.template float y; +#X obj 53 83 drawpolygon 0 1 0 0 500 0; +#X restore 233 47 pd \$0.grid.y.template; +#N canvas 621 85 450 300 \$0.vertex.template 0; +#X obj 15 55 route click; +#X obj 15 107 get \$0.vertex.template vert.x vert.y; +#X obj 15 19 struct \$0.vertex.template float x float y float vert.x +float vert.y; +#X obj 86 247 filledpolygon 990 909 1 -2 -2 2 -2 2 2 -2 2 -2 -2; +#X obj 30 80 print; +#X connect 2 0 0 0; +#X connect 2 0 4 0; +#X restore 234 97 pd \$0.vertex.template; +#N canvas 155 354 450 300 \$0.vertex.array.template 0; +#X obj 8 26 struct \$0.vertex.array.template float x float y array +vertex.array \$0.vertex.template; +#X obj 18 177 plot curve vertex.array 9 2 0 0; +#X obj 18 217 plot vertex.array 9 2 0 0; +#X obj 12 73 r \$0.curved?.s; +#X obj 12 96 sel 0 1; +#X msg 42 125 0; +#X msg 42 144 1; +#X msg 82 125 0; +#X msg 82 144 1; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 4 0 6 0; +#X connect 4 1 7 0; +#X connect 4 1 8 0; +#X connect 5 0 1 0; +#X connect 6 0 2 0; +#X connect 7 0 2 0; +#X connect 8 0 1 0; +#X restore 234 117 pd \$0.vertex.array.template; +#N canvas 688 22 450 300 \$0.intersection.template 0; +#X obj 15 55 route click; +#X obj 15 19 struct \$0.intersection.template float x float y float +vert.x float vert.y; +#X text 114 56 click an intersection to spawn a vertex; +#X obj 15 78 s \$0.spawn-vertex; +#X obj 86 246 filledpolygon 900 90 1 -4 -4 4 -4 4 4 -4 4 -4 -4; +#X connect 0 0 3 0; +#X connect 1 0 0 0; +#X restore 234 67 pd \$0.intersection.template; +#N canvas 332 236 1076 560 spawn-vertex 0; +#X obj 15 21 r \$0.spawn-vertex; +#X obj 306 194 getsize \$0.vertex.array.template vertex.array; +#X obj 306 257 setsize \$0.vertex.array.template vertex.array; +#X obj 306 171 t a a; +#X obj 306 235 + 1; +#X obj 194 155 t a a; +#X obj 194 295 element \$0.vertex.array.template vertex.array; +#X obj 194 239 t b a; +#X obj 194 272 f; +#X obj 194 134 ds-first pd-\$0.canvas \$0.vertex.array.template; +#X obj 15 347 get \$0.intersection.template x y vert.x vert.y; +#X obj 15 429 set \$0.vertex.template x y vert.x vert.y; +#X obj 15 394 pack f f f f; +#X obj 682 244 append \$0.vertex.array.template x y; +#X msg 682 218 0 0; +#X obj 779 218 ds-begin pd-\$0.canvas; +#X obj 682 189 t b b; +#X msg 682 298 0; +#X obj 682 270 t b a; +#X obj 15 50 t a b; +#X obj 682 322 element \$0.vertex.array.template vertex.array; +#X obj 645 150 once; +#X obj 681 122 r \$0.init-canvas; +#X connect 0 0 19 0; +#X connect 1 0 4 0; +#X connect 3 0 1 0; +#X connect 3 1 2 1; +#X connect 4 0 2 0; +#X connect 4 0 8 1; +#X connect 5 0 7 0; +#X connect 5 1 3 0; +#X connect 6 0 11 4; +#X connect 7 0 8 0; +#X connect 7 1 6 1; +#X connect 8 0 6 0; +#X connect 9 0 5 0; +#X connect 9 1 21 0; +#X connect 10 0 12 0; +#X connect 10 1 12 1; +#X connect 10 2 12 2; +#X connect 10 3 12 3; +#X connect 12 0 11 0; +#X connect 13 0 18 0; +#X connect 14 0 13 0; +#X connect 15 0 13 2; +#X connect 16 0 14 0; +#X connect 16 1 15 0; +#X connect 17 0 20 0; +#X connect 18 0 17 0; +#X connect 18 1 20 1; +#X connect 19 0 10 0; +#X connect 19 1 9 0; +#X connect 20 0 11 4; +#X connect 21 0 16 0; +#X connect 22 0 21 1; +#X restore 234 142 pd spawn-vertex; +#X msg 45 208 10 0 20 10 30 0 40 10 30 20 40 30 30 40 20 30 10 40 0 +30 10 20 0 10; +#X obj 250 167 bng 15 250 50 0 empty empty reset-drawing 17 7 0 10 +-262144 -1 -1; +#N canvas 0 22 453 392 generate-coordlist 0; +#X obj 26 50 inlet; +#X obj 26 133 ds-dump-array \$0.vertex.array.template vertex.array +; +#X obj 26 167 get \$0.vertex.template vert.x vert.y; +#X msg 26 299 add2 \$1 \$2; +#X obj 26 206 pack f f; +#X obj 26 99 ds-first pd-\$0.canvas \$0.vertex.array.template; +#X obj 26 262 list-apply * 1; +#X floatatom 139 263 5 0 0 0 - - -; +#X obj 26 78 t a b; +#X msg 68 78 set; +#X obj 26 241 list-apply + 0; +#X msg 139 241 -1; +#X text 168 239 diag-offset; +#X obj 25 339 outlet; +#X text 181 263 scaling; +#X connect 0 0 8 0; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 4 1; +#X connect 3 0 13 0; +#X connect 4 0 10 0; +#X connect 5 0 1 0; +#X connect 6 0 3 0; +#X connect 7 0 6 2; +#X connect 8 0 5 0; +#X connect 8 1 9 0; +#X connect 9 0 13 0; +#X connect 10 0 6 0; +#X connect 11 0 10 2; +#X restore 45 144 pd generate-coordlist; +#X obj 46 119 bng 15 250 50 0 empty empty get-points 17 7 0 10 -262144 +-1 -1; +#X obj 46 73 tgl 15 0 \$0.curved?.s \$0.curved?.r curved? 17 7 0 10 +-262144 -1 -1 0 1; +#X connect 9 0 1 0; +#X connect 10 0 8 0; +#X connect 11 0 10 0; -- cgit v1.2.1