Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Path


                           > g.getFontMetrics().getAverageCharWidth()
                                * binLabels[i].length()) {
                    Transform tr = new Transform(disp);
                    tr.rotate(-90.0f);
                    g.setTransform(tr);
                    Path p = new Path(disp);
                    p.addString(binLabels[i], -c.getBounds().height + 5,
                            x1 + (int) (0.5 * width) - 10, f);
                    g.fillPath(p);
                    tr.rotate(90.0f);
                    g.setTransform(tr);
                    tr.dispose();
                    p.dispose();
                }
                f.dispose();
            }
        }
        g.setForeground(disp.getSystemColor(SWT.COLOR_WHITE));
View Full Code Here


                           > g.getFontMetrics().getAverageCharWidth()
                                * binLabels[i].length()) {
                    Transform tr = new Transform(disp);
                    tr.rotate(-90.0f);
                    g.setTransform(tr);
                    Path p = new Path(disp);
                    p.addString(binLabels[i], -c.getBounds().height + 5,
                            x1 + (int) (0.5 * width) - 10, f);
                    g.fillPath(p);
                    tr.rotate(90.0f);
                    g.setTransform(tr);
                    tr.dispose();
                    p.dispose();
                }
                f.dispose();
            }
        }
        g.setForeground(disp.getSystemColor(SWT.COLOR_WHITE));
View Full Code Here

     * copied from: http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/DrawGraphics2Dstuffonaswtcomposite.htm
     */
    private void renderShape(GC gc, Shape shape) {
        int type;
        float[] coords = new float[6];
        Path path = new Path(gc.getDevice());
        PathIterator pit = shape.getPathIterator(null);
        while (!pit.isDone()) {
            type = pit.currentSegment(coords);
            switch (type) {
                case (PathIterator.SEG_MOVETO):
                    path.moveTo(coords[0], coords[1]);
                    break;
                case (PathIterator.SEG_LINETO):
                    path.lineTo(coords[0], coords[1]);
                    break;
                case (PathIterator.SEG_QUADTO):
                    path.quadTo(coords[0], coords[1], coords[2], coords[3]);
                    break;
                case (PathIterator.SEG_CUBICTO):
                    path.cubicTo(coords[0], coords[1], coords[2],
                            coords[3], coords[4], coords[5]);
                    break;
                case (PathIterator.SEG_CLOSE):
                    path.close();
                    break;
                default:
                    break;
            }
            pit.next();
        }
        gc.drawPath(path);
        rederArrowHeads(gc, path.getPathData());
    }
View Full Code Here

        float abs_e = (float)Math.sqrt(ex*ex + ey*ey);
        ex /= abs_e;
        ey /= abs_e;

        // Creating arrowhead
        Path arrowHead = new Path(gc.getDevice());
        arrowHead.moveTo(endx, endy);       
        arrowHead.lineTo(endx + (ey-ex)*adjSize, endy - (ex + ey)*adjSize);
        arrowHead.moveTo(endx, endy);
        arrowHead.lineTo(endx - (ey + ex)*adjSize, endy + (ex - ey)*adjSize);
        gc.drawPath(arrowHead);
    }
View Full Code Here

    @Override
    public void paintBefore(MapValues map, GC gc) {
        Device device = gc.getDevice();
       
        path = new Path(device);
        path.moveTo(0, 0);
        path.lineTo(-NEEDLEWIDTH, NEEDLEHEIGHT);
        path.quadTo(-CP_X_OFFSET, +CP_Y_OFFSET, 0, HEAD_Y_OFFSET);
        path.quadTo(CP_X_OFFSET, CP_Y_OFFSET, NEEDLEWIDTH, NEEDLEHEIGHT);
        path.lineTo(0, 0);       
View Full Code Here

    endShape(OPEN);
  }

  public void endShape(int arg0) {
    Route r = stackPath.pop();
    Path p = new Path(gc.getDevice());
    if (debug)
      System.err.println("endShape1:" + r.size());
    TypedPoint q = r.get(0);
    if (q.curved != TypedPoint.kind.CURVED)
      r.remove(0);
    p.moveTo((float) q.x, (float) q.y);
    if (debug)
      System.err.println("q=(" + q.x + "," + q.y + " " + q.curved + ")");
    if (arg0 == CLOSE) {
      r.add(new TypedPoint(q.x, q.y, TypedPoint.kind.NORMAL));
    }
    while (!r.isEmpty()) {
      drawNotCurved(r, p);
      drawCurved(r, p, arg0 == CLOSE);
    }
    int alpha0 = gc.getAlpha();
    if (fill /* arg0 == CLOSE */) {
      gc.setAlpha(alphaFill);
      gc.fillPath(p);
      gc.setAlpha(alpha0);
    }
    if (stroke) {
      gc.setAlpha(alphaStroke);
      gc.drawPath(p);
      gc.setAlpha(alpha0);
    }
    p.dispose();
  }
View Full Code Here

    /**
     * @see org.locationtech.udig.project.render.ViewportGraphics#draw(java.awt.Shape)
     */
    public void draw( Shape s ) {
        AWTSWTImageUtils.checkAccess();
        Path path = AWTSWTImageUtils.convertToPath(s, display);
        if( path!=null ){
            gc.drawPath(path);
            path.dispose();
        }
       
    }
View Full Code Here

    /**
     * @see org.locationtech.udig.project.render.ViewportGraphics#draw(java.awt.Shape)
     */
    public void fill( Shape s ) {
        Color tmp = prepareForFill();
        Path path = AWTSWTImageUtils.convertToPath(s, display);
        gc.fillPath(path);
        path.dispose();
        gc.setBackground(tmp);
    }
View Full Code Here

    public Path toPath(Device device) {
        prepareToPath();
       
        if( geom.getShell().getNumPoints()==1 ){
            Path createPoint = createPointPath(device);
            if( createPoint!=null )
                return createPoint;
        }
       
        return AWTSWTImageUtils.createPath(this, device);
View Full Code Here

        return new Rectangle(point.getX()-2, point.getY()-2, 4, 4 );
    }

    protected Path createPointPath(Device device) {
        Point point=geom.getShell().getPoint(0);
        Path path=new Path(device);
        path.addRectangle(point.getX()-2, point.getY()-2, 4, 4);
        return path;
    }
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.