Example #1
0
        public static float getScaleX(uiMatrix3 matrix)
        {
            // ignore perspective parameters for now.
            if (matrix.isIdentity())
            {
                return(1.0f);
            }

            if (matrix.getSkewY() == 0)
            {
                return(matrix.getScaleX());
            }

            var x = matrix.getScaleX();
            var y = matrix.getSkewY();

            return(Mathf.Sqrt(x * x + y * y));
        }
Example #2
0
        static void Affine_pts(uiMatrix3 m, uiOffset[] dst, uiOffset[] src, int count)
        {
            D.assert(m._getType() != TypeMask.kPerspective_Mask);
            if (count > 0)
            {
                var tx = m.getTranslateX();
                var ty = m.getTranslateY();
                var sx = m.getScaleX();
                var sy = m.getScaleY();
                var kx = m.getSkewX();
                var ky = m.getSkewY();

                for (int i = 0; i < count; ++i)
                {
                    dst[i] = new uiOffset(
                        src[i].dx * sx + src[i].dy * kx + tx,
                        src[i].dx * ky + src[i].dy * sy + ty);
                }
            }
        }