EmptyTexture.java 文件源码

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

项目:PDFReporter-Studio 作者:
public static TexturePaint createTexture(Color c1, Color c2) {
    int gridSize = 10;
    BufferedImage img = new BufferedImage(gridSize * 2, gridSize * 2, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = img.createGraphics();

    AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f);
    g2.setComposite(ac);

    g2.setColor(c1 != null ? c1 : COLOR1);
    g2.fillRect(0, 0, 10, 10);
    g2.fillRect(10, 10, 10, 10);

    g2.setColor(c2 != null ? c2 : COLOR2);
    g2.fillRect(10, 0, 10, 10);
    g2.fillRect(0, 10, 10, 10);

    return new TexturePaint(img, new java.awt.Rectangle(0, 0, gridSize, gridSize));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号