Keystone library: change form of layers
in
Contributed Library Questions
•
1 years ago
Hello,
I started working with the Keystone library (great!!!!)
When working with the basic example "Corner Pin" I asked myself how to change the form of the layers from a rectangle to a triangle. Right now you have a white rectangle with a green-filled circle in it. How can I change the form of the layer from a rectangle to a triangle? So do I have to change something about the createGraphics()?
This would be great!!!
- import deadpixel.keystone.*;
- Keystone ks;
- CornerPinSurface surface;
- PGraphics offscreen;
- void setup() {
- size(800, 600, P3D);
- ks = new Keystone(this);
- surface = ks.createCornerPinSurface(400, 300, 20);
- offscreen = createGraphics(400, 300, P2D);
- }
- void draw() {
- PVector surfaceMouse = surface.getTransformedMouse();
- offscreen.beginDraw();
- offscreen.background(0);
- offscreen.fill(0, 255, 0);
- offscreen.ellipse(surfaceMouse.x, surfaceMouse.y, 75, 75);
- 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;
- }
- }
1