vialab / SMT

Simple Multi-Touch (SMT) Toolkit
http://vialab.science.uoit.ca/smt
GNU General Public License v3.0
43 stars 18 forks source link

Put a SVG into a Zone #199

Closed x3sp3d3s closed 10 years ago

x3sp3d3s commented 10 years ago

Hi, I need to put a SVG file into a Zone, or ImageZone, but this kind of format is not supported and i can't use it. I'm developing and application like the example "PhotoAppPhysics", and i need a zone with a SVG bar chart. I need to rotate, translate and scale it. Can anybody help me?? Thanks, and sorry for my English.

mshancock commented 10 years ago

Processing has support for SVG files through PShape. You should be able to use loadShape in the setup method, create a Zone, and then when that zone is drawn, use the shape method to render that SVG.

Something like:

import vialab.SMT.*;

PShape s;

void setup() {
  size(displayWidth, displayHeight, SMT.RENDERER);
  SMT.init( this, TouchSource.AUTOMATIC);

  // Creates a zone
  Zone z = new Zone("svgZone", 10, 10, 50, 50);
  s = loadShape("test.svg");

  // Need to add the zone to the SMT
  SMT.add(z);
}

void drawSvgZone(Zone z){
  shape(s,0,0,50,50);
}
x3sp3d3s commented 10 years ago

Thanks a lot, it's working!!!!