本文整理汇总了C#中CGContext.SetBlendMode方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.SetBlendMode方法的具体用法?C# CGContext.SetBlendMode怎么用?C# CGContext.SetBlendMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGContext
的用法示例。
在下文中一共展示了CGContext.SetBlendMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawInContext
public override void DrawInContext(CGContext context)
{
// Start with a background whose color we don't use in the demo
context.SetGrayFillColor (0.2f, 1);
context.FillRect (Bounds);
// We want to just lay down the background without any blending so we use the Copy mode rather than Normal
context.SetBlendMode(CGBlendMode.Copy);
// Draw a rect with the "background" color - this is the "Destination" for the blending formulas
context.SetFillColorWithColor (DestinationColor.CGColor);
context.FillRect(new RectangleF (110, 20, 100, 100));
// Set up our blend mode
context.SetBlendMode (BlendMode);
// And draw a rect with the "foreground" color - this is the "Source" for the blending formulas
context.SetFillColorWithColor (SourceColor.CGColor);
context.FillRect (new RectangleF (60, 45, 200, 50));
}
示例2: DrawContentView
public void DrawContentView(RectangleF rect, CGContext context, UITableViewElementCell cell)
{
context.SaveState();
var backgroundColor = CellBackgroundColor;
if (backgroundColor != null)
{
if (backgroundColor == UIColor.Clear)
backgroundColor = UIColor.White;
context.SetFillColorWithColor(backgroundColor.ColorWithAlpha(0.4f).CGColor);
context.SetBlendMode(CGBlendMode.Overlay);
context.FillRect(rect);
}
context.RestoreState();
}
示例3: DrawPoints
//does the actual coloring
void DrawPoints(CGContext dctx)
{
var swatches = Swatches;
var swatchslider = swatchSlider;
dctx.BeginPath ();
dctx.MoveTo (Points.First().X, Points.First().Y);
dctx.SetLineWidth (swatchslider.Value);
dctx.SetBlendMode (CGBlendMode.Normal);
foreach (var crayon in Crayons) {
if(crayon.Selected) {
if (crayon.Name == "Eraser") {
dctx.SetBlendMode (CGBlendMode.Clear);
dctx.SetStrokeColor (UIColor.Clear.CGColor);
} else {
dctx.SetBlendMode (CGBlendMode.Normal);
var swatchImg = colorSwatch (swatches[0], crayon.R / 255f, crayon.G / 255f, crayon.B / 255f, 1f);
UIColor pattern = UIColor.FromPatternImage(swatchImg);
dctx.SetStrokeColor(pattern.CGColor);
}
dctx.SetLineCap (CGLineCap.Round);
dctx.SetLineJoin (CGLineJoin.Round);
}
}
//set fill color with current crayons
foreach (var point in Points) {
dctx.AddLineToPoint(point.X, point.Y);
}
dctx.StrokePath();
}