use of org.loboevolution.html.dom.svg.SVGTransformList in project LoboEvolution by LoboEvolution.
the class SVGLocatableImpl method getCTM.
/**
* {@inheritDoc}
*/
@Override
public SVGMatrix getCTM() {
SVGMatrix thisMatrix = new SVGMatrixImpl();
if (this instanceof SVGTransformable) {
SVGTransformList transofrm = ((SVGTransformable) this).getTransform().getAnimVal();
if (transofrm != null) {
SVGTransform consolidate = transofrm.consolidate();
if (consolidate != null) {
thisMatrix = new SVGMatrixImpl((SVGMatrixImpl) consolidate.getMatrix());
}
}
}
Node parent = getParentNode();
while (parent != null && parent != getViewportElement() && !(parent instanceof SVGTransformable)) {
parent = parent.getParentNode();
}
if (parent instanceof SVGTransformable) {
SVGMatrix parentMatrix = ((SVGTransformable) parent).getCTM();
return parentMatrix.multiply(thisMatrix);
} else {
return thisMatrix;
}
}
use of org.loboevolution.html.dom.svg.SVGTransformList in project LoboEvolution by LoboEvolution.
the class SVGTransformableImpl method getTransform.
/**
* {@inheritDoc}
*/
@Override
public SVGAnimatedTransformList getTransform() {
AbstractCSSProperties style = getStyle();
String transformString = Strings.isNotBlank(style.getTransform()) ? style.getTransform() : this.getAttribute("transform");
SVGTransformList createTransformList = SVGTransformListImpl.createTransformList(transformString);
return new SVGAnimatedTransformListImpl((SVGTransformListImpl) createTransformList);
}
use of org.loboevolution.html.dom.svg.SVGTransformList in project LoboEvolution by LoboEvolution.
the class SVGGraphic method drawable.
/**
* <p>drawable.</p>
*
* @param graphics a {@link java.awt.Graphics2D} object.
* @param shape a {@link java.awt.Shape} object.
*/
protected void drawable(Graphics2D graphics, Shape shape) {
final Paint fillPaint = getFillPaint(shape);
final Paint strokePaint = getStrokelPaint(shape);
final BasicStroke stroke = getStroke();
SVGClipPathElementImpl clipPath = getClippingPath();
SVGAnimatedTransformList animateTransformList = getTransform();
graphics.setStroke(stroke);
if (clipPath != null) {
Shape clipShape = clipPath.getClippingShape(this);
if (clipShape != null) {
graphics.setClip(clipShape);
}
}
if (animateTransformList != null) {
SVGTransformList transformList = animateTransformList.getBaseVal();
if (transformList != null) {
transform(graphics, transformList);
}
}
if (fillPaint == null && strokePaint == null) {
graphics.setPaint(Color.BLACK);
graphics.fill(shape);
}
if (fillPaint != null) {
graphics.setPaint(fillPaint);
graphics.fill(shape);
}
if (strokePaint != null) {
graphics.setPaint(strokePaint);
graphics.draw(shape);
}
}
Aggregations