We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I got the following code from a tutorial. I checked it with the reference and it should work.
The error I get is: "The size of this sketch could not be determined from your code. Use only numbers (not variables) for the size() command. Read the size() reference for more details.".
void setup(){
PImage img = loadImage("image.jpg");
size(img.width*2, img.height, P2D);
}
Answers
The first line should be
void setup(){
Which version of Processing are you using?
I'm using Processing 3
https://GitHub.com/processing/processing-docs/issues/436
But what is the solution then?Nevermind, I didn't scroll downYou can still use surface.setSize(): https://forum.Processing.org/two/discussions/tagged?Tag=setsize()
Why is surface.setSize() not in the Processing reference?
B/c the devs consider them some internal hack which we're not clever enough to know about! =P~
Wow thanks for the inside information. I fixed it with
void settings()
thoughThe actual API Application Programming Interface) will invariably be ahead of the documentation. It takes a huge effort to keep reference documentation up to date.
@quark, I doubt it that's the case for surface or getSurface().
And many others like getGraphics(), dataPath(), dataFile(), etc.
They don't even mention that class PSurface exists! :-@
Even the
@Deprecated
frame was never once mentioned either.Those are very deliberate decisions to leave lotsa useful API outside normal users.
They're rather intended for 3rd-party lib devs instead. >-)