README.md

Webcam Capture Custom Painter Example

This simple example show how to create custom painter for WebcamCapture Swing component used to draw images from Webcam instance.

What Is This

This example presents how to use custom painters to alter image displayed in WebcamPanel component. Usually, if user won't change it, DefaultPainter is being used. This painter implements Painter interface which consists of two methods:

  • paintPanel(WebcamPanel wp, Graphics2D g2) which paints panel when image from camera is not disdplayed, and second one,
  • paintImage(WebcamPanel wp, BufferedImage img, Graphics2D g2) which pains image from camera when camera is turned on.

In this example I used filters from awesome image processing library by Jerry Huxtable Labs which descriptions be found here and which can be downloaded from Maven Central.

Look and Feel used in all examples can be found in Insubstantial project. The one I used in this example is SubstanceTwilightLookAndFeel. Thank you Kirill for this awesome Look and Feel stuff!

Screenshoots:

Capturing is disabled:

Capturing Disabled

Possible filters (only few from whole JS Labs filters set):

Filters

Crystallize filter:

Crystallize

Dither filter:

Dither

Invert filter:

Invert

Kaleidoscope filter:

Kaleidoscope

Noise filter:

Noise

Sphere filter:

Sphere

Threshold filter:

Threshold

License

Copyright (C) 2012 Bartosz Firyn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.