2

I've written a simple script that generates three lines in random positions on a grid. Each line is specific colour - it's for a logo. I want to use the multiply blend mode, but it creates jagged imagery. Any ideas on how to fix this issue?

// open_lab_logo

size (900, 900); smooth(); 
background (255); 
blendMode(MULTIPLY); 
strokeWeight(100);

float x1 = random(1, 8) * 100; 
float y1 = random(1, 8) * 100; 
float x2 = random(1, 8) * 100; 
float y2 = random(1, 8) * 100; 
float x3 = random(1, 8) * 100; 
float y3 = random(1, 8) * 100; 
float x4 = random(1, 8) * 100; 
float y4 = random(1, 8) * 100;

stroke(#FFDB23); line(x1, y1, x2, y2);

stroke(#E41F7B); line(x2, y2, x3, y3);

stroke(#00A8E4); line(x3, y3, x4, y4);

image example

Lachie9383
  • 23
  • 5
  • 1
    That doesn't happen when I run your sketch. Also, have you posted this on the processing forum as well? If so, please link between your crossposts. – Kevin Workman May 13 '15 at 13:22
  • 1
    Looks like there are still unresolved issues with `blendMode` so it depends on which version of processing are you using and on which OS for more info [see](https://github.com/processing/processing/issues/2012). Also your problem is more significant because of very high value of `strokeWeight`. – Majlik May 13 '15 at 13:24
  • I would agree with @Majlik – try it with rectangles and see what happens. It does render fine on my computer (Mac, Processing 3.0a4). – JeffThompson May 13 '15 at 13:30

2 Answers2

0

This is a known bug in Processing 2. Here is the bug, and here is the fix. This fix was first included in Processing 3.0a1 (source).

I tried this on Processing 2.2.1, and I got the same artifacts as you. I tried this on Processing 3.0a5, and it worked fine.

The solution is to switch to Processing 3. If you really, really, really need to stick with Processing 2, then you'll have to build from source and include this specific fix. But you probably shouldn't be using Processing 2 anyway.

Kevin Workman
  • 41,537
  • 9
  • 68
  • 107
  • Thank you very much! I didn't realise Processing 3 was available. I've upgraded and all my problems have been solved. – Lachie9383 May 13 '15 at 22:48
0

A simpler fix is to specify the P2D renderer:

size (900, 900, P2D);