atom
YaBB Newbies
Offline
Posts: 8
Re: PDF export
Reply #4 - Jun 14th , 2010, 3:26pm
Quote: void tileDrawing() { switch (myTile) { // ----- case 0: //noStroke();v rect (0,0,mySize*myScale,mySize*myScale); if (writesvg) { svgout.println ("<rect x=\"0\" y=\"0\" width=\"" + mySize*myScale + "\" height=\"" + mySize*myScale + "\" fill=\"#" + hex (myLerpColor, 6) + "\" opacity=\"" + myOpacity +"\" transform=\"translate(" + (myX-(mySize*myScale/2)) + "," + (myY-(mySize*myScale/2)) + ") rotate(" + int (degrees (myAngle)) + ", " + (mySize*myScale/2) + ", " + (mySize*myScale/2) +")\" />" ); } break ; // --------- case 1: ellipse (0,0,mySize*myScale,mySize*myScale); break ; // --------- case 2: line (-mySize*myScale,-mySize*myScale,mySize*myScale,mySize*myScale); break ; // --------- case 3: imageMode (CENTER ); image (myImage,0,0,mySize*myScale,mySize*myScale); break ; } } // - - - - - - - - - - void renderTile () { fill (myColor); myLerpColor = myColor; if (secondon) { myLerpColor = lerpColor (myColor,targetColor,lerpValue); fill (myLerpColor); tint (myLerpColor); } else { tint (myColor); } myOpacity = map (alpha (myLerpColor),0,255,0,1); if (strokeon) { stroke (strokeColor); } else { noStroke (); } pushMatrix (); translate (myX,myY); rotate (myAngle); if (writesvg) { //svgout.println ("<g >"); //svgout.println ("<g transform=\"rotate(" + int(degrees(myAngle)) + ")\">"); //<g transform="translate(50,90)"> } tileDrawing(); if (writesvg) { //svgout.println ("</g>"); //svgout.println ("</g>"); //<g transform="translate(50,90)"> } popMatrix (); if (outside) { for (int i = 0; i < 8;i++) { pushMatrix (); switch (i) { // -------------------------------------- links case 0: translate (myX-g.myWidth,myY); break ; // -------------------------------------- rechts case 1: translate (myX+g.myWidth,myY); break ; // -------------------------------------- oben case 2: translate (myX,myY-g.myHeight); break ; // -------------------------------------- unten case 3: translate (myX,myY+g.myHeight); break ; // -------------------------------------- links oben case 4: translate (myX-g.myWidth,myY-g.myHeight); break ; // -------------------------------------- rechts oben case 5: translate (myX+g.myWidth,myY-g.myHeight); break ; // -------------------------------------- links unten case 6: translate (myX-g.myWidth,myY+g.myHeight); break ; // -------------------------------------- rechts unten case 7: translate (myX+g.myWidth,myY+g.myHeight); break ; } rotate (myAngle); tileDrawing(); popMatrix (); } } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void outofbounds () { if (myX+(mySize*myScale)/2 > g.myWidth || myX-(mySize*myScale)/2 < 0 || myY+(mySize*myScale)/2 > g.myHeight || myY-(mySize*myScale)/2 < 0) { outside = true ; //println ("draussen"); } }