Do you want to give something back to this project? I'm interested in redesigning my java.net page. If you're any good at web design, please get in touch and help me give it a facelift.

Strokes: a brush stroke

When I set out to explore the subject of custom strokes, I was surprised to find only a few resources on the subject:
  • Jerry Huxtable has an excellent page detailing a few specialized strokes.
  • Vincent Hardy's book contains a nice wave stroke.
  • David Flanagan covered the topic in "Java Examples in a Nutshell" (see this page for details).


  • But none of those examples had the hand-made feel I was aiming for recently in a particular project. So I decided to make my own stroke that resembled an artist's paint brush. Here's what I ended up with:





    The rendering time is very reasonable, and the implementation is surprisingly simple: just trace the path several times with a thin stroke, each stroke being a little bit offset to the path itself.

    OK, it is a little bit more complicated than that, but that's the basic concept. I'm sure there's still room for improvement, but here is the current release of the BrushStroke class. I'd love some feedback. Or comments.

    1 comment:

    1. Hi.
      I was searching for an idea to implement a stroke in Processing (a Java derivative) and stumbled on yr page. Great idea to implement it!
      Alex, Italy

      ReplyDelete