//somehow the circle radii need to be doubled
//or else theyre too small => processing bug?
// r*=2;
// r2*=2;
MTEllipse comp = new MTEllipse(pa, middlePoint, r, r2);
returnComp = comp;
}else if (gfxElem instanceof SVGOMCircleElement){
SVGOMCircleElement circleElem = (SVGOMCircleElement)gfxElem;
float cx = circleElem.getCx().getBaseVal().getValue();
float cy = circleElem.getCy().getBaseVal().getValue();
float r = circleElem.getR().getBaseVal().getValue();
float r2 = circleElem.getR().getBaseVal().getValue();
Vertex middlePoint = new Vertex(cx,cy,0);
//Apply transformation, transform centerpoint and the radii
try{
middlePoint.transform(currentLocalTransformMatrix);
}catch(Exception e){
logger.error(e.getMessage());
}
//somehow the circle radii need to be doubled
//or else theyre too small => processing bug?
// r*=2;
// r2*=2;
MTEllipse comp = new MTEllipse(pa, middlePoint, r, r2);
returnComp = comp;
}else if (gfxElem instanceof SVGOMLineElement){
SVGOMLineElement line = (SVGOMLineElement)gfxElem;
float x1 = line.getX1().getBaseVal().getValue();
float y1 = line.getY1().getBaseVal().getValue();
float x2 = line.getX2().getBaseVal().getValue();
float y2 = line.getY2().getBaseVal().getValue();
//logger.debug("Line x1: " + x1 + ",y1:" + y1 + ",x2:" + x2 + ",y2:" + y2);
MTLine comp = new MTLine(pa, x1,y1 ,x2,y2);
try{
comp.setLocalMatrix(currentLocalTransformMatrix);
}catch(Exception e){
logger.error(e.getMessage());
}
returnComp = comp;
}else if (gfxElem instanceof SVGOMClipPathElement){
}else if (gfxElem instanceof SVGOMDefsElement){
}else if (gfxElem instanceof SVGOMMaskElement){
}else if (gfxElem instanceof SVGOMSwitchElement){
}else if (gfxElem instanceof SVGOMFlowRootElement){
}else if (gfxElem instanceof SVGURIReferenceGraphicsElement){
}else if (gfxElem instanceof BindableElement){
}else if (gfxElem instanceof SVGOMForeignObjectElement){
}else if (gfxElem instanceof SVGOMToBeImplementedElement){
}
//Do the finishing touch of the svg graphics element
if (returnComp != null){
returnComp.setName(gfxElem.getTagName());
//Set style infos
if (returnComp instanceof AbstractVisibleComponent){
AbstractVisibleComponent comp = (AbstractVisibleComponent)returnComp;
//Set Fill
comp.setFillColor(new MTColor(fillR, fillG, fillB, fillOpacity));
comp.setNoFill(noFill);
//Set Stroke
comp.setStrokeColor(new MTColor(strokeR, strokeG, strokeB, strokeOpacity));
//Opengl cant handle big lines well
//So cap at width 3
if (strokeWidth > 2.0f)
strokeWidth = 2.0f;
comp.setStrokeWeight(strokeWidth);
comp.setNoStroke(noStroke);
//Other
comp.setDrawSmooth(true);
comp.setPickable(false);
//Hack for smoothing non stroked components with a stroke same as fillcolor
if (comp.isNoStroke()
&& linearGradient == null
){
comp.setStrokeColor(new MTColor(fillR, fillG, fillB, fillOpacity)); //fillOpacity
comp.setStrokeWeight(0.6f);
//Ellipse doesent smooth right with 0.1f strokeweight
if (comp instanceof MTEllipse){
comp.setStrokeWeight(1.0f);
}
comp.setNoStroke(false);
}
//Some settings for Geometric shapes (actually should all be)
if (comp instanceof AbstractShape ){
AbstractShape shape = (AbstractShape)comp;