public override void Draw(CGRect bounds, CoreGraphics.CGContext context, UIView view) { if (AutoLoadOnVisible) { LoadMore(); } }
public override void Draw(PdfDisplayBox box, CoreGraphics.CGContext context) { // Draw original content base.Draw(box, context); using (context) { // Draw watermark underlay UIGraphics.PushContext(context); context.SaveState(); var pageBounds = this.GetBoundsForBox(box); context.TranslateCTM(0.0f, pageBounds.Size.Height); context.ScaleCTM(1.0f, -1.0f); context.RotateCTM((float)(Math.PI / 4.0f)); Console.WriteLine($"{pageBounds}"); var attributes = new UIStringAttributes() { ForegroundColor = UIColor.FromRGBA(255, 0, 0, 125), Font = UIFont.BoldSystemFontOfSize(84) }; var text = new NSAttributedString("WATERMARK", attributes); text.DrawString(new CGPoint(250, 40)); context.RestoreState(); UIGraphics.PopContext(); } }
public override void DrawInContext(CoreGraphics.CGContext ctx) { base.DrawInContext(ctx); var knobFrame = CGRect.Inflate(PaintFrame, -2.0f, -2.0f); UIBezierPath knobPath = UIBezierPath.FromRoundedRect((CGRect)knobFrame, (nfloat)knobFrame.Height * Slider.Curvaceousness / 2.0f); // 1) fill - with a subtle shadow ctx.SetShadow(new CGSize(0, 1), 1.0f, UIColor.Gray.CGColor); ctx.SetFillColor(Slider.KnobColor.CGColor); ctx.AddPath(knobPath.CGPath); ctx.FillPath(); // 2) outline ctx.SetStrokeColor(UIColor.Gray.CGColor); ctx.SetLineWidth((nfloat)0.5f); ctx.AddPath(knobPath.CGPath); ctx.StrokePath(); // 3) inner gradient var rect = CGRect.Inflate(knobFrame, -2.0f, -2.0f); var clipPath = UIBezierPath.FromRoundedRect((CGRect)rect, (nfloat)rect.Height * Slider.Curvaceousness / 2.0f); CGGradient myGradient; CGColorSpace myColorspace; nfloat[] locations = { 0.0f, 1.0f }; nfloat[] components = { 0.0f, 0.0f, 0.0f, 0.15f, // Start color 0.0f, 0.0f, 0.0f, 0.05f }; // End color myColorspace = CGColorSpace.CreateDeviceRGB(); // CGColorSpaceCreateDeviceRGB(); myGradient = new CGGradient(myColorspace, components, locations); CGPoint startPoint = new CGPoint((float)rect.GetMidX(), (float)rect.GetMinY()); CGPoint endPoint = new CGPoint((float)rect.GetMidX(), (float)rect.GetMaxY()); ctx.SaveState(); ctx.AddPath(clipPath.CGPath); ctx.Clip(); ctx.DrawLinearGradient((CGGradient)myGradient, (CGPoint)startPoint, (CGPoint)endPoint, (CGGradientDrawingOptions)0); myGradient.Dispose(); myColorspace.Dispose(); ctx.RestoreState(); // 4) highlight if (Highlighted) { // fill ctx.SetFillColor(UIColor.FromWhiteAlpha((nfloat)0.0f, (nfloat)0.1f).CGColor); ctx.AddPath(knobPath.CGPath); ctx.FillPath(); } }
public override void DrawInContext(CoreGraphics.CGContext ctx) { CGRect rect = this.BoundsRect(); CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB(); nfloat [] colors = new nfloat[] { 0.42f, 0.66f, 0.31f, 1.0f, 0.95f, 0.76f, 0.20f, 1.0f, 0.80f, 0.25f, 0.15f, 1.0f }; CGGradient gradient = new CGGradient(colorSpace, colors, null); nuint tickSpaces = this.Axis.MajorTickCount - 1; nuint pointsCount = 5; if (this.Chart.Frame.Size.Height < this.Chart.Frame.Size.Width) { pointsCount = 3; } nfloat diameter = 8; nfloat spaceHeight = rect.Size.Height / tickSpaces; nfloat spacing = (spaceHeight - (pointsCount * diameter)) / (pointsCount + 1); nuint allPointsCount = pointsCount * tickSpaces; CGPath multipleCirclePath = new CGPath(); double y = rect.GetMinY() + diameter / 2.0f + spacing; for (uint i = 1; i <= allPointsCount; i++) { CGPoint center = new CGPoint(rect.GetMidX(), y); CGPath path = new CGPath(); path.AddArc(center.X, center.Y, (nfloat)diameter / 2.0f, 0, (nfloat)Math.PI * 2, true); multipleCirclePath.AddPath(path); y += spacing + diameter; if (i % pointsCount == 0) { y += spacing; } } ctx.SaveState(); ctx.AddPath(multipleCirclePath); ctx.Clip(); CGPoint startPoint = new CGPoint(rect.GetMidX(), rect.GetMinY()); CGPoint endPoint = new CGPoint(rect.GetMidX(), rect.GetMaxY()); ctx.DrawLinearGradient(gradient, startPoint, endPoint, 0); ctx.RestoreState(); base.DrawInContext(ctx); }
public override void Draw(CGRect bounds, CoreGraphics.CGContext context, UIView view) { view.BackgroundColor = UIColor.White; CaptionColor.SetColor(); var width = bounds.Width - PaddingX * 2; var textHeight = Caption.MonoStringHeight(CaptionFont, width); Caption.DrawString(new CGRect(PaddingX, PaddingY, width, bounds.Height - PaddingY * 2), CaptionFont, UILineBreakMode.WordWrap); if (Value != null) { ValueColor.SetColor(); var valueOrigin = new CGPoint(PaddingX, PaddingY + textHeight + 8f); var valueSize = new CGSize(width, bounds.Height - valueOrigin.Y); Value.DrawString(new CGRect(valueOrigin, valueSize), ValueFont, UILineBreakMode.WordWrap); } }
public Graphics(CoreGraphics.CGContext context, float width, float height) { this.context = context; this.colorspace = CGColorSpace.CreateDeviceRGB(); }
public void DrawLine(RGPen p, Point startPoint, Point endPoint) { this.DrawLine(p, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); }
public void DrawEllipse(RGPen pen, Rectangle rectangle) { throw new NotImplementedException(); }
public void FillRectangle(RGBrush b, RGFloat x, RGFloat y, RGFloat width, RGFloat height) { throw new NotImplementedException(); }
public void FillEllipse(RGBrush b, RGFloat x, RGFloat y, RGFloat widht, RGFloat height) { throw new NotImplementedException(); }
public void FillEllipse(RGBrush b, Rectangle rectangle) { throw new NotImplementedException(); }
public void DrawRectangle(RGPen p, RGFloat x, RGFloat y, RGFloat width, RGFloat height) { throw new NotImplementedException(); }
public void DrawRectangle(RGPen p, Rectangle rect) { throw new NotImplementedException(); }
public void DrawLine(RGPen p, RGFloat x1, RGFloat y1, RGFloat x2, RGFloat y2) { }
public static CGLayer Create(CGContext context, CGSize size) { // note: auxiliaryInfo is reserved and should be null return(new CGLayer(CGLayerCreateWithContext(context == null ? IntPtr.Zero : context.Handle, size, IntPtr.Zero), true)); }