Search this API

y.view
Class GraphicsContext

java.lang.Object
  extended by y.view.GraphicsContext

public class GraphicsContext
extends java.lang.Object

Provides additional context information to implementations during painting and rendering. An instance of this class can be obtained from the Graphics2D context that is passed to the various paint(Graphics2D g) methods spread throughout the library that work in the context of rendering the contents of a Graph2DView. The view will create the context instance and register it with the graphics object using the YRenderingHints.GRAPHICS_CONTEXT_KEY. This instance can then be retrieved via the key or the YRenderingHints.getGraphicsContext(java.awt.Graphics2D) convenience method.

See Also:
Graph2DView.createGraphicsContext(), YRenderingHints.GRAPHICS_CONTEXT_KEY
 
Your browser does not support SVG content.

Constructor Summary
GraphicsContext()
           
 
Method Summary
 Graph2DView getGraph2DView()
          Yields the view that is currently being painted on.
 java.awt.geom.AffineTransform getViewTransform()
          Yields the transform that can be set on the graphics object to paint in the view coordinate system.
 boolean isExportPainting()
          Indicates whether the current painting process is used to export the graphics.
 boolean isPrinting()
          Indicates whether the current graphics should use printing quality.
 void setExportPainting(boolean exportPainting)
          Indicates whether the current painting process is used to export the graphics.
 void setGraph2DView(Graph2DView graph2DView)
          Sets the view for retrieval in getGraph2DView().
 void setPrinting(boolean printing)
          Indicates whether the current graphics should use printing quality.
 void setViewTransform(java.awt.geom.AffineTransform viewTransform)
          Sets the value of the view transform for retrieval in getViewTransform().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsContext

public GraphicsContext()
Method Detail

getViewTransform

public java.awt.geom.AffineTransform getViewTransform()
Yields the transform that can be set on the graphics object to paint in the view coordinate system.

Returns:
The transform to set on the graphics object to paint in view coordinates.
See Also:
setViewTransform(java.awt.geom.AffineTransform)

setViewTransform

public void setViewTransform(java.awt.geom.AffineTransform viewTransform)
Sets the value of the view transform for retrieval in getViewTransform(). Normally you don't have to call this method, the view will populate the property initially.

Parameters:
viewTransform - the new transform.

getGraph2DView

public Graph2DView getGraph2DView()
Yields the view that is currently being painted on.

Returns:
the view that generated the initial paint request.

setGraph2DView

public void setGraph2DView(Graph2DView graph2DView)
Sets the view for retrieval in getGraph2DView(). Normally you don't have to call this method, the view will populate the property initially.

Parameters:
graph2DView - the new view.

setPrinting

public void setPrinting(boolean printing)
Indicates whether the current graphics should use printing quality. This property is set to true by the graph view if Graph2DView.print(java.awt.Graphics) is called. However client code could set this property to other values if desired.

Parameters:
printing - whether the rendering should be of print quality.

isPrinting

public boolean isPrinting()
Indicates whether the current graphics should use printing quality.

Returns:
whether the rendering should be of print quality.

isExportPainting

public boolean isExportPainting()
Indicates whether the current painting process is used to export the graphics. Client code can react to that flag and use export quality or suppress rendering of graphics that is not meant for export, e.g.

Returns:
Whether the current painting is done for exporting purposes.

setExportPainting

public void setExportPainting(boolean exportPainting)
Indicates whether the current painting process is used to export the graphics. Client code can react to that flag and use export quality or suppress rendering of graphics that is not meant for export, e.g. By default this flag is set to false.

Parameters:
exportPainting - Whether the current painting is done for exporting purposes.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.