Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.Graphics


      Image image = new Image(Display.getCurrent(), bounds.width,
          bounds.height);

      // Paints the figure on it using SWT graphics
      GC gc = new GC(image);
      Graphics swtGraphics = new SWTGraphics(gc);
      paintFigure(shape, backgroundColor, bounds, swtGraphics);

      // Draws the image on the original graphics
      graphics.drawImage(image, 0, 0);

      // Disposes image (and GC btw) and SWT graphics
      image.dispose();
      swtGraphics.dispose();
    }
  }
View Full Code Here


    {
      gc.setAntialias(SWT.OFF);
      gc.setTextAntialias(SWT.OFF);
    }
   
    Graphics graphics = new SWTGraphics(gc);
    rootFigure.paint(graphics);
    graphics.dispose();

    ImageLoader loader = new ImageLoader();
    loader.data = new ImageData[]{image.getImageData()};

    ByteArrayOutputStream os = new ByteArrayOutputStream();
View Full Code Here

    {
      gc.setAntialias(SWT.OFF);
      gc.setTextAntialias(SWT.OFF);
    }
   
    Graphics graphics = new SWTGraphics(gc);
    rootFigure.paint(graphics);
    graphics.dispose();

    ImageLoader loader = new ImageLoader();
    loader.data = new ImageData[]{image.getImageData()};

    ByteArrayOutputStream os = new ByteArrayOutputStream();
View Full Code Here

          .getClientArea().height));
      fig4.setBackgroundColor(ColorConstants.white);
      img = new Image(Display.getCurrent(), fig1.getClientArea().width,
          fig1.getClientArea().height);
      imageGC = new GC(img);
      Graphics g = new SWTGraphics(imageGC);
      fig4.paint(g);
      fig3.paint(g);
      fig2.paint(g);
      fig1.paint(g);
      g.dispose();
      exportImageJob(img, imageGC, saveLocation,
          fileDialog.getFilterIndex());
    }
  }
View Full Code Here

            fig1.getClientArea().height, 24, new PaletteData(0xFF,
                0xFF00, 0xFF000));
        monitor.worked(2);
        img = new Image(Display.getCurrent(), data);
        imageGC = new GC(img);
        Graphics g = new SWTGraphics(imageGC);
        monitor.worked(3);
        fig1.paint(g);
        g.dispose();
        imageGC.dispose();
        img.dispose();
        monitor.done();
        return Status.OK_STATUS;
      }
View Full Code Here

    // Creates a new image of width x height on the current display
    Image image = new Image(Display.getCurrent(), width, height);

    // Paints the figure on it
    GC gc = new GC(image);
    Graphics graphics = new SWTGraphics(gc);
    figure.paint(graphics);

    // Get the image data back
    ImageData data = image.getImageData();
    ImageDescriptor id = ImageDescriptor.createFromImageData(data);

    // Disposes image (and GC btw) and SWT graphics
    image.dispose();
    graphics.dispose();

    return id;
  }
View Full Code Here

    IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);
    Rectangle r = figure.getClientArea();

    Image image = null;
    GC gc = null;
    Graphics g = null;
    try {
      image = new Image(device, r.width, r.height);
      gc = new GC(image);
      g = new SWTGraphics(gc);
      g.translate(r.x * -1, r.y * -1);

      figure.paint(g);

      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(result, format);
    }
    finally {
      if (g != null) {
        g.dispose();
      }
      if (gc != null) {
        gc.dispose();
      }
      if (image != null) {
View Full Code Here

    IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);
    Rectangle r = figure.getClientArea();

    Image image = null;
    GC gc = null;
    Graphics g = null;
    try {
      image = new Image(device, r.width, r.height);
      gc = new GC(image);
      g = new SWTGraphics(gc);
      g.translate(r.x * -1, r.y * -1);

      figure.paint(g);

      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(result, format);
    }
    finally {
      if (g != null) {
        g.dispose();
      }
      if (gc != null) {
        gc.dispose();
      }
      if (image != null) {
View Full Code Here

    IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);
    Rectangle r = figure.getClientArea();

    Image image = null;
    GC gc = null;
    Graphics g = null;
    try {
      image = new Image(device, r.width, r.height);
      gc = new GC(image);
      g = new SWTGraphics(gc);
      g.translate(r.x * -1, r.y * -1);

      figure.paint(g);

      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(result, format);
    }
    finally {
      if (g != null) {
        g.dispose();
      }
      if (gc != null) {
        gc.dispose();
      }
      if (image != null) {
View Full Code Here

    IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);
    Rectangle r = figure.getClientArea();

    Image image = null;
    GC gc = null;
    Graphics g = null;
    try {
      image = new Image(device, r.width, r.height);
      gc = new GC(image);
      g = new SWTGraphics(gc);
      g.translate(r.x * -1, r.y * -1);

      figure.paint(g);

      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(result, format);
    }
    finally {
      if (g != null) {
        g.dispose();
      }
      if (gc != null) {
        gc.dispose();
      }
      if (image != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.Graphics

Copyright © 2018 www.massapicom. 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.