本文整理汇总了C#中CGContext.DrawTiledImage方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.DrawTiledImage方法的具体用法?C# CGContext.DrawTiledImage怎么用?C# CGContext.DrawTiledImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGContext
的用法示例。
在下文中一共展示了CGContext.DrawTiledImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawInContext
public override void DrawInContext (CGContext context)
{
var imageRect = new RectangleF (8, 8, 64, 64);
// Note: The images are actually drawn upside down because Quartz image drawing expects
// the coordinate system to have the origin in the lower-left corner, but a UIView
// puts the origin in the upper-left corner. For the sake of brevity (and because
// it likely would go unnoticed for the image used) this is not addressed here.
// For the demonstration of PDF drawing however, it is addressed, as it would definately
// be noticed, and one method of addressing it is shown there.
// Draw the image in the upper left corner (0,0) with size 64x64
context.DrawImage (imageRect, image);
// Tile the same image across the bottom of the view
// CGContextDrawTiledImage() will fill the entire clipping area with the image, so to avoid
// filling the entire view, we'll clip the view to the rect below. This rect extends
// past the region of the view, but since the view's rectangle has already been applied as a clip
// to our drawing area, it will be intersected with this rect to form the final clipping area
context.ClipToRect(new RectangleF (0, 80, Bounds.Width, Bounds.Height));
// The origin of the image rect works similarly to the phase parameter for SetLineDash and
// SetPatternPhase and specifies where in the coordinate system the "first" image is drawn.
// The size (previously set to 64x64) specifies the size the image is scaled to before being tiled.
imageRect.X = 32;
imageRect.Y = 112;
context.DrawTiledImage (imageRect, image);
// Highlight the "first" image from the DrawTiledImage call.
context.SetRGBFillColor (1, 0, 0, 0.5f);
context.FillRect (imageRect);
// And stroke the clipped area
context.SetLineWidth (3);
context.SetRGBStrokeColor (1, 0, 0, 1);
context.StrokeRect (context.GetClipBoundingBox ());
}