本文整理汇总了C#中CGContext.GetClipBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.GetClipBoundingBox方法的具体用法?C# CGContext.GetClipBoundingBox怎么用?C# CGContext.GetClipBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGContext
的用法示例。
在下文中一共展示了CGContext.GetClipBoundingBox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLayer
public override void DrawLayer(CALayer layer, CGContext context)
{
context.SaveState ();
context.SetFillColor (1.0f, 1.0f, 1.0f, 1.0f);
context.FillRect (context.GetClipBoundingBox ());
context.TranslateCTM (0.0f, layer.Bounds.Size.Height);
context.ScaleCTM (1.0f, -1.0f);
context.ConcatCTM (this.oParentController.currentPDFPage.GetDrawingTransform (CGPDFBox.Crop, layer.Bounds, 0, true));
context.DrawPDFPage (this.oParentController.currentPDFPage);
context.RestoreState ();
}
示例2: 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 ());
}
示例3: InitializeContext
private void InitializeContext(CGContext context)
{
this.context = context;
modelMatrix = new Matrix();
viewMatrix = new Matrix();
ResetTransform();
boundingBox = context.GetClipBoundingBox().ToRectangleF ();
// We are going to try this here and it may cause problems down the road.
// This seems to only happen with Mac and not iOS
// What is happening is that sub views are offset by their relative location
// within the window. That means our drawing locations are also offset by this
// value as well. So what we need to do is translate our view by this offset as well.
subviewClipOffset = context.GetClipBoundingBox().ToRectangleF ();
PageUnit = GraphicsUnit.Pixel;
PageScale = 1;
// Set anti-aliasing
SmoothingMode = SmoothingMode.Default;
clipRegion = new Region ();
}