我试图通过传递图像宽度和高度的参数来设置处理 3.0中的窗口大小。但是,处理会抛出错误并要求检查参考部分,但这没有帮助。代码如下。
PImage img;
...
void setup(){
img = loadImage("XYZ.JPG");
float w = img.width;
float h = img.height;
size(int(w), int(h));
image(img, 0, 0);
}
Run Code Online (Sandbox Code Playgroud)
和错误如下:
size() function cannot be used here
Run Code Online (Sandbox Code Playgroud)