本文整理匯總了C#中MonoMac.CoreGraphics.CGContext.Clip方法的典型用法代碼示例。如果您正苦於以下問題:C# CGContext.Clip方法的具體用法?C# CGContext.Clip怎麽用?C# CGContext.Clip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MonoMac.CoreGraphics.CGContext
的用法示例。
在下文中一共展示了CGContext.Clip方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FillRect
public static void FillRect(CGContext context, RectangleF rect, CGColor color)
{
context.SaveState();
context.AddRect(rect);
context.Clip();
context.SetFillColor(color);
context.FillRect(rect);
context.RestoreState();
}
示例2: DrawRect
public static void DrawRect(CGContext context, RectangleF rect, CGColor color, float lineWidth)
{
context.SaveState();
context.AddRect(rect);
context.Clip();
context.SetLineWidth(lineWidth);
context.SetStrokeColor(color);
context.StrokeRect(rect);
context.RestoreState();
}
示例3: Draw
internal static void Draw (CGContext ctx, GradientInfo gradient)
{
ctx.SaveState ();
ctx.Clip ();
using (var cg = new CGGradient (Util.DeviceRGBColorSpace, gradient.Colors.ToArray (), gradient.Stops.ToArray ())) {
if (gradient.Linear)
ctx.DrawLinearGradient (cg, gradient.Start, gradient.End, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation);
else
ctx.DrawRadialGradient (cg, gradient.Start, gradient.StartRadius, gradient.End, gradient.EndRadius, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation);
}
ctx.RestoreState ();
}
示例4: FillGradient
public static void FillGradient(CGContext context, RectangleF rect, CGColor color1, CGColor color2, bool isHorizontal)
{
CGGradient gradientBackground;
CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB();
float[] locationListBackground = new float[] { 1.0f, 0.0f };
List<float> colorListBackground = new List<float>();
colorListBackground.AddRange(color1.Components);
colorListBackground.AddRange(color2.Components);
gradientBackground = new CGGradient(colorSpace, colorListBackground.ToArray(), locationListBackground);
context.SaveState();
context.AddRect(rect);
context.Clip();
//context.ScaleCTM(1, -1);
if(isHorizontal)
context.DrawLinearGradient(gradientBackground, new PointF(rect.X, rect.Y), new PointF(rect.X + rect.Width, rect.Y + rect.Height), CGGradientDrawingOptions.DrawsBeforeStartLocation);
else
context.DrawLinearGradient(gradientBackground, new PointF(0, 0), new PointF(0, rect.Height), CGGradientDrawingOptions.DrawsBeforeStartLocation);
context.RestoreState();
}
示例5: ApplyClippingPath
internal static void ApplyClippingPath(this CGPath path, CGContext ctx)
{
ctx.AddPath(path);
ctx.Clip();
}