Processing and pixels -


i want create simple filter using movie class in processing. however, have issue size of movie. filter work in progress, please don't judge me :)

import processing.video.*;  movie themov;  int size;  void setup() {     themov = new movie(this, "fargo.mp4");   themov.play();   themov.read();   size(displaywidth, displayheight);   nostroke();   size = 10; }  void draw() {    //image(themov, 0, 0, width, height);   themov.loadpixels();   (int = 0; < themov.width; i+=size) {     (int j = 0; j < themov.height; j+=size) {       color c = themov.pixels[i+j*themov.width];       fill(c);       rect(i, j, size, size);     }   }   updatepixels();   size = (int)random(10, 20); }   void movieevent(movie m) {    m.read(); }  

how if want movie fullscreen? fills small portion of screen. want able render film fullscreen loadpixels() function loads film fullscreen.

because "drawing" each frame rectangle rectangle can simple calculate new ''position' , 'size' these rectangles:

float ratiox = (float)width / themov.width; float ratioy = (float)height / themov.height; 

depending on aspect ration should change calculation. , simple draw rectangle new 'size' on new 'position':

rect(i * ratiox, j * ratioy, size * ratiox, size * ratioy); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -