Beispiel #1
0
 /// <summary>
 /// Draws the content of the view.
 /// </summary>
 /// <param name="rect">The rectangle to draw.</param>
 public override void Draw(System.Drawing.RectangleF rect)
 {
     if (this.model != null)
     {
         using (var renderer = new MonoTouchRenderContext(UIGraphics.GetCurrentContext()))
         {
             ((IPlotModel)this.model).Render(renderer, rect.Width, rect.Height);
         }
     }
 }
Beispiel #2
0
		public override void Draw (System.Drawing.RectangleF rect)
		{
			var plot = exampleInfo.PlotModel;

			plot.PlotMargins = new OxyThickness(5);
			plot.Background = OxyColors.LightGray;
			plot.Update(true);

			var context = UIGraphics.GetCurrentContext();

			var renderer = new MonoTouchRenderContext(context);
			plot.Render(renderer, rect.Width, rect.Height);
		}
Beispiel #3
0
        /// <summary>
        /// Draw the specified rect.
        /// </summary>
        /// <param name='rect'>
        /// Rect.
        /// </param>
        public override void Draw(System.Drawing.RectangleF rect)
        {
            plot.PlotMargins = new OxyThickness(10);
            plot.Background  = OxyColors.Transparent;
            plot.Update(true);

            RectangleF big_rect = rect;

            big_rect.Width  = rect.Width * UIScreen.MainScreen.Scale;
            big_rect.Height = rect.Height * UIScreen.MainScreen.Scale;
            big_rect.X      = rect.X;
            big_rect.Y      = rect.Y;

            SizeF new_image_size = new SizeF(big_rect.Width, big_rect.Height);

            UIGraphics.BeginImageContextWithOptions(new_image_size, false, 1);

            CGContext context = UIGraphics.GetCurrentContext();

            context.SaveState();

            context.InterpolationQuality = CGInterpolationQuality.High;

            MonoTouchRenderContext renderer = new MonoTouchRenderContext(context, big_rect);

            AdjustPlotChartMargins(plot, rect.Width * UIScreen.MainScreen.Scale, rect.Height * UIScreen.MainScreen.Scale);

            context.TranslateCTM(0.0f, big_rect.Height);
            context.ScaleCTM(1.0f, -1.0f);

            plot.Render(renderer);

            UIImage resulting_plot_image = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            CGContext original_context = UIGraphics.GetCurrentContext();

            original_context.InterpolationQuality = CGInterpolationQuality.High;
            original_context.DrawImage(rect, resulting_plot_image.CGImage);

            context.RestoreState();
        }