Examples of mxICanvas


Examples of com.mxgraph.canvas.mxICanvas

      // be clipped
      Shape clip = null;
      Rectangle newClip = state.getRectangle();

      // Indirection for image canvas that contains a graphics canvas
      mxICanvas clippedCanvas = (isLabelClipped(state.getCell())) ? canvas
          : null;

      if (clippedCanvas instanceof mxImageCanvas)
      {
        clippedCanvas = ((mxImageCanvas) clippedCanvas)
View Full Code Here

Examples of com.mxgraph.canvas.mxICanvas

      // be clipped
      Shape clip = null;
      Rectangle newClip = state.getRectangle();

      // Indirection for image canvas that contains a graphics canvas
      mxICanvas clippedCanvas = (isLabelClipped(state.getCell())) ? canvas
          : null;

      if (clippedCanvas instanceof mxImageCanvas)
      {
        clippedCanvas = ((mxImageCanvas) clippedCanvas)
View Full Code Here

Examples of com.mxgraph.canvas.mxICanvas

   * @return Returns the image that represents the canvas.
   */
  public static mxICanvas drawCells(mxGraph graph, Object[] cells,
      double scale, mxRectangle clip, CanvasFactory factory)
  {
    mxICanvas canvas = null;

    if (cells == null)
    {
      cells = new Object[] { graph.getModel().getRoot() };
    }

    // Gets the current state of the view
    mxGraphView view = graph.getView();

    // Keeps the existing translation as the cells might
    // be aligned to the grid in a different way in a graph
    // that has a translation other than zero
    boolean eventsEnabled = view.isEventsEnabled();

    // Disables firing of scale events so that there is no
    // repaint or update of the original graph
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates temp = new mxTemporaryCellStates(view, scale,
        cells);

    try
    {
      if (clip == null)
      {
        clip = graph.getPaintBounds(cells);
      }

      if (clip != null && clip.getWidth() > 0 && clip.getHeight() > 0)
      {
        Rectangle rect = clip.getRectangle();
        canvas = factory.createCanvas(rect.width + 1, rect.height + 1);

        if (canvas != null)
        {
          double previousScale = canvas.getScale();
          Point previousTranslate = canvas.getTranslate();

          try
          {
            canvas.setTranslate(-rect.x, -rect.y);
            canvas.setScale(view.getScale());

            for (int i = 0; i < cells.length; i++)
            {
              graph.drawCell(canvas, cells[i]);
            }
          }
          finally
          {
            canvas.setScale(previousScale);
            canvas.setTranslate(previousTranslate.x,
                previousTranslate.y);
          }
        }
      }
    }
View Full Code Here

Examples of com.mxgraph.canvas.mxICanvas

      // be clipped
      Shape clip = null;
      Rectangle newClip = state.getRectangle();

      // Indirection for image canvas that contains a graphics canvas
      mxICanvas clippedCanvas = (isLabelClipped(state.getCell())) ? canvas
          : null;

      if (clippedCanvas instanceof mxImageCanvas)
      {
        clippedCanvas = ((mxImageCanvas) clippedCanvas)
View Full Code Here

Examples of com.mxgraph.canvas.mxICanvas

   * @return Returns the image that represents the canvas.
   */
  public static mxICanvas drawCells(mxGraph graph, Object[] cells,
      double scale, mxRectangle clip, CanvasFactory factory)
  {
    mxICanvas canvas = null;

    if (cells == null)
    {
      cells = new Object[] { graph.getModel().getRoot() };
    }

    // Gets the current state of the view
    mxGraphView view = graph.getView();

    // Keeps the existing translation as the cells might
    // be aligned to the grid in a different way in a graph
    // that has a translation other than zero
    boolean eventsEnabled = view.isEventsEnabled();

    // Disables firing of scale events so that there is no
    // repaint or update of the original graph
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates temp = new mxTemporaryCellStates(view, scale,
        cells);

    try
    {
      if (clip == null)
      {
        clip = graph.getPaintBounds(cells);
      }

      if (clip != null && clip.getWidth() > 0 && clip.getHeight() > 0)
      {
        Rectangle rect = clip.getRectangle();
        canvas = factory.createCanvas(rect.width + 1, rect.height + 1);

        if (canvas != null)
        {
          double previousScale = canvas.getScale();
          Point previousTranslate = canvas.getTranslate();

          try
          {
            canvas.setTranslate(-rect.x, -rect.y);
            canvas.setScale(view.getScale());

            for (int i = 0; i < cells.length; i++)
            {
              graph.drawCell(canvas, cells[i]);
            }
          }
          finally
          {
            canvas.setScale(previousScale);
            canvas.setTranslate(previousTranslate.x,
                previousTranslate.y);
          }
        }
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.