background color of jit.rota

Feb 9, 2006 at 4:42am

background color of jit.rota

First of all, my english is not good. But I wish you can understand what I would like to know.

I am trying to change background color when image is zoomed out in jit.rota. The color is always black, but I need white. How can I change background color?
I tried to use another white image with jit.qt.movie for background. But this way was not good for performance speed.

I appreciated it if you could tell me how to do this or any good idea if you have.

Thanks in advance,

#24342
Feb 9, 2006 at 10:58am

At this time, there is no way to set the clear color in jit.rota,
although we could consider adding this to a future release. For now,
you’ll likely want to use jit.charmap to turn all instances of black
to white, although this might have repercussions on the image.
Alternately, you could hack up a solution, by running a parallel
patch, rotating a black square against a white background. Then, with
jit.op objects, we can add in a white background. See attached patch
below.

jb

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 267 235 64 196617 jit.op @op +;
#P newex 359 188 64 196617 jit.op @op ~;
#P user jit.pwindow 264 263 322 242 0 1 0 0 1 0;
#P flonum 18 58 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 14 80 48 196617 theta $1;
#P newex 398 50 72 196617 loadmess 255;
#P window linecount 2;
#P newex 359 148 191 196617 jit.rota @anchor_x 160 @anchor_y 120
@boundmode 1;
#P window linecount 1;
#P newex 359 97 129 196617 jit.matrix 4 char 320 240;
#P toggle 78 32 15 0;
#P newex 97 30 52 196617 metro 60;
#P message 171 67 83 196617 read dishes.mov;
#P newex 139 98 105 196617 jit.qt.movie 320 240;
#P window linecount 2;
#P newex 139 148 191 196617 jit.rota @anchor_x 160 @anchor_y 120
@boundmode 1;
#P connect 12 0 10 0;
#P connect 0 0 12 0;
#P connect 11 0 12 1;
#P connect 6 0 11 0;
#P fasten 8 0 0 0 19 121 144 121;
#P fasten 8 0 6 0 19 121 364 121;
#P connect 5 0 6 0;
#P connect 1 0 0 0;
#P connect 7 0 5 0;
#P connect 9 0 8 0;
#P fasten 3 0 1 0 102 72 144 72;
#P fasten 3 0 5 0 102 59 364 59;
#P connect 4 0 3 0;
#P connect 2 0 1 0;
#P window clipboard copycount 13;

#70268
Feb 9, 2006 at 11:35am

another method would be to add a small white border & then use
boundmode 3:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 417 140 48 196617 loadbang;
#P newex 446 64 106 196617 bgcolor 100 100 100;
#P message 417 171 376 196617 setall 255 255 255 255 , bang ,
usedstdim 1 , dstdimstart 1 1 , dstdimend 320 240;
#P user jit.pwindow 510 319 322 242 0 1 0 0 1 0;
#P newex 333 215 129 196617 jit.matrix 4 char 322 242;
#P user jit.pwindow 63 326 322 242 0 1 0 0 1 0;
#P flonum 78 118 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 74 140 48 196617 theta $1;
#P toggle 138 92 15 0;
#P newex 157 90 52 196617 metro 60;
#P message 231 127 83 196617 read dishes.mov;
#P newex 199 158 105 196617 jit.qt.movie 320 240;
#P newex 154 261 387 196617 jit.rota @anchor_x 160 @anchor_y 120
@boundmode 3 @zoom_x 0.5 @zoom_y 0.5;
#P connect 8 0 0 0;
#P connect 8 0 9 0;
#P connect 12 0 10 0;
#P connect 10 0 8 0;
#P connect 1 0 8 0;
#P fasten 3 0 1 0 162 132 204 132;
#P connect 2 0 1 0;
#P connect 4 0 3 0;
#P fasten 5 0 0 0 79 225 159 225;
#P connect 6 0 5 0;
#P connect 0 0 7 0;
#P window clipboard copycount 13;

#70269
Feb 9, 2006 at 12:02pm

since @boundmode 1 also clears the alpha channel, i like to use
jit.alphablend on the output of jit.rota like so:

#P user swatch 385 118 128 32;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 139 237 233 196617 jit.alphablend;
#P user jit.pwindow 138 326 322 242 0 1 0 0 1 0;
#P flonum 18 58 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 14 80 48 196617 theta $1;
#P newex 385 156 54 196617 prepend 0;
#P newex 362 185 105 196617 jit.matrix 4 char 1 1;
#P toggle 78 32 15 0;
#P newex 97 30 52 196617 metro 60;
#P message 171 77 83 196617 read dishes.mov;
#P newex 139 108 105 196617 jit.qt.movie 320 240;
#P window linecount 2;
#P newex 139 185 191 196617 jit.rota @anchor_x 160 @anchor_y 120
@boundmode 1;
#P fasten 3 0 1 0 102 72 144 72;
#P fasten 3 0 5 0 102 59 367 59;
#P connect 5 0 10 1;
#P connect 6 0 5 0;
#P connect 11 0 6 0;
#P connect 10 0 9 0;
#P connect 0 0 10 0;
#P connect 2 0 1 0;
#P connect 4 0 3 0;
#P connect 8 0 7 0;
#P connect 1 0 0 0;
#P fasten 7 0 0 0 19 155 144 155;
#P window clipboard copycount 12;

#70270
Feb 9, 2006 at 5:31pm

You could also invert your image colors, then run rota, then invert again.

Black becomes white.

#70271
Feb 9, 2006 at 7:31pm

On Feb 8, 2006, at 8:42 PM, hu wrote:

> I am trying to change background color when image is zoomed out in
> jit.rota. The color is always black, but I need white. How can I
> change background color?

Please see the jit.rota-bgcolor.pat example. It demonstrates exactly
how to accomplish this with a named output matrix.

-Joshua

#70272
Feb 10, 2006 at 5:02am

Thank you for you comment!!

I had not had any good solution for this.
So I try all your proposal and chose best one for my patch.

Thank you very much!

hu

#70273

You must be logged in to reply to this topic.