ScaleNonUniform() public method

public ScaleNonUniform ( float scaleFactorX, float scaleFactorY ) : Matrix2x3,
scaleFactorX float
scaleFactorY float
return Matrix2x3,
示例#1
0
    public Matrix2x3 ViewBoxTransform()
    {
        if (_cachedViewBoxTransform == null)
        {
            Matrix2x3 matrix = new Matrix2x3();

            float x = 0.0f, y = 0.0f, w, h, attrWidth = _width.value, attrHeight = _height.value;

            if (!string.IsNullOrEmpty(_attrList.GetValue("viewBox")))
            {
                Rect r = _viewport;
                x += -r.x;
                y += -r.y;
                w  = r.width;
                h  = r.height;
            }
            else
            {
                w = attrWidth;
                h = attrHeight;
            }

            float x_ratio = attrWidth / w, y_ratio = attrHeight / h;

            matrix = matrix.ScaleNonUniform(x_ratio, y_ratio);
            matrix = matrix.Translate(x, y);
            _cachedViewBoxTransform = matrix;
        }
        return(_cachedViewBoxTransform);
    }
示例#2
0
    public Matrix2x3 ViewBoxTransform()
    {
        if(_cachedViewBoxTransform == null) {
          Matrix2x3 matrix = new Matrix2x3();

          float x = 0.0f, y = 0.0f, w, h, attrWidth = _width.value, attrHeight = _height.value;

          if(!string.IsNullOrEmpty(_attrList.GetValue("viewBox"))) {
        Rect r = _viewport;
        x += -r.x;
        y += -r.y;
        w = r.width;
        h = r.height;
          } else {
        w = attrWidth;
        h = attrHeight;
          }

          float x_ratio = attrWidth / w, y_ratio = attrHeight / h;

          matrix = matrix.ScaleNonUniform(x_ratio, y_ratio);
          matrix = matrix.Translate(x, y);
          _cachedViewBoxTransform = matrix;
        }
        return _cachedViewBoxTransform;
    }