Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
recherche:residence_corruption:corruption_litteraire [2019/10/01 18:15] gweltaz [Le sketch Processing de présentation] |
recherche:residence_corruption:corruption_litteraire [2019/10/01 18:35] gweltaz [Le sketch Processing de présentation] |
||
---|---|---|---|
Ligne 162: | Ligne 162: | ||
===== Le sketch Processing de présentation ===== | ===== Le sketch Processing de présentation ===== | ||
+ | Le programme est disponible en téléchargement sur GitHub.\\ | ||
+ | |||
+ | J'ai recopié ici quelques passages intéressants et facilement applicables à d'autres sketches Processing pour glitcher l'image.\\ | ||
<accordion> | <accordion> | ||
+ | <panel title="Rectangles d'inversion de couleurs (cliquer pour afficher le code)"> | ||
+ | <code java> | ||
+ | void glitchScreen(int n) { | ||
+ | loadPixels(); | ||
+ | for (int i=0; i<n; i++) { | ||
+ | int x0 = (int) random(width); | ||
+ | int y0 = (int) random(height); | ||
+ | int x1 = (int) min(x0+random(4, 100*12*corruptionLevel), width); | ||
+ | int y1 = (int) min(y0+random(4, 10+4*corruptionLevel), height); | ||
+ | for (int y=y0; y<y1; y++) { | ||
+ | for (int x=x0; x<x1; x++) { | ||
+ | pixels[x + y*width] = ~pixels[x + y*width]; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | updatePixels(); | ||
+ | } | ||
+ | </code> | ||
+ | </panel> | ||
+ | </accordion> | ||
+ | |||
+ | <accordion> | ||
+ | <panel title="Pixelisation de l'écran (cliquer pour afficher le code)"> | ||
+ | <code java> | ||
+ | void pixelateScreen(int n) { | ||
+ | loadPixels(); | ||
+ | for (int y=0; y<height; y+=n) { | ||
+ | for (int x=0; x<width; x+=n) { | ||
+ | for (int yy=0; yy<n; yy+=1) { | ||
+ | for (int xx=0; xx<n; xx+=1) { | ||
+ | pixels[min(x+xx + (y+yy)*width, pixels.length-1)] = pixels[x+y*width]; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | updatePixels(); | ||
+ | } | ||
+ | </code> | ||
+ | </panel> | ||
+ | </accordion> | ||
+ | |||
+ | <accordion> | ||
+ | <panel title="Décalage des canaux R et B (cliquer pour afficher le code)"> | ||
+ | <code java> | ||
+ | void rbGlitch(int n) { | ||
+ | loadPixels(); | ||
+ | PImage buffer = createImage(width, height, RGB); | ||
+ | buffer.loadPixels(); | ||
+ | for (int i=0; i<pixels.length; i++) { | ||
+ | buffer.pixels[i] = (pixels[i] & 0xff00ff00) + | ||
+ | (pixels[min(pixels.length-1, i+n)] & 0xff0000ff) + | ||
+ | (pixels[max(0, i-n)] & 0x00ff0000); | ||
+ | } | ||
+ | buffer.updatePixels(); | ||
+ | image(buffer, 0, 0); | ||
+ | } | ||
+ | </code> | ||
+ | </panel> | ||
+ | </accordion> |