微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.awt.Shape的实例源码

项目:JavaGraph    文件JVertexView.java   
/** Creates a hexagonal shape inscribed in the bounds given in the parameters. */
private Shape createHexagonShape(double x,double y,double width,double height) {
    GeneralPath result = new GeneralPath(Path2D.WIND_NON_ZERO,5);
    double extend = height * NodeShape.HEX_EXTEND_RATIO;
    // stat at top left corner
    result.moveto(x + extend,y);
    // to top right
    result.lineto(x + width - extend,y);
    // to right
    result.lineto(x + width,y + height / 2);
    // to bottom right
    result.lineto(x + width - extend,y + height);
    // to bottom left
    result.lineto(x + extend,y + height);
    // to left
    result.lineto(x,y + height / 2);
    result.closePath();
    return result;
}
项目:org.alloytools.alloy    文件OurHighlighter.java   
/** This method is called by Swing to draw highlights. */
public void paint(Graphics gr,int start,int end,Shape shape,JTextComponent text) {
    Color old = gr.getColor();
    gr.setColor(color);
    try {
        Rectangle Box = shape.getBounds(),a = text.getUI().modelToView(text,start),b = text.getUI().modelToView(text,end);
        if (a.y == b.y) {
            // same line (Note: furthermore,if start==end,then we draw all
            // the way to the right edge)
            Rectangle r = a.union(b);
            gr.fillRect(r.x,r.y,(r.width <= 1 ? (Box.x + Box.width - r.x) : r.width),r.height);
        } else {
            // Multiple lines; (Note: on first line we'll draw from "start"
            // and extend to rightmost)
            gr.fillRect(a.x,a.y,Box.x + Box.width - a.x,a.height);
            if (a.y + a.height < b.y)
                gr.fillRect(Box.x,a.y + a.height,Box.width,b.y - (a.y + a.height));
            gr.fillRect(Box.x,b.y,b.x - Box.x,b.height);
        }
    } catch (BadLocationException e) {} // Failure to highlight is not fatal
    gr.setColor(old);
}
项目:cuttlefish    文件Vertex.java   
/**
 * Creates the shape of the vertex given its description in a string
 * @param shapestring "square" or "circle"
 */
public void setShape(String shapestring) {
    Shape newShape;
    if (shapestring.startsWith("square")){
        Rectangle2D rectangle = new Rectangle2D.Float();
        rectangle.setFrameFromCenter(0,size,size);
        newShape = rectangle;
    }
    else
    {
        Ellipse2D ellipse = new Ellipse2D.Float();
        ellipse.setFrameFromCenter(0,size);
        newShape = ellipse; 
    }
    this.shape = newShape;
}
项目:Cognizant-Intelligent-Test-Scripter    文件propertyeditor.java   
private List<Shape> getMatchesList() {
    List<Shape> rMatches = new ArrayList<>();
    try {
        Iterator<?> it = getMatches();
        if (it != null) {
            Region sRegion = Region.create(shapes.get(0).getBounds());
            while (it.hasNext()) {
                Object region = it.next();
                Shape rx = ((Region) region).getRect();
                if (sRegion != null && sRegion.getRect().contains(rx.getBounds())) {
                    rMatches.add(rx);
                }
            }
        }

    } catch (FindFailed | IOException | NullPointerException ex) {
        Logger.getLogger(propertyeditor.class.getName()).log(Level.SEVERE,null,ex);
    }
    return rMatches;
}
项目:parabuild-ci    文件ChartEntity.java   
/**
 * Returns a string containing the coordinates for a given shape.  This
 * string is intended for use in an image map.
 *
 * @param shape  the shape (<code>null</code> not permitted).
 *
 * @return The coordinates for a given shape as string.
 */
private String getpolyCoords(Shape shape) {
    if (shape == null) {
        throw new IllegalArgumentException("Null 'shape' argument.");   
    }
    String result = "";
    boolean first = true;
    float[] coords = new float[6];
    PathIterator pi = shape.getPathIterator(null,1.0);
    while (!pi.isDone()) {
        pi.currentSegment(coords);
        if (first) {
            first = false;
            result = result + (int) coords[0] + "," + (int) coords[1];
        }
        else {
            result = result + "," + (int) coords[0] + "," + (int) coords[1];
        }
        pi.next();
    }
    return result;
}
项目:jdk8u-jdk    文件LayoutPathImpl.java   
public Shape mapShape(Shape s) {
    if (LOGMAP) LOG.format("mapshape on path: %s\n",LayoutPathImpl.SegmentPath.this);
    PathIterator pi = s.getPathIterator(null,1); // cheap way to handle curves.

    if (LOGMAP) LOG.format("start\n");
    init();

    final double[] coords = new double[2];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case SEG_CLOSE: close(); break;
        case SEG_MOVeto: moveto(coords[0],coords[1]); break;
        case SEG_LINeto: lineto(coords[0],coords[1]); break;
        default: break;
        }

        pi.next();
    }
    if (LOGMAP) LOG.format("finish\n\n");

    GeneralPath gp = new GeneralPath();
    for (Segment seg: segments) {
        gp.append(seg.gp,false);
    }
    return gp;
}
项目:brModelo    文件LivreBase.java   
public Shape getRegiaoComentario() {
    if (Regiao == null) {

        GeneralPath pa = new GeneralPath();
        pa.setwindingRule(GeneralPath.WIND_NON_ZERO);

        Rectangle rec = getBounds();
        int tam = Math.min(rec.width / 6,rec.height / 6);
        int curv = tam / 4;
        int lw = rec.x + rec.width;
        int[] px = new int[]{rec.x,lw - tam,lw,rec.x};
        int[] py = new int[]{rec.y,rec.y,rec.y + tam,rec.y + rec.height,rec.y + rec.height};
        polygon po = new polygon(px,py,5);
        pa.append(po,true);
        pa.moveto(lw - tam,rec.y);
        pa.curveto(lw - tam,lw - tam + curv,rec.y + curv,rec.y + tam - (1));
        pa.moveto(lw - tam,rec.y + tam - (1));
        pa.lineto(lw,rec.y + tam);
        pa.closePath();
        Regiao = pa;
    }
    return Regiao;
}
项目:brModelo    文件LivreBase.java   
public Shape getRegiaodocumento() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        final int T = getTop();
        final int TH = T + getHeight() - repo;
        final int LW = L + getWidth();
        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(L,TH,L + h1,TH + v1,LW - h1,TH - v1,LW,TH);
        GeneralPath pa = new GeneralPath();

        pa.moveto(LW,TH);
        pa.lineto(LW,T);
        pa.lineto(L,TH);
        pa.append(c,true);
        Regiao = pa;
        final int ptToMove = 3;
        this.reposicionePonto[ptToMove] = new Point(0,-repo);
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
项目:parabuild-ci    文件AbstractCategoryItemRenderer.java   
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return the legend item.
 */
public LegendItem getLegendItem(int datasetIndex,int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    CategoryDataset dataset;
    dataset = cp.getDataset(datasetIndex);
    String label = dataset.getRowKey(series).toString();
    String description = label;
    Shape shape = getSeriesShape(series);
    Paint paint = getSeriesPaint(series);
    Paint outlinePaint = getSeriesOutlinePaint(series);
    stroke stroke = getSeriesstroke(series);

    return new LegendItem(
        label,description,shape,true,paint,stroke,outlinePaint,stroke
    );

}
项目:Openjsharp    文件Path2D.java   
/**
 * Constructs a new double precision {@code Path2D} object
 * from an arbitrary {@link Shape} object,transformed by an
 * {@link AffineTransform} object.
 * All of the initial geometry and the winding rule for this path are
 * taken from the specified {@code Shape} object and transformed
 * by the specified {@code AffineTransform} object.
 *
 * @param s the specified {@code Shape} object
 * @param at the specified {@code AffineTransform} object
 * @since 1.6
 */
public Double(Shape s,AffineTransform at) {
    if (s instanceof Path2D) {
        Path2D p2d = (Path2D) s;
        setwindingRule(p2d.windingRule);
        this.numTypes = p2d.numTypes;
        this.pointTypes = Arrays.copyOf(p2d.pointTypes,p2d.pointTypes.length);
        this.numCoords = p2d.numCoords;
        this.doubleCoords = p2d.cloneCoordsDouble(at);
    } else {
        PathIterator pi = s.getPathIterator(at);
        setwindingRule(pi.getwindingRule());
        this.pointTypes = new byte[INIT_SIZE];
        this.doubleCoords = new double[INIT_SIZE * 2];
        append(pi,false);
    }
}
项目:jdk8u-jdk    文件RenderingEngine.java   
public Shape createstrokedShape(Shape src,float width,int caps,int join,float miterlimit,float dashes[],float dashphase)
{
    System.out.println(name+".createstrokedShape("+
                       src.getClass().getName()+","+
                       "width = "+width+","+
                       "caps = "+caps+","+
                       "join = "+join+","+
                       "miter = "+miterlimit+","+
                       "dashes = "+dashes+","+
                       "dashphase = "+dashphase+")");
    return target.createstrokedShape(src,width,caps,join,miterlimit,dashes,dashphase);
}
项目:What-Happened-to-Station-7    文件HexPoint.java   
public Shape getBorder(double size)
{
    AffineTransform at = new AffineTransform();
    at.translate(getVisualX(size),getVisualY(size));
    at.scale(size,size);
    return border.createTransformedShape(at);
}
项目:JavaGraph    文件JVertexView.java   
/**
 * Paints the border,with a given shape.
 */
private void paintBorder(Graphics2D g,Shape shape) {
    g.setColor(this.lineColor);
    g.setstroke(JAttr.createstroke(this.linewidth,this.dash));
    g.draw(shape);
    if (this.twoLines) {
        g.setColor(this.line2color);
        g.setstroke(JAttr.createstroke(this.line2width,this.line2dash));
        g.draw(shape);
    }
    if (this.selected) {
        paintSelectionBorder(g,shape);
    }
}
项目:jdk8u-jdk    文件TextLine.java   
public Shape getoutline(AffineTransform tx) {

        GeneralPath dstShape = new GeneralPath(GeneralPath.WIND_NON_ZERO);

        for (int i=0,n = 0; i < fComponents.length; i++,n += 2) {
            TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)];

            dstShape.append(tlc.getoutline(locs[n],locs[n+1]),false);
        }

        if (tx != null) {
            dstShape.transform(tx);
        }
        return dstShape;
    }
项目:jdk8u-jdk    文件RasterPrinterJob.java   
/**
  * save graphics state of a PathGraphics for later redrawing
  * of part of page represented by the region in that state
  */

public void saveState(AffineTransform at,Shape clip,Rectangle2D region,double sx,double sy) {
    Graphicsstate gstate = new Graphicsstate();
    gstate.theTransform = at;
    gstate.theClip = clip;
    gstate.region = region;
    gstate.sx = sx;
    gstate.sy = sy;
    redrawList.add(gstate);
}
项目:jdk8u-jdk    文件SunGraphics2D.java   
protected static Shape transformShape(AffineTransform tx,Shape clip) {
    if (clip == null) {
        return null;
    }

    if (clip instanceof Rectangle2D &&
        (tx.getType() & NON_RECTILINEAR_TRANSFORM_MASK) == 0)
    {
        Rectangle2D rect = (Rectangle2D) clip;
        double matrix[] = new double[4];
        matrix[0] = rect.getX();
        matrix[1] = rect.getY();
        matrix[2] = matrix[0] + rect.getWidth();
        matrix[3] = matrix[1] + rect.getHeight();
        tx.transform(matrix,matrix,2);
        fixRectangleOrientation(matrix,rect);
        return new Rectangle2D.Double(matrix[0],matrix[1],matrix[2] - matrix[0],matrix[3] - matrix[1]);
    }

    if (tx.isIdentity()) {
        return cloneshape(clip);
    }

    return tx.createTransformedShape(clip);
}
项目:incubator-netbeans    文件DocumentViewChildren.java   
Shape getChildAllocation(DocumentView docView,int index,Shape docViewAlloc) {
    Rectangle2D.Double mutableBounds = ViewUtils.shape2Bounds(docViewAlloc);
    double startYR = startVisualOffset(index); // relative i.e. not shifted by baseY
    double endYR = endVisualOffset(index); // relative i.e. not shifted by baseY
    mutableBounds.y += baseY + startYR;
    mutableBounds.height = endYR - startYR;
    // Leave mutableBounds.width
    return mutableBounds;
}
项目:openjdk-jdk10    文件SunGraphics2D.java   
protected static Shape transformShape(AffineTransform tx,matrix[3] - matrix[1]);
    }

    if (tx.isIdentity()) {
        return cloneshape(clip);
    }

    return tx.createTransformedShape(clip);
}
项目:jdk8u-jdk    文件TextMeasureTests.java   
public void runTest(Object ctx,int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    Shape s;
    do {
        for (int i = 0,e = gv.getNumGlyphs(); i < e; ++i) {
            s = gv.getGlyphLogicalBounds(i);
        }
    } while (--numReps >= 0);
}
项目:WordnetLoom    文件ViwnNodeCand.java   
@Override
public Shape getShape() {
    if (ext.isWeak()) {
        return geom.shape;
    } else {
        return super.getShape();
    }
}
项目:rapidminer    文件RapidLookTools.java   
/**
 * Creates the default {@link Shape} for the given button.
 *
 * @param b
 *            the button to create the shape for
 * @return the shape instance
 */
public static Shape createShapeForButton(AbstractButton b) {
    int w = b.getWidth();
    int h = b.getHeight();

    return new RoundRectangle2D.Double(1,1,w - 2,h - 2,RapidLookAndFeel.CORNER_DEFAULT_RADIUS,RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
项目:Tarski    文件mxHexagonShape.java   
/**
 * 
 */
public Shape createShape(mxGraphics2DCanvas canvas,mxCellState state) {
  Rectangle temp = state.getRectangle();
  int x = temp.x;
  int y = temp.y;
  int w = temp.width;
  int h = temp.height;
  String direction = mxUtils.getString(state.getStyle(),mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_EAST);
  polygon hexagon = new polygon();

  if (direction.equals(mxConstants.DIRECTION_norTH)
      || direction.equals(mxConstants.DIRECTION_SOUTH)) {
    hexagon.addPoint(x + (int) (0.5 * w),y);
    hexagon.addPoint(x + w,y + (int) (0.25 * h));
    hexagon.addPoint(x + w,y + (int) (0.75 * h));
    hexagon.addPoint(x + (int) (0.5 * w),y + h);
    hexagon.addPoint(x,y + (int) (0.75 * h));
    hexagon.addPoint(x,y + (int) (0.25 * h));
  } else {
    hexagon.addPoint(x + (int) (0.25 * w),y);
    hexagon.addPoint(x + (int) (0.75 * w),y + (int) (0.5 * h));
    hexagon.addPoint(x + (int) (0.75 * w),y + h);
    hexagon.addPoint(x + (int) (0.25 * w),y + (int) (0.5 * h));
  }

  return hexagon;
}
项目:Openjsharp    文件LoopPipe.java   
public void draw(SunGraphics2D sg2d,Shape s) {
    if (sg2d.strokeState == SunGraphics2D.stroke_THIN) {
        Path2D.Float p2df;
        int transX;
        int transY;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transX = sg2d.transX;
            transY = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s,sg2d.transform);
            transX = 0;
            transY = 0;
        }
        sg2d.loops.drawPathLoop.DrawPath(sg2d,sg2d.getSurfaceData(),transX,transY,p2df);
        return;
    }

    if (sg2d.strokeState == SunGraphics2D.stroke_CUSTOM) {
        fill(sg2d,sg2d.stroke.createstrokedShape(s));
        return;
    }

    ShapeSpanIterator sr = getstrokeSpans(sg2d,s);

    try {
        fillSpans(sg2d,sr);
    } finally {
        sr.dispose();
    }
}
项目:gemini.blueprint    文件TypeFactoryTest.java   
@Test
public void testSuperList() throws Exception {
    ReifiedType tp = getReifiedTypeFor("superList");
    assertEquals(1,tp.size());
    assertEquals(LinkedList.class,tp.getRawClass());
    assertEquals(Shape.class,tp.getActualTypeArgument(0).getRawClass());
}
项目:parabuild-ci    文件SWTGraphics2D.java   
/**
 * Converts an AWT <code>Shape</code> into a SWT <code>Path</code>.
 * 
 * @param shape  the shape.
 * 
 * @return The path.
 */
private Path toSwtPath(Shape shape) {
    int type;
    float[] coords = new float[6];
    Path path = new Path(this.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[3],coords[4],coords[5]);
                break;
            case (PathIterator.SEG_CLOSE):
                path.close();
                break;
            default:
                break;
        }
        pit.next();
    }
    return path;
}
项目:rapidminer    文件SeriesFormat.java   
public static Shape createDiamond() {
    final float s = SHAPE_SIZE;
    double d = Math.round(Math.sqrt(2 * s * s) / 2.0);
    final GeneralPath p = new GeneralPath();
    p.moveto(0,d);
    p.lineto(d,0);
    p.lineto(0,-d);
    p.lineto(-d,0);
    p.closePath();
    return p;

    // final float s = shapeSize;
    // final float l = s / 4.0f;
    // final float t = s / 4.0f;
    //
    // final float SQRT2 = (float) Math.pow(2.0,0.5);
    // final GeneralPath p0 = new GeneralPath();
    // p0.moveto(-l - t,-l + t);
    // p0.lineto(-l + t,-l - t);
    // p0.lineto(0.0f,-t * SQRT2);
    // p0.lineto(l - t,-l - t);
    // p0.lineto(l + t,-l + t);
    // p0.lineto(t * SQRT2,0.0f);
    // p0.lineto(l + t,l - t);
    // p0.lineto(l - t,l + t);
    // p0.lineto(0.0f,t * SQRT2);
    // p0.lineto(-l + t,l + t);
    // p0.lineto(-l - t,l - t);
    // p0.lineto(-t * SQRT2,0.0f);
    // p0.closePath();
    // return p0;
}
项目:jdk8u-jdk    文件SunGraphics2D.java   
Shape intersectRectShape(Rectangle2D r,Shape s,boolean keep1,boolean keep2) {
    if (s instanceof Rectangle2D) {
        Rectangle2D r2 = (Rectangle2D) s;
        Rectangle2D outrect;
        if (!keep1) {
            outrect = r;
        } else if (!keep2) {
            outrect = r2;
        } else {
            outrect = new Rectangle2D.Float();
        }
        double x1 = Math.max(r.getX(),r2.getX());
        double x2 = Math.min(r.getX()  + r.getWidth(),r2.getX() + r2.getWidth());
        double y1 = Math.max(r.getY(),r2.getY());
        double y2 = Math.min(r.getY()  + r.getHeight(),r2.getY() + r2.getHeight());

        if (((x2 - x1) < 0) || ((y2 - y1) < 0))
            // Width or height is negative. No intersection.
            outrect.setFrameFromDiagonal(0,0);
        else
            outrect.setFrameFromDiagonal(x1,y1,x2,y2);
        return outrect;
    }
    if (r.contains(s.getBounds2D())) {
        if (keep2) {
            s = cloneshape(s);
        }
        return s;
    }
    return intersectByArea(r,s,keep1,keep2);
}
项目:incubator-netbeans    文件ViewHierarchyImpl.java   
public Shape modelToView(DocumentView docView,int offset,Position.Bias bias) {
    if (docView != null) {
        return docView.modelToViewNeedsLock(offset,docView.getAllocation(),bias);
    } else {
        TextUI ui = textComponent.getUI();
        try {
            return (ui != null) ? ui.modelToView(textComponent,offset,bias) : null;
        } catch (BadLocationException ex) {
            return null;
        }
    }
}
项目:parabuild-ci    文件CategoryItemEntity.java   
/**
 * Creates a new category item entity.
 *
 * @param area  the area.
 * @param toolTipText  the tool tip text.
 * @param urlText  the URL text for HTML image maps.
 * @param dataset  the dataset.
 * @param series  the series (zero-based index).
 * @param category  the category.
 * @param categoryIndex  the category index.
 */
public CategoryItemEntity(Shape area,String toolTipText,String urlText,CategoryDataset dataset,int series,Object category,int categoryIndex) {

    super(area,toolTipText,urlText);
    this.dataset = dataset;
    this.series = series;
    this.category = category;
    this.categoryIndex = categoryIndex;

}
项目:parabuild-ci    文件XYTextAnnotation.java   
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param rendererIndex  the renderer index.
 * @param info  an optional info object that will be populated with
 *              entity @R_698_4045@ion.
 */
public void draw(Graphics2D g2,XYPlot plot,Rectangle2D dataArea,ValueAxis domainAxis,ValueAxis rangeAxis,int rendererIndex,PlotRenderingInfo info) {

    PlotOrientation orientation = plot.getorientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(),orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(),orientation);

    float anchorX = (float) domainAxis.valuetoJava2D(
            this.x,dataArea,domainEdge);
    float anchorY = (float) rangeAxis.valuetoJava2D(
            this.y,rangeEdge);

    if (orientation == PlotOrientation.HORIZONTAL) {
        float tempAnchor = anchorX;
        anchorX = anchorY;
        anchorY = tempAnchor;
    }

    g2.setFont(getFont());
    g2.setPaint(getPaint());
    TextUtilities.drawRotatedString(getText(),g2,anchorX,anchorY,getTextAnchor(),getRotationAngle(),getRotationAnchor());
    Shape hotspot = TextUtilities.calculateRotatedStringBounds(
            getText(),getRotationAnchor());

    String toolTip = getToolTipText();
    String url = getURL();
    if (toolTip != null || url != null) {
        addEntity(info,hotspot,rendererIndex,toolTip,url);
    }

}
项目:incubator-netbeans    文件DocumentView.java   
@Override
public void paint(Graphics2D g,Shape alloc,Rectangle clipBounds) {
    if (lock()) {
        try {
            checkDocumentLockedIfLogging();
            op.checkViewsInited();
            if (op.isActive()) {
                op.updateFontRenderContext(g,true); // Includes setting of rendering hints
                children.paint(this,g,alloc,clipBounds);
            }
        } finally {
            unlock();
        }
    }
}
项目:jdk8u-jdk    文件StandardGlyphVector.java   
/**
 * Used by getoutline,getGlyphsOutline
 */
private Shape getGlyphsOutline(int start,int count,float x,float y) {
    setFRCTX();
    initPositions();

    GeneralPath result = new GeneralPath(GeneralPath.WIND_NON_ZERO);
    for (int i = start,e = start + count,n = start * 2; i < e; ++i,n += 2) {
        float px = x + positions[n];
        float py = y + positions[n+1];

        getGlyphStrike(i).appendGlyphOutline(glyphs[i],result,px,py);
    }

    return result;
}
项目:incubator-netbeans    文件EditorView.java   
/**
 * {@inheritDoc}
 */
@Override
public final Shape modelToView(int offset,Position.Bias bias) throws BadLocationException {
    checkBounds(offset);
    checkBias(bias);
    if (alloc != null) {
        return modelToViewChecked(offset,bias);
    } else {
        return null;
    }
}
项目:rapidminer    文件RenderFormatDelegate.java   
/**
 * Scales a shape according to the scaling factor for value (given by the sizeProvider if one
 * such exists). If no sizeProvider exists,the shape is returned unmodified.
 */
private Shape scaleShape(Shape shape,double scalingFactor) {
    // scale shape if necessary
    if (scalingFactor != 1) {
        AffineTransform t = new AffineTransform();
        t.scale(scalingFactor,scalingFactor);
        shape = t.createTransformedShape(shape);
    }
    return shape;
}
项目:Openjsharp    文件TextLayout.java   
/**
 * Returns a <code>Shape</code> representing the outline of this
 * <code>TextLayout</code>.
 * @param tx an optional {@link AffineTransform} to apply to the
 *     outline of this <code>TextLayout</code>.
 * @return a <code>Shape</code> that is the outline of this
 *     <code>TextLayout</code>.  This is in standard coordinates.
 */
public Shape getoutline(AffineTransform tx) {
    ensureCache();
    Shape result = textLine.getoutline(tx);
    LayoutPathImpl lp = textLine.getLayoutPath();
    if (lp != null) {
        result = lp.mapShape(result);
    }
    return result;
}
项目:Openjsharp    文件SunGraphics2D.java   
protected static Shape transformShape(AffineTransform tx,e = gv.getNumGlyphs(); i < e; ++i) {
            s = gv.getGlyphVisualBounds(i);
        }
    } while (--numReps >= 0);
}
项目:brModelo    文件LivreBase.java   
public Shape getRegiaoLosanglo() {
    if (Regiao == null) {
        Rectangle r = new Rectangle(getLeft(),getTop(),getWidth(),getHeight()); //getBounds();
        polygon los = new polygon();
        los.addPoint(r.x,r.y + r.height / 2);
        los.addPoint(r.x + r.width / 2,r.y);
        los.addPoint(r.x + r.width,r.y + r.height);

        Regiao = los;
    }
    return Regiao;
}
项目:openjdk-jdk10    文件SpanShapeRenderer.java   
public void draw(SunGraphics2D sg,Shape s) {
    if (sg.stroke instanceof Basicstroke) {
        ShapeSpanIterator sr = LoopPipe.getstrokeSpans(sg,s);
        try {
            renderSpans(sg,sg.getCompClip(),sr);
        } finally {
            sr.dispose();
        }
    } else {
        fill(sg,sg.stroke.createstrokedShape(s));
    }
}
项目:brModelo    文件EstadoAtividade.java   
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        Regiao = new RoundRectangle2D.Float(getLeft(),getHeight(),getWidth()/3,getHeight());
    }
    return Regiao;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。