プロ生のデモのソースを載せておきます.
processingです.
import oscP5.*; import netP5.*; import tuioZones.*; import processing.video.*; //キャプチャする映像のオブジェクトを用意 Capture myCapture; TUIOzoneCollection zones; PImage b; void setup() { size(screen.width,screen.height); // create a draggable, throwable, and scalable zone for a photo zones=new TUIOzoneCollection(this); zones.setZone("zone1", width/2,height/2,800,600); zones.setZoneParameter("zone1","DRAGGABLE",true); zones.setZoneParameter("zone1","THROWABLE",true); zones.setZoneParameter("zone1","SCALABLE",true); b = loadImage("photo.jpg"); noFill(); smooth(); myCapture = new Capture(this, 320, 240, 30); zones.setZone("zone2", 0,0,320,240); zones.setZoneParameter("zone2","DRAGGABLE",true); zones.setZoneParameter("zone2","THROWABLE",true); zones.setZoneParameter("zone2","SCALABLE",true); } void draw() { background(255); // use the zone coordinates and size to display the image image(myCapture, zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1")); image(b, zones.getZoneX("zone2"),zones.getZoneY("zone2"),zones.getZoneWidth("zone2"),zones.getZoneHeight("zone2")); // outline photo when pressed if (zones.isZonePressed("zone1")) { stroke(200,200,0); strokeWeight(4); rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1")); } if (zones.isZonePressed("zone2")) { stroke(200,200,0); strokeWeight(4); rect(zones.getZoneX("zone2"),zones.getZoneY("zone2"),zones.getZoneWidth("zone2"),zones.getZoneHeight("zone2")); } // draw the touch trails for testing hardware calibration int[][] coord=zones.getPoints(); stroke(100,100,100); strokeWeight(1); if (coord.length>0) { for (int i=0;i<coord.length;i++) { ellipse(coord[i][0],coord[i][1],20,20); int [][] trail=zones.getTrail(coord[i][2]); if (trail.length>1) { for (int j=1;j<trail.length;j++) { stroke(10); fill(200,200,200,200); line(trail[j][0],trail[j][1],trail[j-1][0],trail[j-1][1]); ellipse(trail[j][0],trail[j][1],5,5); println(trail[j][2] + "," + trail[j][3]); } } } } } //映像の読み込み void captureEvent(Capture myCapture) { myCapture.read(); }
import tuioZones.*; TUIOzoneCollection zones; import oscP5.*; import netP5.*; void setup() { size(screen.width, screen.height, P3D); zones=new TUIOzoneCollection(this); zones.setZoneParameter("canvas","WINDOW3D", true);//'canvas' is the default zone filling the screen zones.setZoneParameter("canvas","THROWABLE",true); } void draw() { background(255); fill(200); pushMatrix(); zones.applyZone3dMatrix("canvas"); box(300*zones.getZoneScale("canvas"));//scale gesture results are stored even though the zone is not set to scalable popMatrix(); }