本文整理汇总了C#中MonoMac.CoreGraphics.CGContext.StrokeRect方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.StrokeRect方法的具体用法?C# CGContext.StrokeRect怎么用?C# CGContext.StrokeRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoMac.CoreGraphics.CGContext
的用法示例。
在下文中一共展示了CGContext.StrokeRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: HatchSphere
/**
* This is fill of hackish stuff.
* Thought this was going to be easier but that just did not work out.
**/
protected void HatchSphere(CGContext context)
{
var hatchSize = getHatchWidth (hatchStyle);
var lineWidth = getLineWidth (hatchStyle);
initializeContext(context, hatchSize, false);
/* draw background in fore ground color*/
drawBackground (context, backColor, hatchSize, hatchSize);
context.SetStrokeColor(foreColor.ToCGColor());
context.SetFillColor(foreColor.ToCGColor());
context.SetLineWidth(1);
context.SetLineCap(CGLineCap.Square);
// Initialize work rectangle
RectangleF rect = new RectangleF(0,0,1,1);
float quad = hatchSize / 2.0f;
// Left lower quad
rect.Width = quad;
rect.Height = quad;
rect.X = 0;
rect.Y = 0;
context.StrokeRect(rect);
// right upper quad
rect.Width = quad;
rect.Height = quad;
rect.X = quad;
rect.Y = quad;
context.StrokeRect(rect);
// left upper quad
rect.Width = quad;
rect.Height = quad;
rect.X = 0;
rect.Y = quad + 1;
context.FillRect(rect);
// right lower quod
rect.Width = quad;
rect.Height = quad;
rect.X = quad + 1;
rect.Y = 0;
context.FillRect(rect);
// Now we fill in some corner bits with background
// This is a bad hack but now sure what else to do
context.SetFillColor(backColor.ToCGColor());
rect.Height = 1;
rect.Width = 1;
rect.X = 0;
rect.Y = 0;
setPixels(context, rect);
rect.X = 0;
rect.Y = quad;
setPixels(context, rect);
rect.X = 0;
rect.Y = quad;
setPixels(context, rect);
rect.X = quad;
rect.Y = 0;
setPixels(context, rect);
rect.X = quad;
rect.Y = quad;
setPixels(context, rect);
rect.X = quad;
rect.Y = hatchSize;
setPixels(context, rect);
rect.X = hatchSize;
rect.Y = 0;
setPixels(context, rect);
rect.X = hatchSize;
rect.Y = quad;
setPixels(context, rect);
rect.X = hatchSize;
rect.Y = hatchSize;
setPixels(context, rect);
//.........这里部分代码省略.........
示例3: HatchHorizontalBrick
void HatchHorizontalBrick(CGContext context)
{
var hatchWidth = getHatchWidth (hatchStyle);
var hatchHeight = getHatchHeight (hatchStyle);
var lineWidth = getLineWidth (hatchStyle);
initializeContext(context, hatchHeight, false);
/* draw background */
drawBackground (context, backColor, hatchWidth, hatchHeight);
/* draw lines in the foreground color */
context.SetFillColor(foreColor.ToCGColor());
/* draw lines in the foreground color */
context.SetStrokeColor(foreColor.ToCGColor());
context.SetLineWidth(lineWidth);
context.SetLineCap(CGLineCap.Square);
RectangleF rect = new RectangleF(0,0,1,1);
rect.Y = 3;
rect.Width = hatchWidth;
rect.Height = hatchHeight - 4;
context.StrokeRect(rect);
context.MoveTo(hatchWidth / 2.0f, 0);
context.AddLineToPoint(hatchWidth / 2.0f,3);
context.StrokePath();
}