Layers (a sketch for painting) updated 26 april 2017

edited April 26 in Share Your Work

A sketch for painting (updated 26 april 2017).
1) Web brush
2) Stamp brush user defined (capture an area and use it as brush)
3) More preset for DynaDraw (random too)
4) Manual (PDF) (press F1 to view)
Download layers
'TAB' toggle menu on/off
'P' pencil
'L' Liner
'Q' quad
'C' circle
'E' eraser
'F' fill
Zoom with 'z' (then +/- to change magnify)
'U' Undo (10)
'R' Redo
'X' draw with X mirror
'Y' draw with Y mirror
'[' and ']' -/+ brush size
CTRL-drag on canvas --> change brush size
'Backspace' Clear active layer
'Space' toggle active layer visibility
CTRL-click on layer name to rename it
UP and DOWN arrows change order of layers
LEFT and RIGHT arrows change palette
'1..6' set active layer 1..6
Press SHIFT to pick a color from active layer CTRL-click on +/- --> +/- 10
ALT-click on +/- --> +/- 100
'G' snap to grid (liner, quad and circle)
'K' constrain quad and circle to square and circumference
'ESC' change cursor color (white/black)
'H' to highlight cursor (for small brush size)
'.' to hide layer control
'I' Ink brush
'T' Stamp brush
'D' DynaDraw (Paul Haeberli 1989)
'M' Mixer brush 'N' Clone brush 'B' web brush
See keyboard.pde for all defined shortcuts.
Hints and bugs report are welcome :)

p.s. menu and more layers are cpu intensive... then draw with menu off.



  • edited February 22

    Nice work ! The GUI is cool.
    I have noticed some fps drops while drawing (drop to 20).

  • @Castaneche: not optimized :(
    Try to draw with menu off.

  • You do not like this program? :)
    I'm looking for suggestions for improvement ... ;)

  • It is really good work. Thxs for sharing!


  • update 28 february 2017 :)

  • edited April 20

    Update version 5 march 2017.
    With layers, undo, redo, snap to grid, X and Y mirror...

  • Kudos @cameyo! It looks pretty neat.


  • edited March 12

    Very nice program. A couple minor suggestions:

    1. Permit keyboard value entry for colors, so I can type a value like 243.

    2. Support the use of Shift when drawing shapes and lines.
          This will draw vertical or horizontal or 45 degree diagonal lines and perfect squares or circles.

    3. Put a wire handle on your paint bucket icon to make is clearer as to the function.

    4. I may be missing something, the menu obscures a portion of the canvas. Either restrict the canvas to the visible portion or add a menu feature to hide/show or make it it's own window, permitting full visibility of the canvas. Or maybe make the menu a dummy layer. --- Never mind I found the Tab hide/show menu feature.

    A very nice program, I will be using some of the approaches myself. Thanks for sharing.

  • Minor bug: Typo, no uppercase w:

    if ((key=='w') || (key=='w'))

  • edited March 13

    @jas0501: thanks for your hints.
    1) i find click (+/- 1), control+click (+/- 10), and alt-click(+/- 100) are good to change RGB and HSB.
    2) you can press 'k' when drawing to draw perfect square and circle. For lines you can snap to grid to allow 45 degree or similar.
    3) i will change the paint bucket icon :-)
    Feel free to use all the code you need ;;)
    I have posted a new version (see first post to download).
    - Added an HSB color selector (shift-click to select color, shift+right click to move HSB control, space to hide/show).
    - Added a function to 'j' key to draw a palette at mouse position with 11 colors ( from current color to old color).
    - now open and save functions are folder based (select a folder to save or open all the layers). More, you can load an image on a layer.
    p.s. see the keyboard.pde file to see all the shortcuts ;)

  • edited April 4

    New version with DynaDraw brush (
    Paul Haeberli (1989):
    "The program Dynadraw implements a dynamic drawing technique that applies
    a simple filter to mouse positions. Here the brush is modeled as a physical
    object with mass, velocity and friction. The mouse pulls on the brush with
    a synthetic rubber band. By changing the amount of friction and mass, various
    kinds of strokes can be made. This kind of dynamic filtering makes it easy
    to create smooth, consistent calligraphic strokes."
    It's very fun.

    k -> hooke constant
    m -> mass value
    f -> friction (damping) value
    d -> ductus (pression/velocity brush size)
    b -> min brush size
    B -> max brush size

  • edited April 7

    Nice work, I downloaded the project and I'd like to rewrite your HSBcontrol, making it bigger and faster.

    online example

  • Far better than mine :)>-
    Fell free to do what you want with it. :)

  • New version with Stamp brush, HSB bigger and faster, Manual (PDF).
    Have a nice day.

  • New version with Mixer/Smudge brush, better Stamp brush and Manual (PDF).

  • This project has really come a long way in a short time, @cameyo -- hard to believe that your "Pencil Kid" sketch was only two months ago.

  • @jeremydouglass: it would not have been possible without the help of people like you :)

  • edited April 23

    New version with:
    1) Clone brush (with Aligned option) (right click to set clone start point)
    2) better Mixer/Smudge brush (linear smudge)
    3) select color from HSB control with right button click
    4) Manual (PDF) (press F1)

  • New version with:
    1) Web brush
    2) Stamp brush user defined (capture an area and use it as brush)
    3) More preset for DynaDraw (random too)
    4) Manual (PDF) (press F1 to view)


Sign In or Register to comment.