本文整理汇总了C#中SVGGraphicsPath.GetBound方法的典型用法代码示例。如果您正苦于以下问题:C# SVGGraphicsPath.GetBound方法的具体用法?C# SVGGraphicsPath.GetBound怎么用?C# SVGGraphicsPath.GetBound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGGraphicsPath
的用法示例。
在下文中一共展示了SVGGraphicsPath.GetBound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetGradientVector
private void SetGradientVector(SVGGraphicsPath graphicsPath)
{
Rect bound = graphicsPath.GetBound();
if(_linearGradElement.x1.unitType == SVGLengthType.Percentage)
_x1 = bound.x + (bound.width * _x1 / 100f);
if(_linearGradElement.y1.unitType == SVGLengthType.Percentage)
_y1 = bound.y + (bound.height * _y1 / 100f);
if(_linearGradElement.x2.unitType == SVGLengthType.Percentage)
_x2 = bound.x + (bound.width * _x2 / 100f);
if(_linearGradElement.y2.unitType == SVGLengthType.Percentage)
_y2 = bound.y + (bound.height * _y2 / 100f);
if(_linearGradElement.gradientUnits == SVGGradientUnit.ObjectBoundingBox) {
Vector2 _point = graphicsPath.matrixTransform.Transform(new Vector2(_x1, _y1));
_x1 = _point.x;
_y1 = _point.y;
_point = graphicsPath.matrixTransform.Transform(new Vector2(_x2, _y2));
_x2 = _point.x;
_y2 = _point.y;
}
}
示例2: SetGradientVector
//-----
private void SetGradientVector(SVGGraphicsPath graphicsPath)
{
Rect bound = graphicsPath.GetBound();
if(_radialGradElement.cx.unitType == SVGLengthType.Percentage) {
_cx = bound.x + (bound.width * _cx / 100f);
}
if(_radialGradElement.cy.unitType == SVGLengthType.Percentage) {
_cy = bound.y + (bound.height * _cy / 100f);
}
if(_radialGradElement.r.unitType == SVGLengthType.Percentage) {
Vector2 _p1 = new Vector2(bound.x, bound.y);
Vector2 _p2 = new Vector2(bound.x + bound.width, bound.y + bound.height);
_p1 = graphicsPath.matrixTransform.Transform(_p1);
_p2 = graphicsPath.matrixTransform.Transform(_p2);
float dd = (float)Math.Sqrt((_p2.x - _p1.x) * (_p2.x - _p1.x) + (_p2.y - _p1.y) * (_p2.y - _p1.y));
_r = (dd * _r / 100f);
}
if(_radialGradElement.fx.unitType == SVGLengthType.Percentage) {
_fx = bound.x + (bound.width * _fx / 100f);
}
if(_radialGradElement.fy.unitType == SVGLengthType.Percentage) {
_fy = bound.y + (bound.height * _fy / 100f);
}
if((float)Math.Sqrt((_cx - _fx) * (_cx - _fx) + (_cy - _fy) * (_cy - _fy)) > _r) {
Vector2 _cP = CrossPoint(_cx, _cy);
_fx = _cP.x;
_fy = _cP.y;
}
if(_radialGradElement.gradientUnits == SVGGradientUnit.ObjectBoundingBox) {
Vector2 _point = new Vector2(_cx, _cy);
_point = graphicsPath.matrixTransform.Transform(_point);
_cx = _point.x;
_cy = _point.y;
_point = new Vector2(_fx, _fy);
_point = graphicsPath.matrixTransform.Transform(_point);
_fx = _point.x;
_fy = _point.y;
}
}