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:12] gweltaz |
recherche:residence_corruption:corruption_litteraire [2019/10/01 18:35] gweltaz [Le sketch Processing de présentation] |
||
---|---|---|---|
Ligne 6: | Ligne 6: | ||
===== Le module de corruption de texte ===== | ===== Le module de corruption de texte ===== | ||
Il peut s'utiliser de façon autonome, à condition d'avoir installé Python3 sur votre machine.\\ | Il peut s'utiliser de façon autonome, à condition d'avoir installé Python3 sur votre machine.\\ | ||
- | N'oubliez pas de remplacer la clé d'API du site http://thesaurus.altervista.org par votre propre clé (après avoir crée votre compte).\\ | + | N'oubliez pas de remplacer la clé d'API du site http://thesaurus.altervista.org par votre propre clé (après avoir crée votre compte) dans la variable ''key''.\\ |
Usage:\\ | Usage:\\ | ||
Ligne 157: | Ligne 157: | ||
saveSynDict(syn_dict, synDict) | saveSynDict(syn_dict, synDict) | ||
saveFilterOut(filter_out, filterOut) | saveFilterOut(filter_out, filterOut) | ||
+ | </code> | ||
+ | </panel> | ||
+ | </accordion> | ||
+ | |||
+ | ===== 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> | ||
+ | <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> | </code> | ||
</panel> | </panel> | ||
</accordion> | </accordion> |