公共课Lab03 {
public void loadAnImage()
{
// Please write your code after this line
ColorImage car = new ColorImage();
ColorImage car1= new ColorImage();
ColorImage car2= new ColorImage();
Canvas canvas = new Canvas(car2.getWidth(),car2.getHeight());
car2 = car.add(car1);
canvas.add(car);
canvas.add(car1);
}
答案 0 :(得分:0)
也许我无法解释这个问题。 问题是我想将2张照片合并到一张具有相同尺寸的画布上......它们应该相互粘在一起,没有空间 经过多次尝试,我设法用这段代码解决了这个问题。
public class Lab03{
public void loadTwoImagesOnTheSameCanvas()
{
ColorImage car = new ColorImage();
ColorImage car1 = new ColorImage();
Canvas canvas = new Canvas(2*car.getWidth(),car.getHeight());
canvas.add(car,0,0);
canvas.add(car1,400,0);
}
}