This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Many thanks to Stefan for the initial version!
- Loading branch information
Frederik De Bleser
committed
Oct 27, 2010
1 parent
4ad7c80
commit 1b0b573
Showing
11 changed files
with
158 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
osgi.bundles=nodebox-core.jar@start,mvel2.jar@start,nodebox-builtins.jar@start,nodebox-graphics.jar@start,nodebox-app.jar@start | ||
osgi.bundles=nodebox-core.jar@start,mvel2.jar@start,nodebox-builtins.jar@start,nodebox-graphics.jar@start,nodebox-pixie.jar@start,nodebox-video.jar@start,nodebox-app.jar@start | ||
eclipse.ignoreApp=true |
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
Binary file not shown.
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 |
---|---|---|
@@ -1,11 +1,27 @@ | ||
package nodebox.pixie; | ||
|
||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: fdb | ||
* Date: Oct 27, 2010 | ||
* Time: 12:36:18 PM | ||
* To change this template use File | Settings | File Templates. | ||
*/ | ||
public class ImageNode { | ||
import nodebox.node.Context; | ||
import nodebox.node.ImagePort; | ||
import nodebox.node.Node; | ||
import nodebox.node.Port; | ||
import processing.core.PGraphics; | ||
import processing.core.PImage; | ||
|
||
public abstract class ImageNode extends Node { | ||
|
||
public final ImagePort pOutput = new ImagePort(this, "output", Port.Direction.OUTPUT); | ||
|
||
@Override | ||
public void execute(Context context, float time) { | ||
PImage image = cook(context, time); | ||
pOutput.set(image); | ||
} | ||
|
||
@Override | ||
public void draw(PGraphics g, Context context, float time) { | ||
g.image(pOutput.get(), 0, 0); | ||
} | ||
|
||
public abstract PImage cook(Context context, float time); | ||
|
||
} |
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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="NodeBox Pixie" default="dist"> | ||
|
||
<property name="src" value="src"/> | ||
<property name="lib" value="../lib"/> | ||
<property name="build" value="build"/> | ||
<property name="dist" value="../dist"/> | ||
|
||
<path id="build.classpath"> | ||
<path path="${dist}/nodebox-core.jar"/> | ||
<path path="${lib}/processing-core.jar"/> | ||
<path path="${lib}/processing-video.jar"/> | ||
<path path="${lib}/equinox.jar"/> | ||
</path> | ||
|
||
<target name="init"> | ||
<mkdir dir="${build}"/> | ||
</target> | ||
|
||
<target name="compile" depends="init"> | ||
<javac srcdir="${src}" destdir="${build}" classpathref="build.classpath" source="1.5" target="1.5"/> | ||
</target> | ||
|
||
<target name="embed-dependencies" depends="init"> | ||
<copy file="/System/Library/Java/Extensions/QTJava.zip" todir="${build}"/> | ||
<copy file="${lib}/processing-video.jar" todir="${build}"/> | ||
</target> | ||
|
||
<target name="dist" depends="compile,embed-dependencies"> | ||
<mkdir dir="${dist}"/> | ||
<jar jarfile="${dist}/nodebox-video.jar" basedir="${build}" manifest="manifest.mf"/> | ||
</target> | ||
|
||
<target name="clean"> | ||
<delete dir="${build}"/> | ||
<delete dir="${dist}"/> | ||
</target> | ||
|
||
</project> |
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,8 @@ | ||
Manifest-Version: 1 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-SymbolicName: nodebox.video | ||
Bundle-Name: Node-Video | ||
Bundle-Version: 1.0.0 | ||
Bundle-Activator: nodebox.video.VideoActivator | ||
Bundle-ClassPath: .,QTJava.zip,processing-video.jar | ||
Import-Package: org.osgi.framework, processing.core, nodebox.node, nodebox.util, javax.swing |
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,45 @@ | ||
package nodebox.video; | ||
|
||
import nodebox.node.*; | ||
import processing.core.PGraphics; | ||
|
||
@Description("Captures video images.") | ||
public class Capture extends Node { | ||
|
||
private static final int CAPTURE_WIDTH = 320; | ||
private static final int CAPTURE_HEIGHT = 240; | ||
private static final int CAPTURE_FRAME_RATE = 30; | ||
|
||
public final ImagePort pOutput = new ImagePort(this, "output", Port.Direction.OUTPUT); | ||
private processing.video.Capture capture; | ||
|
||
@Override | ||
public void activate() { | ||
// TODO: Capture should be initialized here, but activate/deactivate are run in a different thread, | ||
// causing a race condition. | ||
} | ||
|
||
@Override | ||
public void execute(Context context, float time) { | ||
if (capture == null) { | ||
capture = new processing.video.Capture(getScene().getApplet(), CAPTURE_WIDTH, CAPTURE_HEIGHT, CAPTURE_FRAME_RATE); | ||
} | ||
if (capture.available()) { | ||
capture.read(); | ||
} | ||
pOutput.set(capture.get()); | ||
} | ||
|
||
@Override | ||
public void draw(PGraphics g, Context context, float time) { | ||
g.image(pOutput.get(), 0, 0); | ||
} | ||
|
||
@Override | ||
public void deactivate() { | ||
capture.stop(); | ||
capture.dispose(); | ||
capture = null; | ||
} | ||
|
||
} |
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,25 @@ | ||
package nodebox.video; | ||
|
||
import nodebox.node.NodeManager; | ||
import org.osgi.framework.BundleActivator; | ||
import org.osgi.framework.BundleContext; | ||
import org.osgi.framework.ServiceReference; | ||
|
||
public class VideoActivator implements BundleActivator { | ||
|
||
public void start(BundleContext context) throws Exception { | ||
NodeManager m = getNodeManager(context); | ||
m.registerNodeClass(Capture.class, "Video"); | ||
} | ||
|
||
public void stop(BundleContext context) throws Exception { | ||
NodeManager m = getNodeManager(context); | ||
m.unregisterNodeClass(Capture.class); | ||
} | ||
|
||
private NodeManager getNodeManager(BundleContext context) { | ||
ServiceReference ref = context.getServiceReference(NodeManager.class.getName()); | ||
return (NodeManager) context.getService(ref); | ||
} | ||
|
||
} |