We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey, I just begann using processing, and I have the following problem: I cant load anything! no font, no image, no PShape(image) :(( It would be great, if someone could help me :)
This is basically what I am doing:
First: I Write some code:
//-------------------------------
PImage mapImage;
void setup()
{
size(600,600);
mapImage=loadImage("landkarte_dk.svg");
}
void draw()
{
background(200);
image(mapImage,0,0);
smooth();
}
//---------------------------------------
Then I copy my image into the same folder as the processing file. So the image is right next to the code.
So - i save everything, and hit run. The Emulator/Window opens. The screen stays grey. no image appears. After a few seconds a loading icon appears. After a few minutes I close the "Emulator"(sorry I just cant remember the proper english word).
When I try to load a font this error appears: NullPointer exeption appears. But when I try to load the image(PShape or Pimage) another error appears: Out of memory. (Processing is allowed to use 2gb memory. )
I use processing 3.0.1 and a machine with windows 8.1.
It would be sooo sweet if someone could help me with this.
//my english is realy bad, that is why I tried to write in simple sentences.
Answers
I wonder whether loadShape() is more appropriate for ".svg" files?
https://processing.org/reference/loadShape_.html
Also read about how to post formatted code here:
https://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text
actually I wish to use PShape. But I tested font and PImage also, just in case. I also formatted my former post. Thank you.
This is what I actually tried to do:
Main:
class land render:
AFAIK, unfortunately Processing can't deal w/ all types of ".svg" files. Dunno the details about it, sorry.
Anyways, how about your Land class to keep its own PShape; plus coordinates & dimensions?
You only have to pass the loadShape() once when instantiating it like this: *-:)
land = new Land(loadShape("myImage.svg"), 0, 0, 50, 50);
Thank you. An out of memory Error wont appear. But the svg File wont show. Maybe I can find out now what the problem is.
@Beya said:
Read the overview, specifically 'Loading and displaying data':