Examples of SWTGraphics


Examples of org.eclipse.draw2d.SWTGraphics

     * IMAGE_JPEG, IMAGE_PNG.
     * @param stream
     * @param format
     */
    public void createImage(OutputStream stream, int format) {
        SWTGraphics g = null;
        GC gc = null;
        Image image = null;
        LayerManager layerManager = (LayerManager)
            getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure figure = layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
        Rectangle r = figure.getBounds();
        try {
            image = new Image(Display.getDefault(), 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(stream, format);
        } catch (Throwable t) {
            DroolsEclipsePlugin.log(t);
        } finally {
            if (g != null) {
                g.dispose();
            }
            if (gc != null) {
                gc.dispose();
            }
            if (image != null) {
View Full Code Here

Examples of org.eclipse.draw2d.SWTGraphics

            Image image = new Image( diagramPresentation.display(), rectangle.width, rectangle.height );

            FileOutputStream output = null;
            GC gc = null;
            SWTGraphics graphics = null;
            try
            {
                gc = new GC( image );
                graphics = new SWTGraphics( gc );
                figure.paint( graphics );

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

                loader.save( output, SWT.IMAGE_PNG );
                output.flush();
            }
            catch( Exception e )
            {
                Sapphire.service( LoggingService.class ).log( e );
            }
            finally
            {
                image.dispose();
               
                if (gc != null)
                    gc.dispose();
               
                if (graphics != null)
                    graphics.dispose();
               
              if (output != null)
              {
                try
                {
View Full Code Here

Examples of org.eclipse.draw2d.SWTGraphics

      final Display display = Display.getDefault();

      final Image img = new Image(display, rootFigureBounds.width, rootFigureBounds.height);
      final GC imageGC = new GC(img);
      final SWTGraphics grap = new SWTGraphics(imageGC);

      // Access UI thread from runnable to print the canvas to the image
      display.syncExec(new Runnable() {

        @Override
View Full Code Here

Examples of org.eclipse.draw2d.SWTGraphics

    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();
View Full Code Here

Examples of org.eclipse.draw2d.SWTGraphics

    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();
View Full Code Here

Examples of org.eclipse.draw2d.SWTGraphics

    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();
View Full Code Here

Examples of org.eclipse.draw2d.SWTGraphics

    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();
View Full Code Here

Examples of org.locationtech.udig.ui.graphics.SWTGraphics

        int height = (int) Math.abs(screenbounds[3]-screenbounds[1]);
        //create transparent image
        image=AWTSWTImageUtils.createDefaultImage(Display.getDefault(), width, height);
       
        // draw feature
        SWTGraphics graphics=new SWTGraphics(image, Display.getDefault());
       
        drawing.drawFeature(graphics, feature,
                getMap().getViewportModel().worldToScreenTransform(envelope, new Dimension(width,height)), false, syms, mt);
        graphics.dispose();
    }
View Full Code Here

Examples of org.locationtech.udig.ui.graphics.SWTGraphics

    public static ViewportGraphics createGraphics( GC gc, Display display, Dimension displaySize ) {
        if (Platform.getOS().equals(Platform.OS_LINUX))

            return new NonAdvancedSWTGraphics(gc, display, displaySize);

        return new SWTGraphics(gc, display);
    }
View Full Code Here

Examples of org.locationtech.udig.ui.graphics.SWTGraphics

     * @return
     */
    private ViewportGraphics createSWTGraphics( Image image, Display display ) {
        if (Platform.getOS().equals(Platform.OS_LINUX))
            return new NonAdvancedSWTGraphics(image, display);
        return new SWTGraphics(image, display);
    }
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.