Forums > Jitter

rgb values from lcd

August 30, 2007 | 1:32 pm

Hi,

I’m trying to produce a patch which will display the rgb value of a small, roaming section from a picture. I’ve managed it using lcd but was wondering whether the same thing could be done using jitter so that effects could be added to the picture.

I’ve tried using jit.lcd but the sprites overlap and end up covering the picture, is there another way?

The patch is below

max v2;
#N vpatcher 35 44 860 762;
#P origin -207 -304;
#P button 23 58 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 40 58 64 196617 start sprite moving;
#P window linecount 1;
#P newex 644 203 64 196617 random 500;
#P newex 674 331 40 196617 t b b b;
#P newex 681 182 64 196617 random 500;
#P number 681 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 644 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 644 287 115 196617 341 , 458 10000;
#P message 644 267 100 196617 set $1 \, $2 10000;
#P newex 644 246 47 196617 pak 0 0;
#P newex 644 307 40 196617 line 0;
#P newex 518 203 64 196617 random 500;
#P newex 548 331 40 196617 t b b b;
#P newex 555 182 64 196617 random 500;
#P number 555 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 518 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 518 287 115 196617 492 , 145 10000;
#P message 518 267 100 196617 set $1 \, $2 10000;
#P newex 518 246 47 196617 pak 0 0;
#P newex 518 307 40 196617 line 0;
#P newex 427 78 60 196617 loadmess 1;
#N vpatcher 10 59 728 417;
#P origin 49 0;
#P window setfont "Sans Serif" 9.;
#P message 105 138 26 196617 450;
#P message 118 156 26 196617 500;
#P number 105 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 118 183 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 26 228 15 0;
#P newex 26 261 125 196617 pack drawpict pic 0 0 0 0;
#P newex 413 115 121 196617 prepend set drawpict pic;
#P window linecount 0;
#P message 413 137 250 196617;
#P window linecount 1;
#P newex 105 110 54 196617 t b b b b;
#P newex 161 110 118 196617 prepend set readpict pic;
#P window linecount 0;
#P message 161 137 250 196617;
#P window linecount 1;
#P newex 161 50 54 196617 opendialog;
#P newex 161 78 69 196617 conformpath;
#B color 5;
#P inlet 161 30 15 0;
#P outlet 414 115 15 0;
#P outlet 413 157 15 0;
#P outlet 26 286 15 0;
#P fasten 13 0 12 0 123 203 31 203;
#P fasten 14 0 12 0 110 225 31 225;
#P connect 12 0 11 0;
#P connect 11 0 0 0;
#P connect 4 0 8 0;
#P connect 8 0 16 0;
#P connect 16 0 14 0;
#P connect 8 1 15 0;
#P connect 15 0 13 0;
#P connect 13 0 11 4;
#P fasten 14 0 11 5 110 238 146 238;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 7 0;
#P connect 7 0 6 0;
#P fasten 8 3 6 0 152 133 166 133;
#P fasten 4 0 10 0 166 105 418 105;
#P connect 10 0 9 0;
#P fasten 8 2 9 0 138 133 418 133;
#P connect 9 0 1 0;
#P connect 6 0 2 0;
#P pop;
#P newobj 8 90 56 196617 p open file;
#P window linecount 2;
#P message 192 105 231 196617 recordsprite , framerect $1 $3 $2 $4 12 12 150 128 128 , closesprite foo , drawsprite foo 0 0;
#P toggle 427 100 15 0;
#P window linecount 1;
#P message 427 118 83 196617 enablesprites $1;
#P message 427 141 63 196617 clearsprites;
#P number 752 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 717 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 682 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 647 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 612 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 612 657 151 196617 unpack 0 0 0 0 0;
#P newex 278 24 31 196617 + 20;
#P number 278 46 65 9 0 780 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname number[2];
#P newex 202 24 31 196617 + 20;
#P number 202 46 65 9 0 780 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname number[1];
#P newex 192 81 126 196617 pack 0 0 0 0;
#P button 8 27 15 0;
#P message 16 141 33 196617 clear;
#P newex 497 658 62 196617 prepend set;
#P message 497 684 114 196617 255 255 255 459 351;
#P newex 497 630 59 196617 route pixel;
#P newex 114 24 48 196617 pack 0 0;
#P number 152 2 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 114 2 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 114 46 76 196617 getpixel $1 $2;
#P user lcd 8 168 500 450 1 1 0 0 1;
#P comment 25 27 64 196617 open picture;
#P connect 10 0 26 0;
#P fasten 23 0 1 0 432 137 13 137;
#P fasten 22 0 1 0 432 162 13 162;
#P fasten 2 0 1 0 119 137 13 137;
#P connect 9 0 1 0;
#P fasten 25 0 1 0 197 162 13 162;
#P connect 26 0 1 0;
#P fasten 26 1 1 0 36 137 13 137;
#P fasten 26 2 1 0 59 137 13 137;
#P hidden connect 28 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 2 0;
#P hidden connect 37 0 4 0;
#P connect 4 0 5 1;
#P fasten 3 0 11 0 119 20 197 20;
#P connect 11 0 25 0;
#P fasten 3 0 13 0 119 20 207 20;
#P connect 13 0 12 0;
#P fasten 12 0 11 1 207 71 235 71;
#P fasten 4 0 11 2 157 20 273 20;
#P fasten 4 0 15 0 157 20 283 20;
#P connect 15 0 14 0;
#P fasten 14 0 11 3 283 71 311 71;
#P connect 27 0 24 0;
#P connect 24 0 23 0;
#P connect 1 3 6 0;
#P connect 6 0 8 0;
#P connect 8 0 7 0;
#P fasten 35 1 36 0 568 354 511 354 511 192 523 192;
#P connect 36 0 32 0;
#P connect 32 0 29 0;
#P connect 29 0 30 0;
#P hidden connect 47 0 31 0;
#P connect 30 0 31 0;
#P fasten 35 0 31 0 553 354 511 354 511 284 523 284;
#P connect 31 0 28 0;
#P connect 28 1 35 0;
#P fasten 35 2 34 0 583 354 511 354 511 168 560 168;
#P connect 34 0 33 0;
#P connect 33 0 29 1;
#P fasten 6 0 16 0 502 652 617 652;
#P connect 16 0 17 0;
#P fasten 44 1 45 0 694 354 637 354 637 192 649 192;
#P connect 45 0 41 0;
#P connect 41 0 38 0;
#P connect 38 0 39 0;
#P fasten 44 0 40 0 679 354 637 354 637 284 649 284;
#P connect 39 0 40 0;
#P hidden connect 47 0 40 0;
#P connect 40 0 37 0;
#P connect 16 1 18 0;
#P connect 37 1 44 0;
#P fasten 44 2 43 0 709 354 637 354 637 168 686 168;
#P connect 43 0 42 0;
#P connect 42 0 38 1;
#P connect 16 2 19 0;
#P connect 16 3 20 0;
#P connect 16 4 21 0;
#P pop;


August 30, 2007 | 2:07 pm

This will do the trick, ajust the matrixsize and you are on your way
DO_Ray

max v2;
#N vpatcher 20 74 620 474;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 106 99 62 196617 prepend set;
#P message 106 117 114 196617 cell 0 0 val 0 0 0 0;
#P message 25 47 70 196617 getcell $1 $2;
#P newex 24 69 129 196617 jit.matrix 4 char 320 240;
#P connect 1 0 0 0;
#P connect 0 1 3 0;
#P connect 3 0 2 0;
#P pop;

On 30 Aug 2007, at 15:32, Chris Hipgrave wrote:

>
> Hi,
>
> I’m trying to produce a patch which will display the rgb value of a
> small, roaming section from a picture. I’ve managed it using lcd
> but was wondering whether the same thing could be done using jitter
> so that effects could be added to the picture.
>
> I’ve tried using jit.lcd but the sprites overlap and end up
> covering the picture, is there another way?
>
> The patch is below
>
> max v2;
> #N vpatcher 35 44 860 762;
> #P origin -207 -304;
> #P button 23 58 15 0;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 2;
> #P comment 40 58 64 196617 start sprite moving;
> #P window linecount 1;
> #P newex 644 203 64 196617 random 500;
> #P newex 674 331 40 196617 t b b b;
> #P newex 681 182 64 196617 random 500;
> #P number 681 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 644 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 644 287 115 196617 341 , 458 10000;
> #P message 644 267 100 196617 set $1 \, $2 10000;
> #P newex 644 246 47 196617 pak 0 0;
> #P newex 644 307 40 196617 line 0;
> #P newex 518 203 64 196617 random 500;
> #P newex 548 331 40 196617 t b b b;
> #P newex 555 182 64 196617 random 500;
> #P number 555 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 518 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 518 287 115 196617 492 , 145 10000;
> #P message 518 267 100 196617 set $1 \, $2 10000;
> #P newex 518 246 47 196617 pak 0 0;
> #P newex 518 307 40 196617 line 0;
> #P newex 427 78 60 196617 loadmess 1;
> #N vpatcher 10 59 728 417;
> #P origin 49 0;
> #P window setfont "Sans Serif" 9.;
> #P message 105 138 26 196617 450;
> #P message 118 156 26 196617 500;
> #P number 105 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 118 183 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P button 26 228 15 0;
> #P newex 26 261 125 196617 pack drawpict pic 0 0 0 0;
> #P newex 413 115 121 196617 prepend set drawpict pic;
> #P window linecount 0;
> #P message 413 137 250 196617;
> #P window linecount 1;
> #P newex 105 110 54 196617 t b b b b;
> #P newex 161 110 118 196617 prepend set readpict pic;
> #P window linecount 0;
> #P message 161 137 250 196617;
> #P window linecount 1;
> #P newex 161 50 54 196617 opendialog;
> #P newex 161 78 69 196617 conformpath;
> #B color 5;
> #P inlet 161 30 15 0;
> #P outlet 414 115 15 0;
> #P outlet 413 157 15 0;
> #P outlet 26 286 15 0;
> #P fasten 13 0 12 0 123 203 31 203;
> #P fasten 14 0 12 0 110 225 31 225;
> #P connect 12 0 11 0;
> #P connect 11 0 0 0;
> #P connect 4 0 8 0;
> #P connect 8 0 16 0;
> #P connect 16 0 14 0;
> #P connect 8 1 15 0;
> #P connect 15 0 13 0;
> #P connect 13 0 11 4;
> #P fasten 14 0 11 5 110 238 146 238;
> #P connect 3 0 5 0;
> #P connect 5 0 4 0;
> #P connect 4 0 7 0;
> #P connect 7 0 6 0;
> #P fasten 8 3 6 0 152 133 166 133;
> #P fasten 4 0 10 0 166 105 418 105;
> #P connect 10 0 9 0;
> #P fasten 8 2 9 0 138 133 418 133;
> #P connect 9 0 1 0;
> #P connect 6 0 2 0;
> #P pop;
> #P newobj 8 90 56 196617 p open file;
> #P window linecount 2;
> #P message 192 105 231 196617 recordsprite , framerect $1 $3 $2
> $4 12 12 150 128 128 , closesprite foo , drawsprite foo 0 0;
> #P toggle 427 100 15 0;
> #P window linecount 1;
> #P message 427 118 83 196617 enablesprites $1;
> #P message 427 141 63 196617 clearsprites;
> #P number 752 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 717 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 682 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 647 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 612 683 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 612 657 151 196617 unpack 0 0 0 0 0;
> #P newex 278 24 31 196617 + 20;
> #P number 278 46 65 9 0 780 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P objectname number[2];
> #P newex 202 24 31 196617 + 20;
> #P number 202 46 65 9 0 780 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P objectname number[1];
> #P newex 192 81 126 196617 pack 0 0 0 0;
> #P button 8 27 15 0;
> #P message 16 141 33 196617 clear;
> #P newex 497 658 62 196617 prepend set;
> #P message 497 684 114 196617 255 255 255 459 351;
> #P newex 497 630 59 196617 route pixel;
> #P newex 114 24 48 196617 pack 0 0;
> #P number 152 2 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 114 2 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 114 46 76 196617 getpixel $1 $2;
> #P user lcd 8 168 500 450 1 1 0 0 1;
> #P comment 25 27 64 196617 open picture;
> #P connect 10 0 26 0;
> #P fasten 23 0 1 0 432 137 13 137;
> #P fasten 22 0 1 0 432 162 13 162;
> #P fasten 2 0 1 0 119 137 13 137;
> #P connect 9 0 1 0;
> #P fasten 25 0 1 0 197 162 13 162;
> #P connect 26 0 1 0;
> #P fasten 26 1 1 0 36 137 13 137;
> #P fasten 26 2 1 0 59 137 13 137;
> #P hidden connect 28 0 3 0;
> #P connect 3 0 5 0;
> #P connect 5 0 2 0;
> #P hidden connect 37 0 4 0;
> #P connect 4 0 5 1;
> #P fasten 3 0 11 0 119 20 197 20;
> #P connect 11 0 25 0;
> #P fasten 3 0 13 0 119 20 207 20;
> #P connect 13 0 12 0;
> #P fasten 12 0 11 1 207 71 235 71;
> #P fasten 4 0 11 2 157 20 273 20;
> #P fasten 4 0 15 0 157 20 283 20;
> #P connect 15 0 14 0;
> #P fasten 14 0 11 3 283 71 311 71;
> #P connect 27 0 24 0;
> #P connect 24 0 23 0;
> #P connect 1 3 6 0;
> #P connect 6 0 8 0;
> #P connect 8 0 7 0;
> #P fasten 35 1 36 0 568 354 511 354 511 192 523 192;
> #P connect 36 0 32 0;
> #P connect 32 0 29 0;
> #P connect 29 0 30 0;
> #P hidden connect 47 0 31 0;
> #P connect 30 0 31 0;
> #P fasten 35 0 31 0 553 354 511 354 511 284 523 284;
> #P connect 31 0 28 0;
> #P connect 28 1 35 0;
> #P fasten 35 2 34 0 583 354 511 354 511 168 560 168;
> #P connect 34 0 33 0;
> #P connect 33 0 29 1;
> #P fasten 6 0 16 0 502 652 617 652;
> #P connect 16 0 17 0;
> #P fasten 44 1 45 0 694 354 637 354 637 192 649 192;
> #P connect 45 0 41 0;
> #P connect 41 0 38 0;
> #P connect 38 0 39 0;
> #P fasten 44 0 40 0 679 354 637 354 637 284 649 284;
> #P connect 39 0 40 0;
> #P hidden connect 47 0 40 0;
> #P connect 40 0 37 0;
> #P connect 16 1 18 0;
> #P connect 37 1 44 0;
> #P fasten 44 2 43 0 709 354 637 354 637 168 686 168;
> #P connect 43 0 42 0;
> #P connect 42 0 38 1;
> #P connect 16 2 19 0;
> #P connect 16 3 20 0;
> #P connect 16 4 21 0;
> #P pop;
>
>


Viewing 2 posts - 1 through 2 (of 2 total)