rvg.keystone20
Class CornerPinSurface

java.lang.Object
  extended by rvg.keystone20.CornerPinSurface

public class CornerPinSurface
extends java.lang.Object

A simple Corner Pin keystoned surface. The surface is a quad mesh that can be skewed to an arbitrary shape by moving its four corners. September-2011 Added JAI library for keystone calculus (@edumo)


Method Summary
protected  void calculateMesh()
          Interpolates the position of the points in the mesh according to the 4 corners TODO: allow for abritrary control points, not just the four corners
 int getRes()
           
 processing.core.PVector getTransformedCursor(int cx, int cy)
          This function will give you the position of the mouse in the surface's coordinate system.
 processing.core.PVector getTransformedMouse()
           
 boolean isMouseOver()
          Returns true if the mouse is over this surface, false otherwise.
 void moveTo(float x, float y)
           
 void render(processing.core.PGraphics g, processing.core.PImage texture)
          Renders and applies keystoning to the image using a specific renderer.
 void render(processing.core.PImage texture)
          Renders and applies keystoning to the image using the parent applet's renderer.
 void setControlPointsColor(int newColor)
          Sets the control points color
 void setGridColor(int newColor)
          Sets the grid used for calibration's color
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRes

public int getRes()
Returns:
The surface's mesh resolution, in number of "tiles"

render

public void render(processing.core.PImage texture)
Renders and applies keystoning to the image using the parent applet's renderer.


render

public void render(processing.core.PGraphics g,
                   processing.core.PImage texture)
Renders and applies keystoning to the image using a specific renderer.


getTransformedCursor

public processing.core.PVector getTransformedCursor(int cx,
                                                    int cy)
This function will give you the position of the mouse in the surface's coordinate system.

Returns:
The transformed mouse position

getTransformedMouse

public processing.core.PVector getTransformedMouse()

setGridColor

public void setGridColor(int newColor)
Sets the grid used for calibration's color


setControlPointsColor

public void setControlPointsColor(int newColor)
Sets the control points color


isMouseOver

public boolean isMouseOver()
Returns true if the mouse is over this surface, false otherwise.


calculateMesh

protected void calculateMesh()
Interpolates the position of the points in the mesh according to the 4 corners TODO: allow for abritrary control points, not just the four corners


moveTo

public void moveTo(float x,
                   float y)
Parameters:
x - x-coordinate
y - y-coordinate This moves the surface according to the offset from where the mouse was pressed when selecting the surface.