aboutsummaryrefslogtreecommitdiff
path: root/Gem/examples/04.pix/18.Curves.pd
blob: ade6bc4a76cbec907e93dd25f9100065314bb18d (plain)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#N canvas 119 61 764 634 10;
#X declare -lib Gem;
#N canvas 285 0 681 629 tables 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array red 256 float 0;
#X coords 0 255 255 0 256 140 1;
#X restore 95 30 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array green 256 float 0;
#X coords 0 255 255 0 256 140 1;
#X restore 399 29 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array blue 256 float 0;
#X coords 0 255 255 0 256 140 1;
#X restore 98 214 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array alpha 64 float 0;
#X coords 0 255 63 0 256 140 1;
#X restore 396 212 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array edge 8 float 0;
#X coords 0 255 7 0 256 140 1;
#X restore 49 440 graph;
#X text 319 459 set all black and white pixels to black.;
#X text 318 477 set all "grey" pixels (the transients) to white.;
#X restore 219 225 pd tables;
#X obj 30 272 gemhead;
#X obj 30 468 pix_texture;
#N canvas 0 0 450 300 (subpatch) 0;
#X array rgba 256 float 0;
#X coords 0 256 255 0 256 140 1;
#X restore 217 70 graph;
#X text 78 8 pix_curve: adjust the colour of an image;
#X text 291 227 separate tables for r \, g \, b and a;
#X obj 466 274 pix_curve rgba;
#X obj 469 324 pix_curve red green blue;
#X obj 470 373 pix_curve red green blue alpha;
#X text 504 291 one curve for all channels;
#X text 505 391 curves for r \, g \, b \, a;
#X text 500 341 curves for r \, g \, b \; leave a unchanged;
#X msg 507 127 \; rgba cosinesum 64 128 128;
#X obj 30 393 pix_curve rgba;
#N canvas 328 58 600 502 init 0;
#X obj 93 39 loadbang;
#X msg 115 87 \; rgba resize 256 \; red resize 256 green resize 256
\; blue resize 256 \; alpha resize 64 \; alpha const 128;
#X obj 93 197 t b b;
#X msg 93 219 256;
#X msg 125 218 0;
#X obj 93 241 until;
#X obj 93 262 i;
#X obj 123 261 + 1;
#X msg 93 177 bang;
#X obj 93 283 t f f f;
#X obj 93 370 tabwrite rgba;
#X msg 93 348 \$1 \$1;
#X obj 210 304 / 255;
#X obj 210 326 sqrt;
#X obj 210 347 * 255;
#X obj 210 395 tabwrite red;
#X obj 210 373 pack 0 0;
#X obj 319 456 tabwrite green;
#X obj 104 395 tabwrite blue;
#X obj 93 63 t b b b;
#X msg 364 83 \; edge resize 8 \; edge const 255 \; edge 0 0 \; edge
7 0;
#X obj 319 393 unpack;
#X obj 319 413 - 255;
#X obj 319 432 * -1;
#X obj 362 413 - 255;
#X obj 362 432 * -1;
#X connect 0 0 19 0;
#X connect 2 0 3 0;
#X connect 2 1 4 0;
#X connect 3 0 5 0;
#X connect 4 0 6 1;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 6 0 9 0;
#X connect 7 0 6 1;
#X connect 8 0 2 0;
#X connect 9 0 11 0;
#X connect 9 1 12 0;
#X connect 9 2 16 1;
#X connect 11 0 10 0;
#X connect 11 0 18 0;
#X connect 12 0 13 0;
#X connect 13 0 14 0;
#X connect 14 0 16 0;
#X connect 16 0 15 0;
#X connect 16 0 21 0;
#X connect 19 0 8 0;
#X connect 19 1 1 0;
#X connect 19 2 20 0;
#X connect 21 0 22 0;
#X connect 21 1 24 0;
#X connect 22 0 23 0;
#X connect 23 0 17 0;
#X connect 24 0 25 0;
#X connect 25 0 17 1;
#X restore 604 470 pd init;
#X msg 284 275 set rgba;
#X msg 282 325 set red green blue;
#X msg 278 375 set red green blue alpha;
#X text 505 110 an alternative colour-curve;
#X text 228 56 paint your own curve;
#X obj 30 509 square 2;
#X obj 30 488 translateXYZ -2 0 0;
#X obj 244 486 gemhead;
#X obj 244 548 pix_texture;
#X obj 244 569 translateXYZ 2 0 0;
#X obj 244 527 pix_curve edge;
#N canvas 80 38 600 318 pix_update 0;
#X obj 59 115 inlet;
#X obj 59 227 outlet;
#X text 61 19 this is quite a dummy-routine:;
#X text 78 47 just multiply the pix-buffer with 1 (do nothing !) \,
and make it thereby dirty \, so that the pix_curve routines are going
to be called....;
#X text 56 272 maybe this could be done more easily..?;
#X obj 59 202 pix_buf;
#X obj 59 156 t a b;
#X connect 0 0 6 0;
#X connect 5 0 1 0;
#X connect 6 0 5 0;
#X connect 6 1 5 0;
#X restore 30 331 pd pix_update;
#X obj 244 592 square 2;
#X obj 30 435 alpha;
#X obj 30 303 pix_image ../data/fractal.JPG;
#X obj 244 506 pix_image ../data/dancer.JPG;
#X obj 11 151 cnv 15 200 70 empty empty empty 20 12 0 14 -195568 -66577
0;
#N canvas 0 22 454 304 gemwin 0;
#X obj 67 89 outlet;
#X obj 67 10 inlet;
#X obj 67 41 route create;
#X msg 67 70 set destroy;
#X msg 182 68 set create;
#X msg 132 112 create \, 1;
#X msg 238 112 destroy;
#N canvas 87 154 247 179 Gem.init 0;
#X obj 118 46 loadbang;
#X msg 118 81 reset;
#X obj 118 113 outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X restore 289 80 pd Gem.init;
#X obj 132 193 gemwin;
#X obj 132 135 t a;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 0 5 0;
#X connect 2 1 4 0;
#X connect 2 1 6 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 9 0;
#X connect 6 0 9 0;
#X connect 7 0 9 0;
#X connect 9 0 8 0;
#X restore 16 195 pd gemwin;
#X msg 16 171 create;
#X text 12 151 Create window and render;
#X obj 652 5 declare -lib Gem;
#X connect 1 0 29 0;
#X connect 2 0 21 0;
#X connect 13 0 28 0;
#X connect 15 0 13 0;
#X connect 16 0 13 0;
#X connect 17 0 13 0;
#X connect 21 0 20 0;
#X connect 22 0 30 0;
#X connect 23 0 24 0;
#X connect 24 0 27 0;
#X connect 25 0 23 0;
#X connect 26 0 13 0;
#X connect 28 0 2 0;
#X connect 29 0 26 0;
#X connect 30 0 25 0;
#X connect 32 0 33 0;
#X connect 33 0 32 0;