public SVGMatrix ViewBoxTransform() { if (this._cachedViewBoxTransform == null) { SVGMatrix matrix = new SVGMatrix(); float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; float attrWidth = this._width.value; float attrHeight = this._height.value; if (_attrList.GetValue("viewBox") != "") { Rect r = this._viewport; x += -r.x; y += -r.y; w = r.width; h = r.height; } else { w = attrWidth; h = attrHeight; } float x_ratio = attrWidth / w; float y_ratio = attrHeight / h; matrix = matrix.ScaleNonUniform(x_ratio, y_ratio); matrix = matrix.Translate(x, y); _cachedViewBoxTransform = matrix; } return(this._cachedViewBoxTransform); }
public SVGMatrix ViewBoxTransform() { if(this._cachedViewBoxTransform == null) { SVGMatrix matrix = new SVGMatrix(); float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; float attrWidth = this._width.value; float attrHeight = this._height.value; if(_attrList.GetValue("viewBox") != "") { Rect r = this._viewport; x += -r.x; y += -r.y; w = r.width; h = r.height; } else { w = attrWidth; h = attrHeight; } float x_ratio = attrWidth / w; float y_ratio = attrHeight / h; matrix = matrix.ScaleNonUniform(x_ratio, y_ratio); matrix = matrix.Translate(x, y); _cachedViewBoxTransform = matrix; } return this._cachedViewBoxTransform; }