Пример #1
0
//		RectangleF _viewBox;

		public WmfGraphics (BinaryWriter tw, RectangleF viewBox)
		{
//			_viewBox = viewBox;
			fw = tw;
			_fontMetrics = new WmfGraphicsFontMetrics ();
			SetColor (Colors.Black);			
			_states.Push (_state);
		}
Пример #2
0
		public SvgGraphics (TextWriter tw, RectangleF viewBox)
		{
			_viewBox = viewBox;
			_tw = tw;
			IncludeXmlAndDoctype = true;
			SetColor (Colors.Black);			
			_states.Push (_state);
		}
Пример #3
0
		public static RectangleF Union (RectangleF a, RectangleF b)
		{
			var left = Math.Min (a.Left, b.Left);
			var top = Math.Min (a.Top, b.Top);
			return new RectangleF (left,
				top,
				Math.Max (a.Right, b.Right) - left,
				Math.Max (a.Bottom, b.Bottom) - top);
		}
Пример #4
0
		void Initialize ()
		{
			var bounds = Bounds;

			visibleArea = bounds.ToRectangleF ();

			canvas = new Canvas (bounds.ToRectangleF ()) {
				AutoresizingMask = UIViewAutoresizing.FlexibleDimensions,
			};

			BackgroundColor = Colors.White;

			scrollContent = new Canvas (new RectangleF (PointF.Empty, contentSize)) {
				Opaque = false,
				BackgroundColor = UIColor.Clear.GetColor (),
			};
			scrollContent.TouchBegan += HandleTouchBegan;
			scrollContent.TouchMoved += HandleTouchMoved;
			scrollContent.TouchEnded += HandleTouchEnded;
			scrollContent.TouchCancelled += HandleTouchCancelled;

			scroll = new Scroller (bounds) {
				AutoresizingMask = UIViewAutoresizing.FlexibleDimensions,
				MinimumZoomScale = 1/4.0f,
				MaximumZoomScale = 4.0f,
				AlwaysBounceVertical = true,
				AlwaysBounceHorizontal = true,
				BackgroundColor = UIColor.Clear,
			};

			scroll.AddSubview (scrollContent);
			scroll.ContentSize = contentSize.ToSizeF ();

			TouchEnabled = true;
			TouchDelayed = true;

			scroll.ViewForZoomingInScrollView = delegate {
				return scrollContent;
			};
			scroll.ZoomingEnded += delegate {
			};
			scroll.Scrolled += HandleScrolled;

			AddSubviews (canvas, scroll);

			//
			// Prime the visible area
			//
			HandleScrolled (scroll, EventArgs.Empty);

			//
			// Ready to Draw
			//
			SetVisibleArea ();
			canvas.Drawing += HandleDrawing;
		}
Пример #5
0
		public CanvasDrawingEventArgs (IGraphics graphics, RectangleF visibleArea)
		{
			Graphics = graphics;
			VisibleArea = visibleArea;
		}
Пример #6
0
		public static void DrawOval(this IGraphics g, RectangleF r, float w)
		{
			g.DrawOval (r.Left, r.Top, r.Width, r.Height, w);
		}
Пример #7
0
		public static List<RectangleF> GetIntersections (this List<RectangleF> boxes, RectangleF box)
		{
			var r = new List<RectangleF> ();
			foreach (var b in boxes) {
				if (b.IntersectsWith (box)) {
					r.Add (b);
				}
			}
			return r;
		}
Пример #8
0
		public static void FillRoundedRect(this IGraphics g, RectangleF r, float radius)
		{
			g.FillRoundedRect (r.Left, r.Top, r.Width, r.Height, radius);
		}
Пример #9
0
		public static void FillOval(this IGraphics g, RectangleF r)
		{
			g.FillOval (r.Left, r.Top, r.Width, r.Height);
		}
Пример #10
0
		public View (RectangleF frame)
			: base (frame.ToRectangleF ())
		{
		}
Пример #11
0
		public static void DrawRoundedRect(this IGraphics g, RectangleF r, float radius, float w)
		{
			g.DrawRoundedRect (r.Left, r.Top, r.Width, r.Height, radius, w);
		}
Пример #12
0
		public void Invalidate (RectangleF frame)
		{
			SetNeedsDisplayInRect (frame.ToRectangleF ());
		}
Пример #13
0
		public bool IntersectsWith(RectangleF rect)
		{
			return !((Left >= rect.Right) || (Right <= rect.Left) ||
			         (Top >= rect.Bottom) || (Bottom <= rect.Top));
		}
Пример #14
0
		public ScrollableCanvas (RectangleF frame)
			: base (frame)
		{
			Initialize ();
		}
Пример #15
0
		public void Invalidate (RectangleF frame)
		{
			canvas.Invalidate ();
		}
Пример #16
0
		public void SetVisibleArea ()
		{
			var s = (float)scroll.ZoomScale;

			var va = scroll.Bounds.ToRectangleF ();
			va.X /= s;
			va.Y /= s;
			va.Width /= s;
			va.Height /= s;

			visibleArea = va;

			canvas.Invalidate ();
		}
Пример #17
0
        public WmfGraphics (Stream s, RectangleF viewBox) 
			: this(new BinaryWriter (s, System.Text.Encoding.UTF8), viewBox)
		{
		}
Пример #18
0
		public Canvas (RectangleF frame)
			: base (frame)
		{
			Initialize ();
		}
Пример #19
0
		public static void AddBottomRoundedRect (this CGContext c, RectangleF b, float r)
		{
			c.MoveTo (b.Left, b.Top + r);
			c.AddLineToPoint (b.Left, b.Bottom - r);
			
			c.AddArc (b.Left + r, b.Bottom - r, r, (float)(Math.PI), (float)(Math.PI / 2), true);
			
			c.AddLineToPoint (b.Right - r, b.Bottom);
			
			c.AddArc (b.Right - r, b.Bottom - r, r, (float)(-3 * Math.PI / 2), (float)(0), true);
			
			c.AddLineToPoint (b.Right, b.Top);
			
			c.AddLineToPoint (b.Left, b.Top);
		}
Пример #20
0
		public void Invalidate (RectangleF dirtyRect)
		{
			Invalidate (dirtyRect.ToRect ());
		}
Пример #21
0
		public static void DrawString(this IGraphics g, string s, RectangleF p, Font f, LineBreakMode lineBreak, TextAlignment align)
		{
			g.SetFont (f);
			g.DrawString (s, p.Left, p.Top, p.Width, p.Height, lineBreak, align);
		}
Пример #22
0
		string AddGradient (Gradient g, RectangleF bounds)
		{
			var url = "url(#grad" + grads.Count + ")";
			grads.Add (new GradientAndBounds { Gradient = g, Bounds = bounds });
			return url;
		}