Examples of SVGMatrix


Examples of org.w3c.dom.svg.SVGMatrix

        while (i.hasNext()) {
            AbstractSVGTransform t = (AbstractSVGTransform) i.next();
            if (t == null) {
                sb.append("null");
            } else {
                SVGMatrix m = t.getMatrix();
                switch (t.getType()) {
                    case SVGTransform.SVG_TRANSFORM_TRANSLATE:
                        sb.append("translate(");
                        sb.append(m.getE());
                        sb.append(',');
                        sb.append(m.getF());
                        sb.append(')');
                        break;
                    case SVGTransform.SVG_TRANSFORM_SCALE:
                        sb.append("scale(");
                        sb.append(m.getA());
                        sb.append(',');
                        sb.append(m.getD());
                        sb.append(')');
                        break;
                    case SVGTransform.SVG_TRANSFORM_SKEWX:
                        sb.append("skewX(");
                        sb.append(t.getAngle());
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

        }

        protected SVGTransformItem(SVGTransform transform){
            super();
            type = transform.getType();
            SVGMatrix matrix = transform.getMatrix();
            switch(type){
            case SVGTransform.SVG_TRANSFORM_TRANSLATE:
                setTranslate(matrix.getE(),matrix.getF());
                break;
            case SVGTransform.SVG_TRANSFORM_SCALE:
                setScale(matrix.getA(),matrix.getD());
                break;
            case SVGTransform.SVG_TRANSFORM_ROTATE:
                if (matrix.getE() == 0.0f ){
                    rotate(transform.getAngle());
                }
                else{
                    angleOnly = false;
                    if ( matrix.getA() == 1.0f ){
                        setRotate(transform.getAngle(),matrix.getE(),matrix.getF());
                    }
                    else{
                        if ( transform instanceof AbstractSVGTransform){
                            AbstractSVGTransform internal = (AbstractSVGTransform)transform;
                            setRotate(internal.getAngle(),internal.getX(),internal.getY());
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

        }

        protected SVGTransformItem(SVGTransform transform){
            super();
            type = transform.getType();
            SVGMatrix matrix = transform.getMatrix();
            switch(type){
            case SVGTransform.SVG_TRANSFORM_TRANSLATE:
                setTranslate(matrix.getE(),matrix.getF());
                break;
            case SVGTransform.SVG_TRANSFORM_SCALE:
                setScale(matrix.getA(),matrix.getD());
                break;
            case SVGTransform.SVG_TRANSFORM_ROTATE:
                if (matrix.getE() == 0.0f ){
                    rotate(transform.getAngle());
                }
                else{
                    angleOnly = false;
                    if ( matrix.getA() == 1.0f ){
                        setRotate(transform.getAngle(),matrix.getE(),matrix.getF());
                    }
                    else{
                        if ( transform instanceof AbstractSVGTransform){
                            AbstractSVGTransform internal = (AbstractSVGTransform)transform;
                            setRotate(internal.getAngle(),internal.getX(),internal.getY());
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

   */
  public static double[] getRelativeCoordinates(Event evt, Element reference) {
    if(evt instanceof DOMMouseEvent && reference instanceof SVGLocatable && reference instanceof SVGElement) {
      // Get the screen (pixel!) coordinates
      DOMMouseEvent gnme = (DOMMouseEvent) evt;
      SVGMatrix mat = ((SVGLocatable) reference).getScreenCTM();
      SVGMatrix imat = mat.inverse();
      SVGPoint cPt = ((SVGElement) reference).getOwnerSVGElement().createSVGPoint();
      cPt.setX(gnme.getClientX());
      cPt.setY(gnme.getClientY());
      // Have Batik transform the screen (pixel!) coordinates into SVG element
      // coordinates
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

   * @return coordinates
   */
  public static SVGPoint elementCoordinatesFromEvent(Document doc, Element tag, Event evt) {
    try {
      DOMMouseEvent gnme = (DOMMouseEvent) evt;
      SVGMatrix mat = ((SVGLocatable) tag).getScreenCTM();
      SVGMatrix imat = mat.inverse();
      SVGPoint cPt = ((SVGDocument) doc).getRootElement().createSVGPoint();
      cPt.setX(gnme.getClientX());
      cPt.setY(gnme.getClientY());
      return cPt.matrixTransform(imat);
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

   * @return coordinates
   */
  public static SVGPoint elementCoordinatesFromEvent(Document doc, Element tag, Event evt) {
    try {
      DOMMouseEvent gnme = (DOMMouseEvent) evt;
      SVGMatrix mat = ((SVGLocatable) tag).getScreenCTM();
      SVGMatrix imat = mat.inverse();
      SVGPoint cPt = ((SVGDocument) doc).getRootElement().createSVGPoint();
      cPt.setX(gnme.getClientX());
      cPt.setY(gnme.getClientY());
      return cPt.matrixTransform(imat);
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

   */
  public static double[] getRelativeCoordinates(Event evt, Element reference) {
    if(evt instanceof DOMMouseEvent && reference instanceof SVGLocatable && reference instanceof SVGElement) {
      // Get the screen (pixel!) coordinates
      DOMMouseEvent gnme = (DOMMouseEvent) evt;
      SVGMatrix mat = ((SVGLocatable) reference).getScreenCTM();
      SVGMatrix imat = mat.inverse();
      SVGPoint cPt = ((SVGElement) reference).getOwnerSVGElement().createSVGPoint();
      cPt.setX(gnme.getClientX());
      cPt.setY(gnme.getClientY());
      // Have Batik transform the screen (pixel!) coordinates into SVG element
      // coordinates
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

     */
    private void updateCursor(final int deltaX, final int deltaY) {
        // Translate the cursor pointer.
        final int translateX = clampDelta(0, _displayWidth, _cursorX, deltaX);
        final int translateY = clampDelta(0, _displayHeight, _cursorY, deltaY);
        final SVGMatrix transform = _cursor.getMatrixTrait("transform");
        transform.mTranslate(translateX, translateY);
        _cursor.setMatrixTrait("transform", transform);

        // Update cursor position Text
        _cursorX = MathUtilities.clamp(0, _cursorX + translateX, _displayWidth);
        _cursorY =
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

        _spiralElement.setTrait("fill", "none");
        _spiralElement.setFloatTrait("stroke-width", 3);
        _spiralElement.setFloatTrait("fill-opacity", 0.9f);

        // Do some transformations on the path.
        final SVGMatrix transform = _spiralElement.getMatrixTrait("transform");
        if (_displayHeight > _displayWidth) {
            transform.mTranslate(Util.convertDefaultValue(110, true), 0);
        } else {
            transform.mTranslate(0, Util.convertDefaultValue(-110, true));
        }

        _spiralElement.setMatrixTrait("transform", transform);

        // Create an image element.
View Full Code Here

Examples of org.w3c.dom.svg.SVGMatrix

            _greenElement.setFloatTrait("cx", Util.convertDefaultValue(200,
                    true));
            _greenElement.setFloatTrait("cy", Util.convertDefaultValue(180,
                    false));

            final SVGMatrix transform =
                    _spiralElement.getMatrixTrait("transform");
            if (_displayHeight > _displayWidth) {
                transform.mTranslate(Util.convertDefaultValue(-70, true), Util
                        .convertDefaultValue(40, false));
            } else {
                transform.mTranslate(Util.convertDefaultValue(60, true), Util
                        .convertDefaultValue(-50, false));
            }

            _spiralElement.setMatrixTrait("transform", transform);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.