本文整理汇总了C#中RectangleF.ToSD方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.ToSD方法的具体用法?C# RectangleF.ToSD怎么用?C# RectangleF.ToSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RectangleF
的用法示例。
在下文中一共展示了RectangleF.ToSD方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public object Create (RectangleF rectangle, Color startColor, Color endColor, float angle)
{
var brush = new sd2.LinearGradientBrush (rectangle.ToSD (), startColor.ToSD (), endColor.ToSD (), angle, true);
return new BrushObject {
Brush = brush,
InitialMatrix = brush.Transform
};
}
示例2: GetBrush
public sd2.PathGradientBrush GetBrush(RectangleF rect)
{
var scale = 1f;
var bounds = rect;
if (Matrix != null)
{
bounds = Matrix.Inverse().TransformRectangle(bounds);
}
scale = GradientHelper.GetRadialScale(Center, Radius, GradientOrigin, bounds);
if (brush == null || lastScale != scale)
{
lastScale = scale;
var scaledRect = new RectangleF(GradientOrigin - (GradientOrigin - Center + Radius) * scale, GradientOrigin + (Center + Radius - GradientOrigin) * scale);
var path = new sd2.GraphicsPath();
path.AddEllipse(scaledRect.ToSD());
brush = new sd2.PathGradientBrush(path);
brush.CenterColor = StartColor.ToSD();
brush.CenterPoint = GradientOrigin.ToSD();
brush.WrapMode = wrapMode.ToSD();
brush.SurroundColors = new[] { EndColor.ToSD() };
if (Matrix != null)
brush.MultiplyTransform(Matrix.ToSD());
if (scale > 1f)
{
var paths = GradientHelper.GetGradientStops(StartColor.ToSD(), EndColor.ToSD(), scale, wrapMode);
brush.InterpolationColors = new sd2.ColorBlend
{
Positions = paths.Reverse().Select(r => 1f - r.Item1).ToArray(),
Colors = paths.Reverse().Select(r => r.Item2).ToArray()
};
}
}
return brush;
}
示例3: SetClip
public void SetClip(RectangleF rectangle)
{
ResetClip();
clipBounds = rectangle.ToSD();
ReplayClip();
}