Commit b0d554fa authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

add metadata for data structure [draw] tutorials

parent 88d46a43
#N struct working-man-scalar float x float y;
#N canvas 0 19 895 618 10;
#N canvas 1 25 895 618 10;
#N canvas 195 124 671 300 template 1;
#X obj 121 -2492 struct working-man-scalar float x float y;
#N canvas 725 143 450 300 init 0;
......@@ -260,10 +260,18 @@ for drawing instructions \, but that isn't supported at the moment.
;
#X text 43 570 * scalar bbox caching. Should give more control to the
user as with mouse-dragging.;
#X text 480 503 * way to reset an svg attribute. Probably by just sending
a message with no arguments (not sure if tkpath supports this yet)
;
#X text 480 313 New:;
#X text 480 333 * messages to set path data \, polygon points \, x
\, y \, cx \, cy \, r \, height \, width \, etc.;
#X text 480 373 Needed:;
#N canvas 290 275 450 300 META 0;
#X text 16 6 KEYWORDS tutorial data_structure draw;
#X text 16 26 LICENSE SIBSD;
#X text 16 46 DESCRIPTION overview of svg-based data structure drawing
commands;
#X text 16 76 AUTHOR Jonathan Wilkes;
#X text 16 96 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X restore 771 580 pd META;
#X text 480 502 * way to reset an svg attribute. Probably by just sending
a message with no arguments (not sure if tkpath supports this yet)
;
#N struct foo float x float y;
#N canvas 230 130 565 491 10;
#N canvas 1 25 565 491 10;
#X scalar foo 96 105 \;;
#N canvas 429 132 808 465 welcome-animation 0;
#X obj 147 7 bng 54 250 50 0 empty empty empty 17 7 0 10 -262144 -1
......@@ -739,5 +739,12 @@ concepts. (Even the animation above doesn't use any pointers.);
#X connect 25 0 22 0;
#X restore 339 106 pd sfx~;
#X obj 339 127 output~;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION short demo of the [draw] command;
#X restore 502 455 pd META;
#X connect 6 0 1 0;
#X connect 11 0 12 0;
#N struct drawtut-one float x float y;
#N canvas 87 38 495 603 10;
#N canvas 1 25 495 603 10;
#X text 0 1 New Drawing Commands: draw;
#X text 0 1 __________________________;
#X obj 53 47 struct drawtut-one float x float y;
......@@ -40,3 +40,10 @@ defined here. To keep things organized Pd expects there to be only
one [struct] object per canvas. That way it's simple to know which
[draw] commands go with which data structure.;
#X text 178 218 <- rectangle \, 40x40 pixels at offset (0 \, 0);
#N canvas 291 300 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION introducing the [draw] command;
#X restore 435 575 pd META;
#N struct drawtut-rect float x float y;
#N canvas 15 32 515 614 10;
#N canvas 1 25 515 614 10;
#X text 0 1 __________________________;
#X text 0 1 New Drawing Commands: rect;
#X obj 53 87 struct drawtut-rect float x float y;
......@@ -34,3 +34,11 @@ to integers.);
The first two are the width and height of the rectangle. The third
and fourth arguments are the x/y coordinates of the top-left corner
of the rectangle. That's it!;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing a rectangle with the [draw] command
;
#X restore 446 583 pd META;
#N struct drawtut-attr float x float y;
#N canvas 13 25 517 671 10;
#N canvas 1 25 517 671 10;
#X text 0 1 New Drawing Commands: attributes;
#X text 0 1 ________________________________;
#X text 53 23 Our shapes are pretty boring so far. Black lines around
......@@ -40,6 +40,13 @@ for all scalars created from this [struct]. Later you will see how
to set attributes to be different for each scalar.;
#X msg 123 252 fill green;
#X obj 53 313 draw rect 50 50 0 0;
#N canvas 291 300 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION basic attributes for the [draw] command;
#X restore 450 639 pd META;
#X connect 8 0 19 0;
#X connect 15 0 16 0;
#X connect 16 0 19 0;
......
#N struct drawtut-attr-cont float x float y;
#N canvas 194 25 638 671 10;
#N canvas 1 25 638 671 10;
#X msg 93 112 fill red;
#X text 0 1 New Drawing Commands: attributes (continued);
#X text 0 1 ____________________________________________;
......@@ -51,6 +51,14 @@ the appearance of a shape:;
#X obj 93 85 loadbang;
#X obj 161 533 * 0.5;
#X obj 93 583 draw rect 50 50 0 0;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 76 AUTHOR Jonathan Wilkes;
#X text 16 96 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION more detail about display attributes with
the [draw] command;
#X restore 573 640 pd META;
#X connect 0 0 42 0;
#X connect 8 0 42 0;
#X connect 10 0 12 0;
......
#N struct drawtut-attr-saving float x float y;
#N canvas 194 100 638 551 10;
#N canvas 1 25 638 551 10;
#X text 0 1 New Drawing Commands: attributes (continued);
#X text 0 1 ____________________________________________;
#X text 53 23 Saving attributes is fairly straightforward using message
......@@ -22,5 +22,13 @@ each scalar.;
#X text 228 280 <- Create another scalar in the empty object box by
typing the struct name "drawtut-attr-saving" into it.;
#X obj 53 153 draw rect 50 50 0 0;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 76 AUTHOR Jonathan Wilkes;
#X text 16 96 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION specifying display attributes with the [draw]
command;
#X restore 573 520 pd META;
#X connect 3 0 6 0;
#X connect 6 0 11 0;
#N struct drawtut-line float x float y;
#N canvas 31 34 638 634 10;
#N canvas 1 25 638 634 10;
#X obj 53 84 loadbang;
#X text 0 1 New Drawing Commands: line;
#X text 0 1 __________________________;
......@@ -30,6 +30,13 @@ past the end point.;
#X text 173 138 rounded;
#X text 258 138 square;
#X msg 53 107 stroke blue \, stroke-width 15;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing a line with the [draw] command;
#X restore 567 601 pd META;
#X connect 0 0 21 0;
#X connect 10 0 5 0;
#X connect 15 0 10 0;
......
#N struct drawtut-circle float x float y;
#N canvas 13 29 638 554 10;
#N canvas 1 25 638 554 10;
#X msg 143 117 stroke blue;
#X text 52 484 Lines are only a single stroke. They don't have any
inner area to fill \, so none of the messages like "fill" or "fill-rule"
......@@ -21,6 +21,14 @@ by value you use for the radius. (That would be [draw circle 80 80
#X obj 53 153 draw circle 80 0 0;
#X text 52 374 The [draw] object above creates a circle with a radius
of 80 pixels \, with the center of the circle at (0 \, 0).;
#N canvas 291 300 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing a circle with the [draw] command
;
#X restore 568 522 pd META;
#X connect 0 0 12 0;
#X connect 8 0 12 0;
#X connect 9 0 12 0;
......
#N struct drawtut-ellipse float x float y;
#N canvas 1 25 509 498 10;
#N canvas 3 25 509 498 10;
#X msg 141 117 stroke blue;
#X msg 54 117 fill yellow;
#X msg 228 117 stroke-width \$1;
......@@ -18,6 +18,14 @@ values \, respectively. (So the one above would be [draw ellipse 86
#X obj 53 153 draw ellipse 86 42 0 0;
#X text 52 334 The [draw] object above creates an ellipse with an x-radius
of 86 and a y-radius of 42 \, centered at (0 \, 0).;
#N canvas 291 300 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing an ellipse with the [draw] command
;
#X restore 445 465 pd META;
#X connect 0 0 11 0;
#X connect 1 0 11 0;
#X connect 2 0 11 0;
......
#N struct drawtut-polyline float x float y;
#N canvas 0 19 532 554 10;
#N canvas 1 25 532 554 10;
#X msg 228 137 stroke-width \$1;
#X floatatom 228 116 5 0 0 0 - - -, f 5;
#X text 0 1 New Drawing Commands: polyline;
......@@ -29,6 +29,14 @@ the [draw] object quite powerful.;
#X obj 53 103 loadbang;
#X obj 440 114 * 0.001;
#X msg 440 72 300;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing a polyline with the [draw] command
;
#X restore 464 521 pd META;
#X connect 0 0 6 0;
#X connect 1 0 0 0;
#X connect 9 0 19 0;
......
#N struct drawtut-polygon float x float y;
#N canvas 0 19 845 575 10;
#N canvas 1 25 845 575 10;
#X msg 53 117 stroke blue;
#X msg 142 117 fill yellow;
#X msg 228 117 stroke-width \$1;
......@@ -26,6 +26,14 @@ for how to fill overlapping areas.;
#X text 517 57 nonzero;
#X text 527 87 evenodd;
#X msg 442 86 fill-rule 1;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing polygons with the [draw] command
;
#X restore 780 544 pd META;
#X connect 0 0 9 0;
#X connect 1 0 9 0;
#X connect 2 0 9 0;
......
#N struct drawtut-path float x float y;
#N canvas 0 19 850 556 10;
#N canvas 1 25 850 556 10;
#X text 0 1 New Drawing Commands: path;
#X text 1 1 __________________________;
#X text 53 23 Paths are complex drawings.;
......@@ -36,5 +36,13 @@ each letter.;
curves doesn't work as precisely as it should. This means some paths
may extend past the edges of the selection rectangle in Pd. (Like the
bottom of the "O" in the example above;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION drawing paths to display data structure data
;
#X restore 776 520 pd META;
#X connect 5 0 11 0;
#X connect 7 0 5 0;
#N struct drawtut-transform float x float y;
#N canvas 80 106 867 589 10;
#N canvas 22 32 867 625 10;
#X text 0 1 New Drawing Commands: transform;
#X text 1 1 _______________________________;
#X text 53 23 All [draw] objects understand the "transform" message.
It allows you to do affine transformations on shapes.;
#X text 53 83 Let's start with a simple rectangle:;
#X floatatom 57 187 5 0 0 0 x/y - -, f 5;
#X scalar drawtut-transform 197 449 \;;
#X floatatom 97 187 5 0 0 0 - - -, f 5;
#X obj 97 208 t b a;
#X floatatom 177 187 5 0 0 0 rotate - -, f 5;
#X obj 177 208 t b a;
#X floatatom 257 167 5 0 0 0 scale - -, f 5;
#X obj 257 208 t b a;
#X floatatom 337 167 5 -100 100 0 skewx - -, f 5;
#X obj 337 208 t b a;
#X floatatom 407 167 5 -100 100 0 skewy - -, f 5;
#X obj 407 208 t b a;
#X floatatom 127 315 5 0 0 0 - - -, f 5;
#X msg 127 336 transform rotate \$1 50 20;
#X text 447 449 For "scale" \, you can either specify a single value
#X floatatom 57 173 5 0 0 0 x/y - -, f 5;
#X scalar drawtut-transform 197 435 \;;
#X floatatom 97 173 5 0 0 0 - - -, f 5;
#X obj 97 194 t b a;
#X floatatom 177 173 5 0 0 0 rotate - -, f 5;
#X obj 177 194 t b a;
#X floatatom 257 153 5 0 0 0 scale - -, f 5;
#X obj 257 194 t b a;
#X floatatom 337 153 5 -100 100 0 skewx - -, f 5;
#X obj 337 194 t b a;
#X floatatom 407 153 5 -100 100 0 skewy - -, f 5;
#X obj 407 194 t b a;
#X floatatom 127 301 5 0 0 0 - - -, f 5;
#X msg 127 322 transform rotate \$1 50 20;
#X text 447 435 For "scale" \, you can either specify a single value
to applied to both the x- and y-axis \, or one value for each. For
rotation \, you can supply an additional x/y coordinate to specify
the center of rotation. An example is in the second message box above.
;
#X text 57 529 After the word "transform" \, you specify the name of
#X text 57 515 After the word "transform" \, you specify the name of
the affine transformation you'd like to apply. All are shown above.
Pd then takes them and applies them in the order you specified.;
#X msg 127 362 transform matrix 1 0 0 1 0 0;
#X text 312 362 <- You can just feed the matrix values directly \,
#X msg 127 348 transform matrix 1 0 0 1 0 0;
#X text 312 348 <- You can just feed the matrix values directly \,
too.;
#X text 295 319 <- For rotations \, you can specify two extra floats
#X text 295 305 <- For rotations \, you can specify two extra floats
for the center of rotation. Here \, it makes the rotation happen around
the center of the rectangle.;
#X text 447 519 Notice that "transform" data doesn't accumulate in
#X text 447 505 Notice that "transform" data doesn't accumulate in
a [draw] object. When you send a new "transform" message the old values
are forgotten. That's why you have to gang them all together in a single
message if you want multiple transformations.;
#X obj 257 119 loadbang;
#X obj 57 258 pack 0 0 0 0 0 0;
#X obj 257 105 loadbang;
#X obj 57 244 pack 0 0 0 0 0 0;
#X obj 53 57 struct drawtut-transform float x float y;
#X obj 257 140 f 100;
#X obj 257 188 * 0.01;
#X text 470 168 <- The attributes skewx and skewy can take any value.
#X obj 257 126 f 100;
#X obj 257 174 * 0.01;
#X text 470 154 <- The attributes skewx and skewy can take any value.
Here I limit them to be between -1 and 1 \, just so that the rectangle's
dimensions don't grow too large.;
#X msg 57 279 transform translate \$1 \$2 rotate \$3 scale \$4 skewx
#X msg 57 265 transform translate \$1 \$2 rotate \$3 scale \$4 skewx
\$5 skewy \$6;
#X obj 57 388 draw rect 100 40 0 0;
#X obj 57 374 draw rect 100 40 0 0;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 76 AUTHOR Jonathan Wilkes;
#X text 16 96 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION applying affine transforms to data structure
drawings;
#X restore 784 593 pd META;
#X connect 4 0 25 0;
#X connect 6 0 7 0;
#X connect 7 0 4 0;
......
#N struct drawtut-group float x float y;
#N canvas 1 26 648 468 10;
#N canvas 2 51 648 468 10;
#X scalar drawtut-group 54 159 \;;
#X text 1 1 ___________________________;
#X text 0 1 New Drawing Commands: group;
......@@ -39,6 +39,14 @@ always the furthest to the right.;
with an inlet. You can send it all the same messages that you can send
to shapes. This will set the attributes for any drawing commands inside
the [draw group] which you haven't already set explicitly.;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X text 16 46 DESCRIPTION how to group data structure drawings with
[draw];
#X restore 574 433 pd META;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 10 0;
......
#N struct drawtut-events float x float y;
#N canvas 231 71 591 620 10;
#N canvas 1 25 591 620 10;
#X scalar drawtut-events 54 255 \;;
#X text 1 1 __________________________________;
#X text 0 1 New Drawing Commands: mouse events;
......@@ -30,6 +30,13 @@ of the shape.;
gets sent to the outlet of the corresponding [draw] object.;
#X obj 303 185 draw circle 25 300 30;
#X obj 53 173 draw rect 60 60 0 0;
#N canvas 290 275 450 300 META 0;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 46 DESCRIPTION mouse events for the [draw] command;
#X text 16 6 KEYWORDS tutorial data_structure draw gui;
#X restore 506 578 pd META;
#X connect 3 0 10 0;
#X connect 7 0 24 0;
#X connect 8 0 22 0;
......
#N struct drawtut-animation float x float y;
#N canvas 2 69 537 571 10;
#N canvas 14 48 537 571 10;
#X scalar drawtut-animation 47 309 \;;
#X obj 47 131 struct drawtut-animation float x float y;
#X text 0 1 New Drawing Commands: animation;
......@@ -33,7 +33,7 @@ in the other direction!;
#X text 112 524 How does it know?;
#X msg 47 250 fill \$1 \$1 \$1;
#X obj 47 188 * 255;
#X obj 177 158 tgl 23 0 empty empty empty 17 7 0 10 -4034 -1 -1 1 1
#X obj 177 158 tgl 23 0 empty empty empty 17 7 0 10 -4034 -1 -1 0 1
;
#X msg 177 210 \$1 500;
#X obj 177 188 * 255;
......@@ -41,6 +41,14 @@ in the other direction!;
#X obj 177 230 line 0 16.7;
#X text 255 229 <- 2nd argument sets the "grain" rate;
#X obj 47 279 draw rect 40 40 0 0;
#N canvas 290 275 450 300 META 0;
#X text 16 6 KEYWORDS tutorial data_structure draw;
#X text 16 26 LICENSE SIBSD;
#X text 16 66 AUTHOR Jonathan Wilkes;
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 46 DESCRIPTION animating scalars with the [draw] command
;
#X restore 450 538 pd META;
#X connect 6 0 17 0;
#X connect 7 0 13 0;
#X connect 9 0 10 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment