|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.view.SoftwareCanvasDrawer
public class SoftwareCanvasDrawer
This is a CanvasDrawer which implements a software renderer for generating the contents of a ViewerCanvas.
Constructor Summary | |
---|---|
SoftwareCanvasDrawer(ViewerCanvas view)
|
Method Summary | |
---|---|
void |
drawBorder()
Draw a border around the rendered image. |
void |
drawBox(int x,
int y,
int width,
int height,
java.awt.Color color)
Draw a filled box in the rendered image. |
void |
drawBoxes(java.util.List<java.awt.Rectangle> box,
java.awt.Color color)
Draw a set of filled boxes in the rendered image. |
void |
drawDraggedShape(java.awt.Shape shape)
Show feedback to the user in response to a mouse drag, by drawing a Shape over the image. |
void |
drawHRule(int y,
java.awt.Color color)
Draw a horizontal line across the rendered image. |
void |
drawImage(java.awt.Image image,
int x,
int y)
Draw an image onto the canvas. |
void |
drawLine(java.awt.Point p1,
java.awt.Point p2,
java.awt.Color color)
Draw a line into the rendered image. |
void |
drawShape(java.awt.Shape shape,
java.awt.Color color)
Draw the outline of a Shape into the canvas. |
void |
drawString(java.lang.String text,
int x,
int y,
java.awt.Color color)
Draw a piece of text onto the canvas. |
void |
drawVRule(int x,
java.awt.Color color)
Draw a vertical line across the rendered image. |
void |
fillShape(java.awt.Shape shape,
java.awt.Color color)
Draw a filled Shape onto the canvas. |
java.awt.image.BufferedImage |
getImage()
Get the most recent rendered image. |
void |
imageChanged(java.awt.Image image)
This should be called to indicate that a previously drawn image has changed, and cached information for it needs to be discarded. |
void |
paint(RepaintEvent ev)
|
void |
renderBox(int x,
int y,
int width,
int height,
double depth,
java.awt.Color color)
Render a filled box at a specified depth in the rendered image. |
void |
renderBoxes(java.util.List<java.awt.Rectangle> box,
java.util.List<java.lang.Double> depth,
java.awt.Color color)
Render a set of filled boxes at specified depths in the rendered image. |
void |
renderImage(java.awt.Image image,
Vec3 p1,
Vec3 p2,
Vec3 p3,
Vec3 p4,
Camera camera)
Render an image onto the canvas. |
void |
renderLine(Vec2 p1,
double zf1,
Vec2 p2,
double zf2,
Camera cam,
java.awt.Color color)
Render a line into the image. |
void |
renderLine(Vec3 p1,
Vec3 p2,
Camera cam,
java.awt.Color color)
Render a line into the image. |
void |
renderMesh(RenderingMesh mesh,
VertexShader shader,
Camera cam,
boolean closed,
boolean[] hideFace)
Render a mesh to the canvas. |
void |
renderMeshTransparent(RenderingMesh mesh,
VertexShader shader,
Camera cam,
Vec3 viewDir,
boolean[] hideFace)
Render an object with flat shading in subtractive (transparent) mode. |
void |
renderWireframe(WireframeMesh mesh,
Camera cam,
java.awt.Color color)
Render a wireframe object. |
void |
setTemplateImage(java.awt.Image im)
Set the template image. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SoftwareCanvasDrawer(ViewerCanvas view)
Method Detail |
---|
public void setTemplateImage(java.awt.Image im)
setTemplateImage
in interface CanvasDrawer
public void drawDraggedShape(java.awt.Shape shape)
drawDraggedShape
in interface CanvasDrawer
public java.awt.image.BufferedImage getImage()
public void paint(RepaintEvent ev)
public void drawBorder()
drawBorder
in interface CanvasDrawer
public void drawHRule(int y, java.awt.Color color)
drawHRule
in interface CanvasDrawer
public void drawVRule(int x, java.awt.Color color)
drawVRule
in interface CanvasDrawer
public void drawBox(int x, int y, int width, int height, java.awt.Color color)
drawBox
in interface CanvasDrawer
public void drawBoxes(java.util.List<java.awt.Rectangle> box, java.awt.Color color)
drawBoxes
in interface CanvasDrawer
public void renderBox(int x, int y, int width, int height, double depth, java.awt.Color color)
renderBox
in interface CanvasDrawer
public void renderBoxes(java.util.List<java.awt.Rectangle> box, java.util.List<java.lang.Double> depth, java.awt.Color color)
renderBoxes
in interface CanvasDrawer
public void drawLine(java.awt.Point p1, java.awt.Point p2, java.awt.Color color)
drawLine
in interface CanvasDrawer
public void renderLine(Vec3 p1, Vec3 p2, Camera cam, java.awt.Color color)
renderLine
in interface CanvasDrawer
p1
- the first endpoint of the linep2
- the second endpoint of the linecam
- the camera from which to draw the linecolor
- the line colorpublic void renderLine(Vec2 p1, double zf1, Vec2 p2, double zf2, Camera cam, java.awt.Color color)
renderLine
in interface CanvasDrawer
p1
- the first endpoint of the line, in screen coordinateszf1
- the z coordinate of the first endpoint, in view coordinatesp2
- the second endpoint of the line, in screen coordinateszf2
- the z coordinate of the second endpoint, in view coordinatescam
- the camera from which to draw the linecolor
- the line colorpublic void renderWireframe(WireframeMesh mesh, Camera cam, java.awt.Color color)
renderWireframe
in interface CanvasDrawer
public void renderMeshTransparent(RenderingMesh mesh, VertexShader shader, Camera cam, Vec3 viewDir, boolean[] hideFace)
renderMeshTransparent
in interface CanvasDrawer
public void renderMesh(RenderingMesh mesh, VertexShader shader, Camera cam, boolean closed, boolean[] hideFace)
renderMesh
in interface CanvasDrawer
public void drawString(java.lang.String text, int x, int y, java.awt.Color color)
drawString
in interface CanvasDrawer
public void drawShape(java.awt.Shape shape, java.awt.Color color)
drawShape
in interface CanvasDrawer
public void fillShape(java.awt.Shape shape, java.awt.Color color)
fillShape
in interface CanvasDrawer
public void drawImage(java.awt.Image image, int x, int y)
drawImage
in interface CanvasDrawer
public void renderImage(java.awt.Image image, Vec3 p1, Vec3 p2, Vec3 p3, Vec3 p4, Camera camera)
renderImage
in interface CanvasDrawer
image
- the image to renderp1
- the coordinates of the first corner of the imagep2
- the coordinates of the second corner of the imagep3
- the coordinates of the third corner of the imagep4
- the coordinates of the fourth corner of the imagecamera
- the camera from which to draw the imagepublic void imageChanged(java.awt.Image image)
CanvasDrawer
imageChanged
in interface CanvasDrawer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |