Exemple #1
0
 public SVGTransform(Matrix2x3 matrix)
 {
     _type = SVGTransformMode.Matrix;
     this.matrix = matrix;
 }
Exemple #2
0
 public void SetScale(float sx, float sy)
 {
     _type = SVGTransformMode.Scale;
     matrix = new Matrix2x3().ScaleNonUniform(sx, sy);
 }
Exemple #3
0
 public void SetTranslate(float tx, float ty)
 {
     _type = SVGTransformMode.Translate;
     matrix = new Matrix2x3().Translate(tx, ty);
 }
Exemple #4
0
    public SVGTransform(string strKey, string strValue)
    {
        string[] valuesStr = SVGStringExtractor.ExtractTransformValue(strValue);
        int      len       = valuesStr.Length;

        float[] values = new float[len];

        for (int i = 0; i < len; i++)
        {
            values.SetValue(float.Parse(valuesStr[i], CultureInfo.InvariantCulture), i);
        }
        switch (strKey)
        {
        case "translate":
            switch (len)
            {
            case 1:
                SetTranslate(values[0], 0);
                break;

            case 2:
                SetTranslate(values[0], values[1]);
                break;

            default:
                throw new ApplicationException("Wrong number of arguments in translate transform");
            }
            break;

        case "rotate":
            switch (len)
            {
            case 1:
                SetRotate(values[0]);
                break;

            case 3:
                SetRotate(values[0], values[1], values[2]);
                break;

            default:
                throw new ApplicationException("Wrong number of arguments in rotate transform");
            }
            break;

        case "scale":
            switch (len)
            {
            case 1:
                SetScale(values[0], values[0]);
                break;

            case 2:
                SetScale(values[0], values[1]);
                break;

            default:
                throw new ApplicationException("Wrong number of arguments in scale transform");
            }
            break;

        case "skewX":
            if (len != 1)
            {
                throw new ApplicationException("Wrong number of arguments in skewX transform");
            }
            SetSkewX(values[0]);
            break;

        case "skewY":
            if (len != 1)
            {
                throw new ApplicationException("Wrong number of arguments in skewY transform");
            }
            SetSkewY(values[0]);
            break;

        case "matrix":
            if (len != 6)
            {
                throw new ApplicationException("Wrong number of arguments in matrix transform");
            }
            SetMatrix(
                new Matrix2x3(
                    values[0],
                    values[1],
                    values[2],
                    values[3],
                    values[4],
                    values[5]
                    ));
            break;

        default:
            _type = SVGTransformMode.Unknown;
            break;
        }
    }
Exemple #5
0
 public void SetRotate(float rotateAngle)
 {
     _type = SVGTransformMode.Rotate;
     _angle = rotateAngle;
     matrix = new Matrix2x3().Rotate(rotateAngle);
 }
 public void SetSkewY(float angle)
 {
     this._type = SVGTransformMode.SkewY;
     this._angle = angle;
     this._matrix = new SVGMatrix().SkewY(angle);
 }
Exemple #7
0
 public void SetTranslate(float tx, float ty)
 {
     this._type   = SVGTransformMode.Translate;
     this._matrix = SVGMatrix.identity.Translate(tx, ty);
 }
Exemple #8
0
 public void SetTranslate(float tx, float ty)
 {
     this._type   = SVGTransformMode.Translate;
     this._matrix = new SVGMatrix().Translate(tx, ty);
 }
Exemple #9
0
 public void SetScale(float sx, float sy)
 {
     this._type   = SVGTransformMode.Scale;
     this._matrix = new SVGMatrix().ScaleNonUniform(sx, sy);
 }
Exemple #10
0
 public SVGTransform()
 {
     this._matrix = SVGMatrix.identity;
     this._type   = SVGTransformMode.Matrix;
 }
Exemple #11
0
 public void SetMatrix(SVGMatrix matrix)
 {
     this._type   = SVGTransformMode.Matrix;
     this._matrix = matrix;
 }
Exemple #12
0
 public void SetSkewY(float angle)
 {
     this._type   = SVGTransformMode.SkewY;
     this._angle  = angle;
     this._matrix = SVGMatrix.identity.SkewY(angle);
 }
Exemple #13
0
 public void SetRotate(float angle)
 {
     this._type   = SVGTransformMode.Rotate;
     this._angle  = angle;
     this._matrix = SVGMatrix.identity.Rotate(angle);
 }
Exemple #14
0
 public void SetScale(float sx, float sy)
 {
     this._type   = SVGTransformMode.Scale;
     this._matrix = SVGMatrix.identity.Scale(sx, sy);
 }
 public void SetTranslate(float tx, float ty)
 {
     this._type = SVGTransformMode.Translate;
     this._matrix = new SVGMatrix().Translate(tx, ty);
 }
Exemple #16
0
 public void SetRotate(float angle)
 {
     this._type   = SVGTransformMode.Rotate;
     this._angle  = angle;
     this._matrix = new SVGMatrix().Rotate(angle);
 }
 public void SetRotate(float angle)
 {
     this._type = SVGTransformMode.Rotate;
     this._angle = angle;
     this._matrix = new SVGMatrix().Rotate(angle);
 }
Exemple #18
0
 public void SetRotate(float angle, float cx, float cy)
 {
     this._type   = SVGTransformMode.Rotate;
     this._angle  = angle;
     this._matrix = new SVGMatrix().Translate(cx, cy).Rotate(angle).Translate(-cx, -cy);
 }
 public SVGTransform(SVGMatrix matrix)
 {
     this._type = SVGTransformMode.Matrix;
     this._matrix = matrix;
 }
Exemple #20
0
 public void SetSkewY(float angle)
 {
     this._type   = SVGTransformMode.SkewY;
     this._angle  = angle;
     this._matrix = new SVGMatrix().SkewY(angle);
 }
Exemple #21
0
 public SVGTransform(Matrix2x3 matrix)
 {
     _type       = SVGTransformMode.Matrix;
     this.matrix = matrix;
 }
Exemple #22
0
 public SVGTransform()
 {
     this._matrix = new SVGMatrix();
     this._type   = SVGTransformMode.Matrix;
 }
Exemple #23
0
 public void SetMatrix(Matrix2x3 m)
 {
     _type = SVGTransformMode.Matrix;
     matrix = m;
 }
Exemple #24
0
 public SVGTransform(SVGMatrix matrix)
 {
     this._type   = SVGTransformMode.Matrix;
     this._matrix = matrix;
 }
Exemple #25
0
 public void SetRotate(float rotateAngle, float cx, float cy)
 {
     _type = SVGTransformMode.Rotate;
     _angle = rotateAngle;
     matrix = new Matrix2x3().Translate(cx, cy).Rotate(angle).Translate(-cx, -cy);
 }
Exemple #26
0
 public void SetMatrix(Matrix2x3 m)
 {
     _type  = SVGTransformMode.Matrix;
     matrix = m;
 }
Exemple #27
0
 public void SetSkewY(float skewAngle)
 {
     _type = SVGTransformMode.SkewY;
     _angle = skewAngle;
     matrix = new Matrix2x3().SkewY(angle);
 }
Exemple #28
0
 public void SetTranslate(float tx, float ty)
 {
     _type  = SVGTransformMode.Translate;
     matrix = new Matrix2x3().Translate(tx, ty);
 }
Exemple #29
0
 public SVGTransform()
 {
     matrix = new Matrix2x3();
     _type = SVGTransformMode.Matrix;
 }
Exemple #30
0
 public void SetScale(float sx, float sy)
 {
     _type  = SVGTransformMode.Scale;
     matrix = new Matrix2x3().ScaleNonUniform(sx, sy);
 }
 public void SetMatrix(SVGMatrix matrix)
 {
     this._type = SVGTransformMode.Matrix;
     this._matrix = matrix;
 }
Exemple #32
0
 public void SetRotate(float rotateAngle)
 {
     _type  = SVGTransformMode.Rotate;
     _angle = rotateAngle;
     matrix = new Matrix2x3().Rotate(rotateAngle);
 }
 public void SetScale(float sx, float sy)
 {
     this._type = SVGTransformMode.Scale;
     this._matrix = new SVGMatrix().ScaleNonUniform(sx, sy);
 }
Exemple #34
0
 public void SetRotate(float rotateAngle, float cx, float cy)
 {
     _type  = SVGTransformMode.Rotate;
     _angle = rotateAngle;
     matrix = new Matrix2x3().Translate(cx, cy).Rotate(angle).Translate(-cx, -cy);
 }
 public void SetRotate(float angle, float cx, float cy)
 {
     this._type = SVGTransformMode.Rotate;
     this._angle = angle;
     this._matrix = new SVGMatrix().Translate(cx, cy).Rotate(angle).Translate(-cx, -cy);
 }
Exemple #36
0
 public void SetSkewY(float skewAngle)
 {
     _type  = SVGTransformMode.SkewY;
     _angle = skewAngle;
     matrix = new Matrix2x3().SkewY(angle);
 }
 public SVGTransform()
 {
     this._matrix = new SVGMatrix();
     this._type = SVGTransformMode.Matrix;
 }
Exemple #38
0
 public SVGTransform()
 {
     matrix = new Matrix2x3();
     _type  = SVGTransformMode.Matrix;
 }
        public SVGTransform(string strKey, string strValue)
        {
            string[] valuesStr = SVGStringExtractor.ExtractTransformValue(strValue);
            int len = valuesStr.Length;
            float[] values = new float[len];

            for (int i = 0; i<len; i++)
            {
                try
                {
                    values.SetValue(float.Parse(valuesStr [i], System.Globalization.CultureInfo.InvariantCulture), i);
                } catch (System.Exception e)
                {
                    UnityEngine.Debug.Log("SVGTransform: e: " + e);
                }
            }

            switch (strKey)
            {
                case "translate":
                    switch (len)
                    {
                        case 1:
                            SetTranslate(values [0], 0);
                            break;
                        case 2:
                            SetTranslate(values [0], values [1]);
                            break;
                        default:
                            throw new ApplicationException("Wrong number of arguments in translate transform");
                    }
                    break;
                case "rotate":
                    switch (len)
                    {
                        case 1:
                            SetRotate(values [0]);
                            break;
                        case 3:
                            SetRotate(values [0], values [1], values [2]);
                            break;
                        default:
                            throw new ApplicationException("Wrong number of arguments in rotate transform");
                    }
                    break;
                case "scale":
                    switch (len)
                    {
                        case 1:
                            SetScale(values [0], values [0]);
                            break;
                        case 2:
                            SetScale(values [0], values [1]);
                            break;
                        default:
                            throw new ApplicationException("Wrong number of arguments in scale transform");
                    }
                    break;
                case "skewX":
                    if (len != 1)
                        throw new ApplicationException("Wrong number of arguments in skewX transform");
                    SetSkewX(values [0]);
                    break;
                case "skewY":
                    if (len != 1)
                        throw new ApplicationException("Wrong number of arguments in skewY transform");
                    SetSkewY(values [0]);
                    break;
                case "matrix":
                    if (len != 6)
                        throw new ApplicationException("Wrong number of arguments in matrix transform");
                    SetMatrix(
              new SVGMatrix(
                values [0],
                values [1],
                values [2],
                values [3],
                values [4],
                values [5]
                    ));
                    break;
                default:
                    this._type = SVGTransformMode.Unknown;
                    break;
            }
        }
Exemple #40
0
    //Chuyen doi 1 day gia tri "a b c d e f" => arr[] = string{a, b, c, d, e, f};
    public SVGTransform(string strKey, string strValue)
    {
        string[] valuesStr = SVGStringExtractor.ExtractTransformValue(strValue);
        int len = valuesStr.Length;
        float[] values = new float[len];

        for(int i = 0; i<len; i++) {
          values.SetValue(SVGNumber.ParseToFloat(valuesStr[i]), i);
        }
        switch(strKey) {
          case "translate":
        switch(len) {
          case 1:
            SetTranslate(values[0], 0);
            break;
          case 2:
            SetTranslate(values[0], values[1]);
            break;
          default:
            throw new ApplicationException("Wrong number of arguments in translate transform");
        }
          break;
          case "rotate":
        switch(len) {
          case 1:
            SetRotate(values[0]);
            break;
          case 3:
            SetRotate(values[0], values[1], values[2]);
            break;
          default:
            throw new ApplicationException("Wrong number of arguments in rotate transform");
        }
          break;
          case "scale":
        switch(len) {
          case 1:
            SetScale(values[0], values[0]);
          break;
          case 2:
            SetScale(values[0], values[1]);
          break;
          default:
            throw new ApplicationException("Wrong number of arguments in scale transform");
        }
          break;
          case "skewX":
        if(len != 1)
          throw new ApplicationException("Wrong number of arguments in skewX transform");
          SetSkewX(values[0]);
          break;
          case "skewY":
        if(len != 1)
          throw new ApplicationException("Wrong number of arguments in skewY transform");
        SetSkewY(values[0]);
          break;
          case "matrix":
        if(len != 6)
          throw new ApplicationException("Wrong number of arguments in matrix transform");
        SetMatrix(
          new SVGMatrix(
            values[0],
            values[1],
            values[2],
            values[3],
            values[4],
            values[5]
            ));
          break;
          default:
        this._type = SVGTransformMode.Unknown;
          break;
        }
    }