|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecty.io.IOHandler
y.io.ImageOutputHandler
public abstract class ImageOutputHandler
Abstract base class for IOHandlers that produce image based
output formats.
The encoding process is done in two steps. First the
graph will be renderer to an image. Rendering upon an image
is done by calling method Graph2DView.paintVisibleContent(Graphics2D)
on the current view of the Graph2D. Configuring the view
influences size, viewport, background, etc. of the rendered
image.
In the second step the image is taken and encoded to the
output format.
![]() |
![]() |
Constructor Summary | |
---|---|
protected |
ImageOutputHandler()
|
protected |
ImageOutputHandler(boolean antialias)
|
Method Summary | |
---|---|
boolean |
canRead()
Returns false, since this class can't read a graph. |
Graph2DView |
createDefaultGraph2DView(Graph2D graph)
Creates the default view used as image producer in case there is no current view associated with the graph2D. |
protected GraphicsContext |
createGraphicsContext(Graph2DView view,
java.awt.Graphics2D g2d)
Factory method that creates the GraphicsContext that will be used
for the graphics object during the rendering of the image. |
protected abstract java.awt.image.BufferedImage |
createImage(int width,
int height)
Creates the buffered image on which the graph will be rendered. |
protected abstract void |
encode(java.awt.image.BufferedImage image,
java.io.OutputStream out)
Encodes the given image to the given output stream. |
double |
getBorder()
Gets the width for the view insets when using createDefaultGraph2DView(y.view.Graph2D) . |
boolean |
isAntialiasingEnabled()
Getter for property antialias. |
boolean |
isSelectionPaintingEnabled()
Determines whether or not the selection state of graph elements should be taken into account when writing the image
produced by this image output handler. |
void |
read(Graph2D graph,
java.io.InputStream in)
Unsupported method. |
void |
setAntialiasingEnabled(boolean antialias)
Setter for property antialias. |
void |
setBorder(double border)
Sets the width for the view insets when using createDefaultGraph2DView(y.view.Graph2D) . |
void |
setSelectionPaintingEnabled(boolean enabled)
Specifies whether or not the selection state of graph elements should be taken into account when writing the image
produced by this image output handler. |
void |
write(Graph2D graph,
java.io.OutputStream out)
Writes the contents of the given graph to the image based format encoded by this class. |
void |
write(Graph2DView view,
java.io.OutputStream out)
Writes the contents of the given Graph2dView to the image based format encoded by this class. |
Methods inherited from class y.io.IOHandler |
---|
canWrite, canWriteSubset, createObjectInputStream, createObjectOutputStream, getFileFormatString, getFileNameExtension, hide, read, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ImageOutputHandler()
protected ImageOutputHandler(boolean antialias)
Method Detail |
---|
public boolean isSelectionPaintingEnabled()
writing
the image
produced by this image output handler.
By default, this setting is true
.
true
if the selection state of graph elements is
taken into account; false
otherwise.setSelectionPaintingEnabled(boolean)
public void setSelectionPaintingEnabled(boolean enabled)
writing
the image
produced by this image output handler.
By default, this setting is true
.
enabled
- if true
the selection state of graph elements
is taken into account otherwise it is ignored.isSelectionPaintingEnabled()
public boolean canRead()
canRead
in class IOHandler
public void read(Graph2D graph, java.io.InputStream in)
read
in class IOHandler
public void write(Graph2D graph, java.io.OutputStream out) throws java.io.IOException
write(y.view.Graph2DView,java.io.OutputStream)
.
write
in class IOHandler
graph
- the graph to be encoded.out
- The OutputStream being written to.
java.io.IOException
public void write(Graph2DView view, java.io.OutputStream out) throws java.io.IOException
view
- the view whose contents should be encoded.out
- The OutputStream being written to.
java.lang.IllegalArgumentException
- if
view.getCanvasSize().width * view.getCanvasSize().height > Integer.MAX_VALUE
.
java.io.IOException
- if an error occurs during writing.protected GraphicsContext createGraphicsContext(Graph2DView view, java.awt.Graphics2D g2d)
GraphicsContext
that will be used
for the graphics object during the rendering of the image.
This implementation sets the GraphicsContext.isExportPainting()
property to true
.
view
- the view that will be used for the painting.g2d
- the graphics object to use for the painting
null
.protected abstract java.awt.image.BufferedImage createImage(int width, int height)
public Graph2DView createDefaultGraph2DView(Graph2D graph)
Graph2D.removeView(y.view.View)
protected abstract void encode(java.awt.image.BufferedImage image, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
- if an error occurs during writing.public boolean isAntialiasingEnabled()
public void setAntialiasingEnabled(boolean antialias)
antialias
- New value of property antialias.public double getBorder()
createDefaultGraph2DView(y.view.Graph2D)
.
Default value is 10.
setBorder(double)
public void setBorder(double border)
createDefaultGraph2DView(y.view.Graph2D)
.
Default value is 10.
border
- getBorder()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |