Files
processing4/android/examples/OpenGL/IO/LoadSVG/LoadSVG.pde
2012-07-29 00:40:36 +00:00

36 lines
654 B
Plaintext

PShape world;
float resizeFactor;
float offsetX, offsetY;
void setup() {
size(displayWidth, displayWidth, P2D);
orientation(LANDSCAPE);
world = loadShape("World_map-lowres.svg");
PVector top = world.getTop();
world.translate(-top.x, -top.y);
float r = world.getWidth() / world.getHeight();
float w = width;
float h = width / r;
if (height < h) {
h = height;
w = r * h;
offsetX = (width - w) / 2;
offsetY = 0;
} else {
offsetX = 0;
offsetY = (height - h) / 2;
}
resizeFactor = w / world.getWidth();
world.scale(resizeFactor);
}
public void draw() {
shape(world);
}