diff --git a/data/saves.sav b/data/saves.sav index b519e2b..982d352 100755 --- a/data/saves.sav +++ b/data/saves.sav @@ -1,2 +1,2 @@ //globals -uptime = 116755249 +uptime = 116775809 diff --git a/effects.pde b/effects.pde index 13f56e4..9c732a2 100644 --- a/effects.pde +++ b/effects.pde @@ -2134,9 +2134,487 @@ class MASK extends Shader { -/* todo: implement "solo" and "only up till here" button on bricks */ +class DRAWSTROKES extends Shader { + + int stat_type = ABSDIST2; // type of diff calculation: fast: ABSDIST, DIST, slow: HUE, SATURATION, BRIGHTNESS + int stroke_len = 3; // length of the stroke, values: 1 and above + int angles_no = 30; // number of directions stroke can be drew, 2 and above + int segments = 500; // number of segments of single thread + float stroke_width = 1; // width of the stroke, 0.5 - 3 + int stroke_alpha = 100; // alpha channel of the stroke: 30 - 200 + + color background_color = color(255, 255, 255); // RGB + + boolean interactive = false; + int max_display_size = 800; // viewing window size (regardless image size) + + int len; + // working buffer + PGraphics buffer; + + int currx, curry; + int[] sintab, costab; + int sqwidth; + + int iterations; + + int calcDiff(PImage img1, PImage img2) { + int err = 0; + for (int i=0; i 0) { + // take end points + int nx = currx + costab[i]; + int ny = curry + sintab[i]; + + // if not out of the screen + if (nx>=0 && nx=0 && nylen) { + frameCount=0; + //println("iteration: " + tick++); + for (int i=0; i5?channel-6:channel; + float cc; + + switch(ch) { + case RED: + cc = red(c); + break; + case GREEN: + cc = green(c); + break; + case BLUE: + cc = blue(c); + break; + case HUE: + cc = hue(c); + break; + case SATURATION: + cc = saturation(c); + break; + default: + cc= brightness(c); + break; + } + + return channel>5?255-cc:cc; + } +} + +/* + + PIXELDRIFTER + + */ + + +class PIXELDRIFTER extends Shader { + int channel = HUE; // channel data used for shift + float channel_off = 60; // channel value offset + int iteration_no = 50; // number of iterations 1-100 + int max_iter = iteration_no; + int direction = UP; // UP, DOWN, LEFT, RIGHT + boolean automate_channel_offset = false; // if true, change channel_offset every iteration + float scale = 0.03; // 0.01 - 0.1, step size (0.01: 2px, 0.1:25px) + float feedback = 0.9; // 0.9 - 0.999 ; blend ratio with original image + + boolean do_blend = false; // blend image after process + int blend_mode = OVERLAY; // blend type + + // working buffer + PGraphics buffer; + + // image + PImage imgb; + PImage img; + String sessionid; + float acho_step; + int rw, rh; + + PIXELDRIFTER() { + name = "fxPixelDrifter"; + params.add(new Param ("channel offset", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE})); + params.add(new Param ("iterations", INTVAL, 1, 100, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE})); + params.add(new Param ("step size", FLOATVAL, 0.01, 0.1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE})); + params.add(new Param ("feedback", FLOATVAL, 0.1, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE})); + params.add(new Param ("direction", INTVAL, 37, 40, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE})); + params.add(new Param ("do blend", INTVAL, 0, 1, new int[]{RANDOM, SQUAR})); + params.add(new Param ("blend mode", INTVAL, 0, blends.length-1, new int[]{RANDOM})); + params.add(new Param ("channel", INTVAL, 0, 1, new int[]{SQUAR, RANDOM})); + rw = canvas.width; + rh = canvas.height; + + img = createImage(rw, rh, ARGB); + + buffer = createGraphics(rw, rh); + buffer.beginDraw(); + buffer.noStroke(); + buffer.smooth(8); + buffer.background(0); + buffer.image(img, 0, 0); + buffer.endDraw(); + + scale = abs(scale); + acho_step = 256.0 / iteration_no; + } + + void apply() { + + if (rw != canvas.width || rh != canvas.height) { + rw = canvas.width; + rh = canvas.height; + img.resize(rw, rh); + buffer = createGraphics(rw, rh); + } + channel_off = map(params.get(0).value, 0, 1, 10, max(rw, rh)); + iteration_no = (int)params.get(1).value; + scale = params.get(2).value; + feedback = params.get(3).value; + direction = (int)params.get(4).value; + do_blend = boolean((int)params.get(5).value); + blend_mode = blends[(int)params.get(6).value]; + channel = (int)params.get(7).value == 1 ? HUE : RGB; + + img = canvas.get(); + + // if (iteration_no>0) { + for (int i = 0; i < iteration_no; i++) { + processImage(); + } + //iteration_no--; + //iteration_no=(iteration_no==0)?max_iter:iteration_no; + // if (iteration_no == 0) + // iteration_no = 50; + // } + // } else { + + canvas.beginDraw(); + if (do_blend) { + canvas.blend(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height, blend_mode); + } else { + canvas.image(buffer, canvas.width/2, canvas.height/2, canvas.width, canvas.height); + } + canvas.endDraw(); + // canvas.image(img, 0, 0, renderer.width, renderer.height); + // noLoop(); + // } + } + + void processImage() { + buffer.beginDraw(); + for (int x=0; x5?channel-6:channel; + float cc; + + switch(ch) { + case RED: + cc = red(c); + break; + case GREEN: + cc = green(c); + break; + case BLUE: + cc = blue(c); + break; + case HUE: + cc = hue(c); + break; + case SATURATION: + cc = saturation(c); + break; + default: + cc= brightness(c); + break; + } + + return channel>5?255-cc:cc; + } +} diff --git a/secondapplet.pde b/secondapplet.pde index 804e5e6..de60d87 100644 --- a/secondapplet.pde +++ b/secondapplet.pde @@ -1,5 +1,7 @@ //contains the GUI (ie CP5) in the secondapplet. also contains 3 classes: shaderManager, Brick and Slider +/* todo: implement "solo" and "only up till here" button on bricks */ + PImage bin; int maxSurfaceHeight = 500; int nativeResoX, nativeResoY; @@ -590,6 +592,15 @@ public class SecondApplet extends PApplet { case(19): shaderManager.addShader(new MASK()); break; + case(20): + shaderManager.addShader(new DRAWSTROKES()); + break; + case(21): + shaderManager.addShader(new DRAWGENERATIVE()); + break; + case(22): + shaderManager.addShader(new PIXELDRIFTER()); + break; /* case(4): shaderManager.addShader(new AUECHO()); diff --git a/statics_and_lists.pde b/statics_and_lists.pde index 8576813..f7961b5 100644 --- a/statics_and_lists.pde +++ b/statics_and_lists.pde @@ -64,8 +64,8 @@ String availableFx[] = { "fxSubtleSort", "fxScanker", "Mask", - "fxMosh", + "fxDrawStrokes", + "fxDrawGenerative", "fxPixelDrifter", - "fxDrawGenerative", - "fxDrawStrokes" + "fxMosh" };