Java 类java.awt.geom.RectangularShape 实例源码

项目:rapidminer    文件:CompositeButtonPainter.java   
/**
 * Draws the component background.
 *
 * @param g
 *            the graphics context
 */
void paintComponent(Graphics g) {
    RectangularShape rectangle;
    int radius = RapidLookAndFeel.CORNER_DEFAULT_RADIUS;
    switch (position) {
        case SwingConstants.LEFT:
            rectangle = new RoundRectangle2D.Double(0, 0, button.getWidth() + radius, button.getHeight(), radius,
                    radius);
            break;
        case SwingConstants.CENTER:
            rectangle = new Rectangle2D.Double(0, 0, button.getWidth(), button.getHeight());
            break;
        default:
            rectangle = new RoundRectangle2D.Double(-radius, 0, button.getWidth() + radius, button.getHeight(), radius,
                    radius);
            break;
    }
    RapidLookTools.drawButton(button, g, rectangle);
}
项目:ccu-historian    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:ccu-historian    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:ccu-historian    文件:GradientXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:ccu-historian    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:ccu-historian    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:ccu-historian    文件:GradientBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}
项目:ccu-historian    文件:GradientBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:ccu-historian    文件:GradientBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:ccu-historian    文件:StandardBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:ccu-historian    文件:StandardBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}
项目:jfreechart    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:jfreechart    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:jfreechart    文件:GradientXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.GRAY);
    g2.fill(shadow);

}
项目:jfreechart    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:jfreechart    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:jfreechart    文件:GradientBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}
项目:jfreechart    文件:GradientBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:jfreechart    文件:GradientBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:jfreechart    文件:StandardBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:jfreechart    文件:StandardBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}
项目:aya-lang    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:aya-lang    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:aya-lang    文件:GradientXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:aya-lang    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:aya-lang    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:aya-lang    文件:GradientBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}
项目:aya-lang    文件:GradientBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:aya-lang    文件:GradientBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:aya-lang    文件:StandardBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:aya-lang    文件:StandardBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
@Override
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}
项目:qupath    文件:PathHierarchyPaintingHelper.java   
/**
         * Paint the handles onto a Graphics object.
         * 
         * @param g2d
         * @param handleSize The width & height of the shape used to draw the handles
         * @param colorStroke
         * @param colorFill
         */
        public static void paintHandles(final List<Point2> handles, final Graphics2D g2d, final double handleSize, final Color colorStroke, final Color colorFill) {        
            RectangularShape handleShape = new Rectangle2D.Double();
//          handleShape = new Ellipse2D.Double();

        for (Point2 p : handles) {
            handleShape.setFrame(p.getX()-handleSize/2, p.getY()-handleSize/2, handleSize, handleSize);
            if (colorFill != null) {
                g2d.setColor(colorFill);
                g2d.fill(handleShape);
            }
            if (colorStroke != null) {
                g2d.setColor(colorStroke);
                g2d.draw(handleShape);
            }
        }
    }
项目:aptasuite    文件:LogoBarPainter.java   
public Shape convert(char c, RectangularShape bar) 
{
    FontRenderContext frc = getFontMetrics(f).getFontRenderContext();
    GlyphVector v = f.createGlyphVector(frc, new char[] { c });


    // Scale letter to fit the bar bounds
    AffineTransform at = new AffineTransform();
    at.scale( bar.getBounds2D().getWidth() / v.getOutline().getBounds2D().getWidth() , bar.getBounds2D().getHeight() / v.getOutline().getBounds2D().getHeight() );
    v.setGlyphTransform(0, at);

    // Convert into shape
    Shape letter = v.getOutline( (float) bar.getBounds2D().getMinX() , (float) (bar.getBounds2D().getMinY() + bar.getBounds2D().getHeight()) );

    //make fine adjustments to fit bar boundaries
    double difference_x = bar.getBounds2D().getX() - letter.getBounds2D().getX();
    double difference_y = bar.getBounds2D().getY() - letter.getBounds2D().getY();

    // Reassign with refinements
    letter = v.getOutline( (float) bar.getBounds2D().getMinX() + (float) difference_x , (float) (bar.getBounds2D().getMinY() + bar.getBounds2D().getHeight() + difference_y) );

    return letter;
}
项目:rapidminer-studio    文件:CompositeButtonPainter.java   
/**
 * Draws the component background.
 *
 * @param g
 *            the graphics context
 */
void paintComponent(Graphics g) {
    RectangularShape rectangle;
    int radius = RapidLookAndFeel.CORNER_DEFAULT_RADIUS;
    switch (position) {
        case SwingConstants.LEFT:
            rectangle = new RoundRectangle2D.Double(0, 0, button.getWidth() + radius, button.getHeight(), radius,
                    radius);
            break;
        case SwingConstants.CENTER:
            rectangle = new Rectangle2D.Double(0, 0, button.getWidth(), button.getHeight());
            break;
        default:
            rectangle = new RoundRectangle2D.Double(-radius, 0, button.getWidth() + radius, button.getHeight(), radius,
                    radius);
            break;
    }
    RapidLookTools.drawButton(button, g, rectangle);
}
项目:HTML5_WebSite    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base) {

    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
           // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

}
项目:HTML5_WebSite    文件:StandardXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:HTML5_WebSite    文件:GradientXYBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(Color.gray);
    g2.fill(shadow);

}
项目:HTML5_WebSite    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double x0 = bar.getMinX();
    double x1 = Math.rint(x0 + (bar.getWidth() * a));
    double x2 = Math.rint(x0 + (bar.getWidth() * b));
    double x3 = Math.rint(x0 + (bar.getWidth() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            x1 - x0, bar.getHeight());
    result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
            bar.getHeight());
    result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
            bar.getHeight());
    result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
            bar.getMaxX() - x3, bar.getHeight());
    return result;
}
项目:HTML5_WebSite    文件:GradientXYBarPainter.java   
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
项目:HTML5_WebSite    文件:GradientBarPainter.java   
/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 * @param pegShadow  peg the shadow to the base of the bar?
 */
public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row,
        int column, RectangularShape bar, RectangleEdge base,
        boolean pegShadow) {

    // handle a special case - if the bar colour has alpha == 0, it is
    // invisible so we shouldn't draw any shadow
    Paint itemPaint = renderer.getItemPaint(row, column);
    if (itemPaint instanceof Color) {
        Color c = (Color) itemPaint;
        if (c.getAlpha() == 0) {
            return;
        }
    }

    RectangularShape shadow = createShadow(bar, renderer.getShadowXOffset(),
            renderer.getShadowYOffset(), base, pegShadow);
    g2.setPaint(renderer.getShadowPaint());
    g2.fill(shadow);

}