blend-modeclj

create-graphics

blend-modeclj

Arguments
[mode]
Docstring
Blends the pixels in the display window according to the defined mode.
There is a choice of the following modes to blend the source pixels (A)
with the ones of pixels already in the display window (B):

:blend      - linear interpolation of colours: C = A*factor + B
:add        - additive blending with white clip:
                                          C = min(A*factor + B, 255)
:subtract   - subtractive blending with black clip:
                                          C = max(B - A*factor, 0)
:darkest    - only the darkest colour succeeds:
                                          C = min(A*factor, B)
:lightest   - only the lightest colour succeeds:
                                          C = max(A*factor, B)
:exclusion  - similar to :difference, but less extreme.
:multiply   - Multiply the colors, result will always be darker.
:screen     - Opposite multiply, uses inverse values of the colors.
:replace    - the pixels entirely replace the others and don't utilize
              alpha (transparency) values

Note: :hard-light, :soft-light, :dodge, :overlay, :dodge, :burn, :difference
modes are not supported by this function.

factor is alpha value of pixel being drawed
Works only inside sketch functions?
Yes
Original Processing method
blendMode()

create-graphics

Arguments
[w h renderer path][w h][w h renderer]
Docstring
Creates and returns a new PGraphics object of the types :p2d, :p3d,
:java2d, :pdf. By default :java2d is used. Use this class if you
need to draw into an off-screen graphics buffer. It's not possible
to use create-graphics with the :opengl renderer, because it doesn't
allow offscreen use. The :pdf renderer requires the filename parameter.

Note: don't use create-graphics in draw in clojurescript, it leaks memory.
You should create graphic in setup and reuse it in draw instead of creating
a new one.

It's important to call any drawing commands between (.beginDraw graphics) and
(.endDraw graphics) statements or use with-graphics macro. This is also true
for any commands that affect drawing, such as smooth or color-mode.

If you're using :pdf renderer - don't forget to call (.dispose graphics)
as last command inside with-graphics macro, otherwise graphics won't be
saved.

Unlike the main drawing surface which is completely opaque, surfaces
created with create-graphics can have transparency. This makes it
possible to draw into a graphics and maintain the alpha channel. By
using save to write a PNG or TGA file, the transparency of the
graphics object will be honored.
Works only inside sketch functions?
Yes
Original Processing method
createGraphics()