Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract WebcamPanel painter interface
fixes #5
- Loading branch information
Showing
20 changed files
with
648 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>webcam-capture-example-painter</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# 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](http://www.jhlabs.com/)_ | ||
which descriptions be found **[here](http://www.jhlabs.com/ip/filters/)** and which can be | ||
[downloaded](http://search.maven.org/#artifactdetails|com.jhlabs|filters|2.0.235|jar) from Maven Central. | ||
|
||
[Look and Feel](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html) | ||
used in all examples can be found in [Insubstantial](https://github.com/Insubstantial/insubstantial) project. | ||
The one I used in this example is `SubstanceTwilightLookAndFeel`. Thank you | ||
_[Kirill](http://www.linkedin.com/in/kirillcool)_ for this awesome Look and Feel stuff! | ||
|
||
### Screenshoots: | ||
|
||
Capturing is disabled: | ||
|
||
![Capturing Disabled](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/not-displayed.png "Capturing Disabled") | ||
|
||
Possible filters (only few from whole JS Labs filters set): | ||
|
||
![Filters](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/filters.png "Filters") | ||
|
||
Crystallize filter: | ||
|
||
![Crystallize](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/crystallize.png "Crystallize") | ||
|
||
Dither filter: | ||
|
||
![Dither](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/dither.png "Dither") | ||
|
||
Invert filter: | ||
|
||
![Invert](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/invert.png "Invert") | ||
|
||
Kaleidoscope filter: | ||
|
||
![Kaleidoscope](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/kaleidoscope.png "Kaleidoscope") | ||
|
||
Noise filter: | ||
|
||
![Noise](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/noise.png "Noise") | ||
|
||
Sphere filter: | ||
|
||
![Sphere](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/sphere.png "Sphere") | ||
|
||
Threshold filter: | ||
|
||
![Threshold](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-painter/src/etc/resources/threshold.png "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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.github.sarxos</groupId> | ||
<artifactId>webcam-capture-examples</artifactId> | ||
<version>0.3.5</version> | ||
</parent> | ||
|
||
<artifactId>webcam-capture-example-painter</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Webcam Capture - Custom Painter Example</name> | ||
<description>Example of how to create custom painter for WebcamPanel component</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.sarxos</groupId> | ||
<artifactId>webcam-capture</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.insubstantial</groupId> | ||
<artifactId>substance</artifactId> | ||
<version>7.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.jhlabs</groupId> | ||
<artifactId>filters</artifactId> | ||
<version>2.0.235</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Binary file added
BIN
+79.9 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/crystallize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+76.5 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/dither.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.5 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/filters.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+237 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/invert.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+255 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/kaleidoscope.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+312 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/noise.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+70.1 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/not-displayed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+236 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/sphere.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.6 KB
webcam-capture-examples/webcam-capture-painter/src/etc/resources/threshold.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.