Drawing tool in a combination with the Keystone library
in
Contributed Library Questions
•
6 months ago
Hello,
I hope someone can help me. Im working on a simple video mapping tool, it has to be a simple prototype.
The problem that i have is that i have to combine these two codes.:
import deadpixel.keystone.*;
import processing.video.*;
Keystone ks;
CornerPinSurface surface;
PGraphics offscreen;
Movie mov;
void setup() {
size(800, 600, P3D);
ks = new Keystone(this);
surface = ks.createCornerPinSurface( 550, 400,10);
offscreen = createGraphics(550, 400, P3D);
mov = new Movie(this, "animatie.mov");
mov.loop();
}
void movieEvent(Movie movie) {
mov.read();
}
void draw() {
PVector surfaceMouse = surface.getTransformedMouse();
offscreen.beginDraw();
offscreen. image(mov,0,0);
offscreen.endDraw();
background(0);
surface.render(offscreen);
}
void keyPressed() {
switch(key) {
case 'c':
ks.toggleCalibration();
break;
case 'l':
ks.load();
break;
case 's':
ks.save();
break;
}
}
And this one
import processing.video.*;
import deadpixel.keystone.*;
Movie myMovie;
PGraphics topLayer;
void setup()
{
size(640, 480);
myMovie = new Movie(this, "animatie.mov");
myMovie.loop();
topLayer = createGraphics(width, height, g.getClass().getName());
}
void movieEvent(Movie myMovie)
{
myMovie.read();
}
void draw()
{
image(myMovie, 0,0, width, height);
topLayer.beginDraw();
topLayer.fill(1);
topLayer.ellipse( pmouseX, pmouseY, 50, 50 );
topLayer.endDraw();
image( topLayer, 0, 0 );
}
I hope someone can help me!
1