Skip to content

Instantly share code, notes, and snippets.

@jsundram
Last active April 2, 2016 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsundram/bc965876c3aba66c56217e3adba10b45 to your computer and use it in GitHub Desktop.
Save jsundram/bc965876c3aba66c56217e3adba10b45 to your computer and use it in GitHub Desktop.
# Code for https://github.com/processing/processing/issues/4376
blend_mode=SUBTRACT
# try the rendering modes listed in: processing/core/src/processing/core/PConstants.java
# P2D & P3D render differently than JAVA2D (which looks like the default)
# See output pngs.
render_mode='default' # JAVA2D, P2D, P3D
"""
static final String JAVA2D = "processing.awt.PGraphicsJava2D";
static final String P2D = "processing.opengl.PGraphics2D";
static final String P3D = "processing.opengl.PGraphics3D";
"""
def setup():
size(600, 600)
blendMode(blend_mode)
noLoop()
def draw():
background(255)
fill(0)
text("Blend Mode: %s" % blend_mode, 20, 20)
text("Render Mode: %s" % render_mode, 20, 40)
# R, G, B
a = 255
colors = [color(255, 0, 0, a), color(0, 255, 0, a), color(0, 0, 255, a)]
r = height / 2
noStroke()
for i, c in enumerate(colors, 1):
fill(c)
ellipse(.25*i*width, height/2, r, r)
saveFrame('issue_4376_%sx%s.png' % (blend_mode, render_mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment