import proxml.*; PImage img = null; PImage prevImg = null; //xml element to store and load the drawn ellipses proxml.XMLElement pipes; XMLInOut xmlInOut; int track = 0; void setup(){ size(300,300); background(255); loadXML(); } void xmlEvent(proxml.XMLElement element){ pipes = element; initEllipses(); //initialise PImage for background } void loadXML(){ //load ellipses from file if it exists xmlInOut = new XMLInOut(this); try{ xmlInOut.loadElement("http://pipes.yahoo.com/pipes/pipe.run?_id=rJkmdk2b3RGn_ShI1ZzWFw&_render=rss&search=sex"); } catch(Exception e){ //if the xml file could not be loaded it has to be created xmlEvent(new proxml.XMLElement("pipes")); } } //draw all ellipses saved in the xml file void initEllipses(){ //pipes.printElementTree(" "); proxml.XMLElement pipe; proxml.XMLElement item; proxml.XMLElement data; String matchStr = "link"; float longX = 0; float latY = 0; for(int i = 0; i < pipes.getChild(0).countChildren();i++){ item = pipes.getChild(0).getChild(i); for(int e = 0; e < item.countChildren();e++){ data = item.getChild(e); if(matchStr.equals(data.getName()) == true){ println(data.getChild(0).getText()); if(img != null){ prevImg = img; } img = loadImage(data.getChild(0).getText()); img.resize(width, height); tint(255,255,255,1.5); image(img,0,0); track++; println(track); //blend(img,0, 0, img.width, img.height, 0, 0, img.width, img.height, DODGE ); } } } } void draw(){ }