Java:从画布上的图像绘制羽毛形状

时间:2021-03-27 13:33:06

标签: java canvas

我正在尝试制作一个游戏(2D),其中一个光源应该照亮周围区域。我目前有一个带有一些字母的霓虹灯标志,这意味着光源是椭圆形的(见图)。我希望除了标志周围的一切都是漆黑的enter image description here

我目前开设了以下课程:

public class bgReveal extends GameObject{

    private Image bg;

    public bgReveal(int x, int y, int radX, int radY, ID id, Image bg) {
        super(x, y, id);
        this.bg = bg;
        this.radX = radX;
        this.radY = radY;
    
    }

    public void update() {
    
        //this and render gets called 60 times each second
    
    }

    public void render(Graphics g) {
    
        //Here I'll draw the background using the elipse radius radX, radY to
        //cut out the elipse, then feathering the image
    
    }

}

我会将这个“游戏对象”添加到处理图像的更新和渲染的处理程序中。关于如何让这个图像工作的任何想法?

0 个答案:

没有答案