Search in sources :

Example 1 with GraphGraphics

use of org.cytoscape.graph.render.immed.GraphGraphics in project cytoscape-impl by cytoscape.

the class InnerCanvas method setBounds.

@Override
public void setBounds(int x, int y, int width, int height) {
    super.setBounds(x, y, width, height);
    if ((width > 0) && (height > 0)) {
        final Image img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        GraphGraphics grafx = new GraphGraphics(img, false, true);
        synchronized (m_lock) {
            m_grafx = grafx;
            if (m_view != null)
                m_view.setViewportChanged();
        }
    }
}
Also used : GraphGraphics(org.cytoscape.graph.render.immed.GraphGraphics) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage)

Example 2 with GraphGraphics

use of org.cytoscape.graph.render.immed.GraphGraphics in project cytoscape-impl by cytoscape.

the class GraphRendererTest method setUp.

public void setUp() {
    Image img = new BufferedImage(500, 500, BufferedImage.TYPE_INT_ARGB);
    grafx = new GraphGraphics(img, false, true);
}
Also used : GraphGraphics(org.cytoscape.graph.render.immed.GraphGraphics) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage)

Example 3 with GraphGraphics

use of org.cytoscape.graph.render.immed.GraphGraphics in project cytoscape-impl by cytoscape.

the class DGraphView method drawSnapshot.

/**
 * This method is called by the BirdsEyeView to get a snapshot of the graphics.
 */
// TODO: Need to fix up scaling and sizing.
public void drawSnapshot(VolatileImage img, GraphLOD lod, Paint bgPaint, double xMin, double yMin, double xCenter, double yCenter, double scaleFactor) {
    // First paint the background
    m_backgroundCanvas.drawCanvas(img, xMin, yMin, xCenter, yCenter, scaleFactor);
    // final VisualMappingManager vmm = serviceRegistrar.getService(VisualMappingManager.class);
    final Set<VisualPropertyDependency<?>> dependencies = vmm.getVisualStyle(this).getAllVisualPropertyDependencies();
    // synchronized (m_lock) {
    try {
        // System.out.println("Calling renderGraph to draw snapshot: bgPaint="+bgPaint);
        GraphRenderer.renderGraph(this, dummySpacialFactory.createSpacialIndex2D(), lod, m_nodeDetails, m_edgeDetails, new LongHash(), new GraphGraphics(img, false, false), bgPaint, xCenter, yCenter, scaleFactor, haveZOrder, dependencies);
    } catch (Exception e) {
        // We probably had a node or edge view removed out from underneath us.  Just quietly return, but
        // set content changed so we redraw again
        setContentChanged();
    }
    // }
    // Finally, draw the foreground
    m_foregroundCanvas.drawCanvas(img, xMin, yMin, xCenter, yCenter, scaleFactor);
}
Also used : LongHash(org.cytoscape.util.intr.LongHash) VisualPropertyDependency(org.cytoscape.view.vizmap.VisualPropertyDependency) GraphGraphics(org.cytoscape.graph.render.immed.GraphGraphics) IOException(java.io.IOException)

Example 4 with GraphGraphics

use of org.cytoscape.graph.render.immed.GraphGraphics in project cytoscape-impl by cytoscape.

the class InnerCanvas method printNoImposter.

@Override
public void printNoImposter(Graphics g) {
    isPrinting = true;
    final Image img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
    if (m_view != null)
        renderGraph(new GraphGraphics(img, false, false), /* setLastRenderDetail = */
        false, m_view.m_printLOD);
    isPrinting = false;
}
Also used : GraphGraphics(org.cytoscape.graph.render.immed.GraphGraphics) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage)

Example 5 with GraphGraphics

use of org.cytoscape.graph.render.immed.GraphGraphics in project cytoscape-impl by cytoscape.

the class InnerCanvas method print.

@Override
public void print(Graphics g) {
    isPrinting = true;
    final int w = getWidth();
    final int h = getHeight();
    if (m_view != null && w > 0 && h > 0)
        renderGraph(new GraphGraphics(new ImageImposter(g, w, h), /* debug = */
        false, /* clear = */
        false), /* setLastRenderDetail = */
        false, m_view.m_printLOD);
    isPrinting = false;
}
Also used : GraphGraphics(org.cytoscape.graph.render.immed.GraphGraphics) Point(java.awt.Point) ImageImposter(org.cytoscape.graph.render.export.ImageImposter)

Aggregations

GraphGraphics (org.cytoscape.graph.render.immed.GraphGraphics)5 Image (java.awt.Image)3 BufferedImage (java.awt.image.BufferedImage)3 Point (java.awt.Point)1 IOException (java.io.IOException)1 ImageImposter (org.cytoscape.graph.render.export.ImageImposter)1 LongHash (org.cytoscape.util.intr.LongHash)1 VisualPropertyDependency (org.cytoscape.view.vizmap.VisualPropertyDependency)1