-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathof.image-help.pd
240 lines (240 loc) · 8.08 KB
/
of.image-help.pd
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#N canvas 547 48 690 679 12;
#X declare -lib ofelia;
#X obj 9 10 cnv 15 600 60 empty empty empty 20 12 0 14 -233017 -66577
0;
#X obj 462 45 declare -lib ofelia;
#X text 44 169 open png with alpha channel;
#X msg 114 393 get;
#X text 148 393 get infos from right outlet;
#X text 72 329 save to file;
#X msg 57 239 open https://puredata.info/portal_css/Plone%20Default/logo.png
, f 68;
#X obj 71 284 openpanel;
#X msg 71 307 open \$1;
#X obj 71 263 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X msg 35 142 open data/wood.jpg;
#X msg 46 191 open data/transparency.png;
#X msg 73 348 save export.png;
#X obj 19 98 of.draw;
#X obj 518 19 of.window 1;
#X obj 497 21 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 32 123 open relative to the patch;
#X text 92 263 browse for a file...;
#X text 26 40 Arguments: path \, draw \, posX \, posY \, posZ \, width
\, height;
#N canvas 527 48 651 683 Set_buffer_&_Pixels 0;
#X msg 185 594 clear;
#X text 232 594 clear all pixels = careful \, need re-allocate!;
#N canvas 418 393 528 305 Work_with_alpha 0;
#X obj 56 207 outlet;
#X floatatom 85 116 5 0 0 0 - - -;
#X msg 56 54 allocate 10 10 2 \, fill 200 0 0 50 \, draw 1 -150 -150
10 300 300;
#X text 55 30 allocate colortype =2 \, fill rgba (alpha = 50) \, draw
300x300px, f 67;
#X text 131 116 need after \, and update (carefull of the values!)
;
#X msg 85 142 setpixel \$1 0 255 255 255 150 \, update;
#X text 357 139 alpha = 150;
#X connect 1 0 5 0;
#X connect 2 0 0 0;
#X connect 5 0 0 0;
#X restore 102 118 pd Work_with_alpha;
#X obj 22 622 outlet;
#X msg 180 564 save \$1;
#X obj 180 540 savepanel;
#X obj 180 515 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 176 429 Grabs pixels from the opengl window specified by the
region (x \, y \, w \, h) and turns them into an image. It resizes
or allocates the ofImage if it's necessary.;
#X text 203 511 export the image buffer;
#X msg 182 479 grab 250 250 100 100;
#X obj 18 7 cnv 15 400 20 empty empty empty 20 12 0 14 -191407 -66577
0;
#X text 195 54 (0= Grayscale \, 1 =rgb \, 2 = rgba);
#X msg 96 90 fill 0 0 0;
#X msg 71 54 allocate 10 10 1;
#X obj 19 154 cnv 15 400 20 empty empty empty 20 12 0 14 -191407 -66577
0;
#X floatatom 119 187 5 0 0 0 - - -;
#X msg 135 237 update;
#X floatatom 157 282 5 0 0 0 - - -;
#X text 163 184 Set pixels X \, Y \, r \, g \, b \, a;
#X text 192 236 need after set pixel;
#X msg 119 212 setpixel \$1 0 255 255 255 255;
#X msg 157 308 setpixel \$1 0 255 0 0 \, update;
#X floatatom 174 329 5 0 0 0 - - -;
#X msg 174 353 setpixel \$1 \$1 255 0 0 \, update;
#X text 220 327 set XY \, and update (carefull of the values!);
#X text 203 282 set X -> end \, and update (carefull of the values!)
;
#X text 68 10 Allocate pixel buffer size and clear color;
#X text 65 36 1/ allocate Width \, Height \, colortype;
#X text 95 72 2 fill (clear);
#X text 182 91 -> fill rgb (black). fill rgb or rgba if colortype =2
;
#X text 162 155 Set pixels;
#X obj 28 406 cnv 15 400 20 empty empty empty 20 12 0 14 -191407 -66577
0;
#X text 171 407 Grab etc;
#X connect 0 0 3 0;
#X connect 2 0 3 0;
#X connect 4 0 3 0;
#X connect 5 0 4 0;
#X connect 6 0 5 0;
#X connect 9 0 3 0;
#X connect 12 0 3 0;
#X connect 13 0 3 0;
#X connect 15 0 20 0;
#X connect 16 0 3 0;
#X connect 17 0 21 0;
#X connect 20 0 3 0;
#X connect 21 0 3 0;
#X connect 22 0 23 0;
#X connect 23 0 3 0;
#X restore 265 338 pd Set_buffer_&_Pixels;
#N canvas 598 139 634 366 draw_on_screen 0;
#X floatatom 41 29 5 0 0 0 - - -;
#X msg 70 114 drawsubsection 1 100 0 100 100 120 200;
#X msg 76 261 anchorpoint \$1 \$1;
#X floatatom 76 233 5 0 0 0 - - -;
#X text 117 233 change anchor point;
#X text 217 197 Desactivate drawsubsection;
#X text 149 83 Desactivate draw;
#X obj 20 289 outlet;
#X msg 41 54 draw 1 \$1 0 0 100 100;
#X msg 59 83 draw 0 0;
#X msg 73 197 drawsubsection 0 0;
#X text 201 53 activation \, X \, Y \, Z \, width \, height;
#X text 82 27 pos X;
#X text 37 4 draw image buffer on screen;
#N canvas 502 246 589 401 Click_here_to_learn_more_about_draw_subsection
0;
#X obj 25 231 of.mouse;
#X obj 25 258 spigot;
#X obj 100 243 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 126 240 -> activate this to scroll image with mouse on window
;
#X obj 25 310 outlet;
#X text 17 67 0/1: active \; X: position to draw cropped image at \;
Y: position to draw cropped image at \; W: Width of subsection to draw
\; H: Height of subsection to draw \; X: position in image to begin
cropping from \; Y: position in image to begin cropping from \;, f
49;
#X text 15 14 Draws a subsection of the image \;, f 80;
#X text 15 44 This functions like a clipping mask. Does not altering
any pixel data \;, f 80;
#X text 21 198 Exemple:;
#X msg 25 286 drawsubsection 1 -100 110 200 100 \$1 \$2;
#X text 312 282 active \, posX \, posY \, witdh \, height \, cropfromX
\, cropfromY, f 42;
#X connect 0 0 1 0;
#X connect 1 0 9 0;
#X connect 2 0 1 1;
#X connect 9 0 4 0;
#X restore 73 143 pd Click_here_to_learn_more_about_draw_subsection
;
#X text 349 112 active \, posX \, posY \, witdh \, height \, cropfromX
\, cropfromY, f 42;
#X connect 0 0 8 0;
#X connect 1 0 7 0;
#X connect 2 0 7 0;
#X connect 3 0 2 0;
#X connect 8 0 7 0;
#X connect 9 0 7 0;
#X connect 10 0 7 0;
#X connect 14 0 7 0;
#X restore 265 285 pd draw_on_screen;
#N canvas 816 141 464 290 pixels_process 0;
#X msg 39 168 crop 100 100 100 100;
#X msg 39 194 cropfrom img 100 100 300 300;
#X msg 40 90 mirror 1 0;
#X text 124 90 vertical \, horizontal;
#X msg 40 115 rotate 1;
#X msg 40 141 resize 10 10;
#X text 124 115 rotate by 90°;
#X text 144 141 resize width \, height;
#X text 152 65 0= Grayscale \, 1 =rgb \, 2 = rgba;
#X obj 8 241 outlet;
#X text 245 193 to do...;
#X text 190 168 width \, height \, posX \, posY (careful);
#X msg 40 65 setimagetype \$1;
#X obj 40 42 hradio 15 1 0 3 empty empty empty 0 -8 0 10 -262144 -1
-1 1;
#X text 35 12 Careful: Cannot be undone!;
#X connect 0 0 9 0;
#X connect 1 0 9 0;
#X connect 2 0 9 0;
#X connect 4 0 9 0;
#X connect 5 0 9 0;
#X connect 12 0 9 0;
#X connect 13 0 12 0;
#X restore 265 313 pd pixels_process;
#X floatatom 53 543 5 0 0 1 width - -;
#X floatatom 87 567 5 0 0 1 height - -;
#X text 28 22 Image loader using memory and gpu based pixels.;
#X text 180 491 texture map (default 0 0 1 1);
#X obj 19 598 of.plane 200 200, f 20;
#X text 18 620 draw to plane primitive (width \, height);
#X text 58 220 works also with online files if connected to internet
(wait...might takes time), f 88;
#X obj 19 422 of.image data/rgb.jpg, f 34;
#X floatatom 36 462 5 0 0 0 - - -;
#X text 264 438 -> get infos as a list:;
#N canvas 799 518 302 276 get_infos 0;
#X obj 20 20 inlet;
#X obj 32 158 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 31 186 0 = load fail;
#X text 30 173 1 = load success;
#X floatatom 59 146 5 0 0 0 - - -;
#X floatatom 86 126 5 0 0 0 - - -;
#X floatatom 141 83 5 0 0 0 - - -;
#X text 282 94 1 = rgb;
#X text 282 84 0 = grayscale;
#X text 189 84 Image type:;
#X text 101 147 width px;
#X text 126 127 height px;
#X obj 32 60 unpack 0 0 0 0 0;
#X floatatom 113 104 5 0 0 0 - - -;
#X text 155 105 Ratio;
#X text 282 104 2 = rgba;
#X connect 0 0 12 0;
#X connect 12 0 1 0;
#X connect 12 1 4 0;
#X connect 12 2 5 0;
#X connect 12 3 13 0;
#X connect 12 4 6 0;
#X restore 254 457 pd get_infos;
#X text 77 464 texture coordinate;
#X msg 36 489 texturemap \$1 0 1 1;
#X text 259 73 of.Image is a convenient object that lets you both draw
images to the screen and manipulate their pixel data. The ofImage allows
you to load/save an image from/to disk \, \, manipulate the pixels
\, and create an OpenGL texture that you can display on any shape with
texture coordinate. Loading a file into the ofImage allocates an ofPixels
object and creates the ofTexture to display the pixels. ofImage uses
a library called "freeImage" under the hood.;
#X connect 3 0 29 0;
#X connect 6 0 29 0;
#X connect 7 0 8 0;
#X connect 8 0 29 0;
#X connect 9 0 7 0;
#X connect 10 0 29 0;
#X connect 11 0 29 0;
#X connect 12 0 29 0;
#X connect 13 0 29 0;
#X connect 15 0 14 0;
#X connect 19 0 29 0;
#X connect 20 0 29 0;
#X connect 21 0 29 0;
#X connect 22 0 26 1;
#X connect 23 0 26 2;
#X connect 29 0 26 0;
#X connect 29 1 32 0;
#X connect 30 0 34 0;
#X connect 34 0 26 0;