PathGraphics.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * Draws a BufferedImage that is filtered with a BufferedImageOp.
 * The rendering attributes applied include the clip, transform
 * and composite attributes.  This is equivalent to:
 * <pre>
 * img1 = op.filter(img, null);
 * drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null);
 * </pre>
 * @param op The filter to be applied to the image before drawing.
 * @param img The BufferedImage to be drawn.
 *            This method does nothing if {@code img} is null.
 * @param x,y The location in user space where the image should be drawn.
 * @see #transform
 * @see #setTransform
 * @see #setComposite
 * @see #clip
 * @see #setClip
 */
public void drawImage(BufferedImage img,
                      BufferedImageOp op,
                      int x,
                      int y) {

    if (img == null) {
        return;
    }

    int srcWidth = img.getWidth(null);
    int srcHeight = img.getHeight(null);

    if (op != null) {
        img = op.filter(img, null);
    }
    if (srcWidth <= 0 || srcHeight <= 0) {
        return;
    } else {
        AffineTransform xform = new AffineTransform(1f,0f,0f,1f,x,y);
        drawImageToPlatform(img, xform, null,
                            0, 0, srcWidth, srcHeight, false);
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号