Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Path


            final Display display = Display.getDefault();
            display.syncExec(new Runnable(){
                    public void run() {
                        // test to make sure that GDI+ is installed
                        Image image = null;
                        Path path = null;                                               
                        try {
                            image = new Image(display, 10, 10);
                            path = AWTSWTImageUtils.convertToPath(new Rectangle(0, 0, 8, 8), display);
                            status[0] = true;
                        } catch (Exception e) {
                            final String message =
                                Messages.UDIGApplication_error1
                                + Messages.UDIGApplication_error2
                                + "http://www.microsoft.com/downloads/details.aspx?FamilyID=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en"; //$NON-NLS-1$
                            UiPlugin.log( message, null );               
                                                  
                            MessageDialog dialog = new MessageDialog(
                                    display.getActiveShell(),
                                    Messages.UDIGApplication_title,
                                    null,
                                    message,
                                    MessageDialog.ERROR,
                                    new String[]{"Exit","Continue"}, 0 );
                            int answer = dialog.open();
                            if( answer == 0 ){
                                PlatformUI.getWorkbench().close();
                                //System.exit(1); // need to ask the workbench to exit so this is clean...
                            }
                        } finally {
                            if (image != null)
                                image.dispose();
                            if (path != null)
                                path.dispose();
                        }
                    }
                });
        }
        return status[0];
View Full Code Here


        // Initialize
        List<Path> paths = new ArrayList<Path>(2);

        // Create first segment
        Path path = new Path(display);

        // Move to last point
        path.moveTo(current.x, current.y - (bold ? 2 * lw : lw));

        // Insert gap?
        if (gap) {

            // Calculate gap/2
            int offset = Math.max(1, g.getFontHeight());

            // End first segment before mid-point
            Point p = offset(current, next, -offset);
            path.lineTo(p.x, p.y);
            paths.add(path);

            // Create second segment
            path = new Path(display);

            // Move past mid-point
            p = offset(current, next, offset);
            path.moveTo(p.x, p.y);

        }

        // Close path
        path.lineTo(next.x, next.y + (bold ? 0 : lw));
        paths.add(path);
        lines.add(new Line(paths, bold ? 2 * lw : lw));

        // Finished
        return gap ? offset(current, next, 0) : next;
View Full Code Here

        // Initialize
        List<Path> paths = new ArrayList<Path>(2);

        // Create first segment
        Path path = new Path(display);

        // Move to last point
        path.moveTo(current.x, current.y);

        // Insert gap?
        if (gap) {

            // Calculate gap/2
            int offset = Math.max(1, g.getFontHeight());

            // End first segment before mid-point
            Point p = offset(current, next, -offset);
            path.lineTo(p.x, p.y);
            paths.add(path);

            // Create second segment
            path = new Path(display);

            // Move past mid-point
            p = offset(current, next, offset);
            path.moveTo(p.x, p.y);

        }

        // Close path
        path.lineTo(next.x - (bold ? 2 * lw : lw), next.y);
        paths.add(path);
        lines.add(new Line(paths, bold ? 2 * lw : lw));

        // Finished
        return gap ? offset(current, next, 0) : next;
View Full Code Here

    public void draw( Shape s ) {
        PathIterator p = s.getPathIterator(transform, 1);
        if (p.isDone())
            return;

        Path path = AWTSWTImageUtils.createPath(p, display);
        gc.drawPath(path);
        float[] points = path.getPathData().points;
        if (points.length == 2) {
            gc.drawPoint((int) points[0], (int) points[1]);
        }
        path.dispose();
    }
View Full Code Here

     * @see org.locationtech.udig.project.render.ViewportGraphics#draw(java.awt.Shape)
     */
    public void fill( Shape s ) {
        gc.setBackground(fore);
        PathIterator p = s.getPathIterator(transform);
        Path path = AWTSWTImageUtils.createPath(p, display);
        gc.fillPath(path);
        path.dispose();
        gc.setBackground(back);
    }
View Full Code Here

    private void initShapePath( Point nearestPoint ) {
        generalPath = new PathAdapter();
        if( Platform.getOS().equals(Platform.OS_LINUX) ){
            generalPath.setPath(new GeneralPath());
        }else{
            generalPath.setPath(new Path(getDisplay()) );
        }
        generalPath.moveTo(nearestPoint.getX(), nearestPoint.getY());
        if (generalPath.isPath())
            drawShapeCommand.setPath(generalPath.getPath());
        else
View Full Code Here

            handler.getContext().sendASyncCommand(drawShapeCommand);
        }
        if( drawEndPoints==null ){
            drawEndPoints=new DrawPathCommand();
            int vertexRadius = PreferenceUtil.instance().getVertexRadius();
            Path path = new Path(getDisplay());
            int i = vertexRadius+vertexRadius;
            path.addRectangle(dragStarted.getX()-vertexRadius, dragStarted.getY()-vertexRadius, i, i);
            if( EditPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.P_FILL_VERTICES) ){
                drawEndPoints.setFill(PreferenceUtil.instance().getDrawVertexFillColor());
            }
            drawEndPoints.setPath(path);
            handler.getContext().sendASyncCommand(drawEndPoints);
View Full Code Here

    public static Path createPath( PathIterator p, Device device ) {
        if (p.isDone())
            return null;
   
        float[] current = new float[6];
        Path path = new Path(device);
        while( !p.isDone() ) {
            int result = p.currentSegment(current);
            switch( result ) {
            case PathIterator.SEG_CLOSE:
                path.close();
                break;
            case PathIterator.SEG_LINETO:
                path.lineTo(current[0], current[1]);
                break;
            case PathIterator.SEG_MOVETO:
                path.moveTo(current[0], current[1]);
                break;
            case PathIterator.SEG_QUADTO:
                path.quadTo(current[0],   current[1],  current[2],
                         current[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                path.cubicTo( current[0],  current[1],  current[2],
                         current[3],  current[4],  current[5]);
                break;
            default:
            }
            p.next();
View Full Code Here

            }
        }
    }

    private void fillPath( EditGeom geom, CurrentEditGeomPathIterator pathIterator ) {
        Path shape = pathIterator.toPath(Display.getCurrent());
        try{
            if( store.getBoolean(PreferenceConstants.P_FILL_POLYGONS) && geom.getShapeType()==ShapeType.POLYGON ){
                colorStrategy.setFillColor(graphics, geom, handler);
                graphics.fillPath(shape);
            }

            colorStrategy.setLineColor2(graphics, geom, handler);
            graphics.drawPath(shape);

            colorStrategy.setLineColor(graphics, geom, handler);
            graphics.drawPath(shape);
           
        }finally{
            shape.dispose();
        }
    }
View Full Code Here

    }
    else {
      int width = p2.x - p1.x;

      // Ersetzen der Kurven unten? Versuch!
      Path path = new Path(SwtConsts.display);
      path.moveTo(p1.x, p1.y);
      path.cubicTo(p1.x + width / 2, p1.y, p2.x - width / 2, p2.y, p2.x, p2.y);
      gc.drawPath(path);
      path.dispose();
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Path

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.