• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NGraphics.Size类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NGraphics.Size的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Size类属于NGraphics命名空间,在下文中一共展示了Size类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ArcTo

 public ArcTo(Size radius, bool largeArc, bool sweepClockwise, Point point)
 {
     Radius = radius;
     LargeArc = largeArc;
     SweepClockwise = sweepClockwise;
     Point = point;
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:7,代码来源:Path.cs


示例2: RadialGradientBrush

		public RadialGradientBrush (Point relCenter, Size relRadius, params GradientStop[] stops)
		{
			Center = relCenter;
			Focus = relCenter;
			Radius = relRadius;
			Stops.AddRange (stops);
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:7,代码来源:Brush.cs


示例3: WICBitmapCanvas

		public WICBitmapCanvas (Size size, double scale = 1.0, bool transparency = true, Direct2DFactories factories = null)
			: this (
				// DIPs = pixels / (DPI/96.0)
				new WIC.Bitmap ((factories ?? Direct2DFactories.Shared).WICFactory, (int)(Math.Ceiling (size.Width * scale)), (int)(Math.Ceiling (size.Height * scale)), transparency ? WIC.PixelFormat.Format32bppPBGRA : WIC.PixelFormat.Format32bppBGR, WIC.BitmapCreateCacheOption.CacheOnLoad),
				new D2D1.RenderTargetProperties (D2D1.RenderTargetType.Default, new D2D1.PixelFormat (DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(96.0 * scale), (float)(96.0 * scale), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT))
		{
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:7,代码来源:Direct2DCanvas.cs


示例4: ScaleDownProportional

 public static Size ScaleDownProportional (this Size size, Size max)
 {
     if (size.Width <= max.Width && size.Height <= max.Height) {
         return size;
     }
     return size.ScaleProportional (max);
 }
开发者ID:patridge,项目名称:TwinTechsFormsLib,代码行数:7,代码来源:SizeExtensions.cs


示例5: Scale

		public static void Scale (this ICanvas canvas, Size scale, Point point)
		{
			if (scale.Width != 1 || scale.Height != 1) {
				canvas.Translate (point);
				canvas.Scale (scale);
				canvas.Translate (-point);
			}
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:8,代码来源:ICanvas.cs


示例6: Drawing

 public Drawing(Size size, DrawingFunc func)
 {
     if (func == null) {
         throw new ArgumentNullException ("func");
     }
     this.size = size;
     this.func = func;
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:8,代码来源:Drawing.cs


示例7: Drawing

		public Drawing (Size size, DrawingFunc func, IPlatform textPlatform)
		{
			if (func == null) {
				throw new ArgumentNullException ("func");
			}
			this.size = size;
			this.func = func;
			this.textPlatform = textPlatform ?? new NullPlatform ();
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:9,代码来源:Drawing.cs


示例8: ScaleProportional

        public static Size ScaleProportional (this Size size, Size max)
        {
            double fitScale = size.ScaleThatFits (max);
            if (fitScale == 1) {
                return size;
            }

            Size scaledSize = new Size (size.Width * fitScale, size.Height * fitScale);
            return scaledSize;
        }
开发者ID:patridge,项目名称:TwinTechsFormsLib,代码行数:10,代码来源:SizeExtensions.cs


示例9: CreateImageCanvas

 public IImageCanvas CreateImageCanvas(Size size, double scale = 1.0, bool transparency = true)
 {
     var pixelWidth = (int)Math.Ceiling (size.Width * scale);
     var pixelHeight = (int)Math.Ceiling (size.Height * scale);
     var bitmap = Bitmap.CreateBitmap (pixelWidth, pixelHeight, Bitmap.Config.Argb8888);
     if (!transparency) {
         bitmap.EraseColor (Colors.Black.Argb);
     }
     return new BitmapCanvas (bitmap, scale);
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:10,代码来源:AndroidPlatform.cs


示例10: CreateImageCanvas

 public IImageCanvas CreateImageCanvas(Size size, double scale = 1.0, bool transparency = true)
 {
     var pixelWidth = (int)Math.Ceiling (size.Width * scale);
     var pixelHeight = (int)Math.Ceiling (size.Height * scale);
     var bitmapInfo = transparency ? CGImageAlphaInfo.PremultipliedFirst : CGImageAlphaInfo.NoneSkipFirst;
     var bitsPerComp = 8;
     var bytesPerRow = transparency ? 4 * pixelWidth : 4 * pixelWidth;
     var colorSpace = CGColorSpace.CreateDeviceRGB ();
     var bitmap = new CGBitmapContext (IntPtr.Zero, pixelWidth, pixelHeight, bitsPerComp, bytesPerRow, colorSpace, bitmapInfo);
     return new CGBitmapContextCanvas (bitmap, scale);
 }
开发者ID:nakijun,项目名称:NGraphics,代码行数:11,代码来源:ApplePlatform.cs


示例11: ScaleThatFits

        public static double ScaleThatFits (this Size size, Size max)
        {
            if (size == max || max.Width == 0 || max.Height == 0 || size.Width == 0 || size.Height == 0) {
                return 1;
            }

            double widthScale = max.Width / size.Width;
            double heightScale = max.Height / size.Height;
            double fitScale = (double)Math.Min (widthScale, heightScale);
            return fitScale;
        }
开发者ID:patridge,项目名称:TwinTechsFormsLib,代码行数:11,代码来源:SizeExtensions.cs


示例12: CreateImage

 public static IImage CreateImage(this IPlatform platform, Func<int, int, Color> colorFunc, Size size, double scale = 1.0)
 {
     var w = (int)Math.Ceiling (size.Width);
     var h = (int)Math.Ceiling (size.Height);
     var colors = new Color[w * h];
     for (var y = 0; y < h; y++) {
         var o = y * w;
         for (var x = 0; x < w; x++) {
             colors [o + x] = colorFunc (x, y);
         }
     }
     return platform.CreateImage (colors, w, scale);
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:13,代码来源:IPlatform.cs


示例13: Draw

		public override void Draw (CGRect rect)
		{
			base.Draw (rect);

			if (_formsControl != null) {
				using (CGContext context = UIGraphics.GetCurrentContext ()) {
					context.SetAllowsAntialiasing (true);
					context.SetShouldAntialias (true);
					context.SetShouldSmoothFonts (true);

					var outputSize = new Size (rect.Width, rect.Height);
					var finalCanvas = _formsControl.RenderSvgToCanvas (outputSize, ScreenScale, CreatePlatformImageCanvas);
					var image = finalCanvas.GetImage ();
					var uiImage = image.GetUIImage ();
					Control.Image = uiImage;
				}
			}
		}
开发者ID:patridge,项目名称:TwinTechsFormsLib,代码行数:18,代码来源:SvgImageRenderer.cs


示例14: Read

		void Read (XDocument doc)
		{
			var svg = doc.Root;
			var ns = svg.Name.Namespace;

			//
			// Find the defs (gradients)
			//
			foreach (var d in svg.Descendants ()) {
				var idA = d.Attribute ("id");
				if (idA != null) {
					defs [ReadString (idA).Trim ()] = d;
				}
			}

			//
			// Get the dimensions
			//
			var widthA = svg.Attribute ("width");
			var heightA = svg.Attribute ("height");
			var width = ReadNumber (widthA);
			var height = ReadNumber (heightA);
			var size = new Size (width, height);

			var viewBox = new Rect (size);
			var viewBoxA = svg.Attribute ("viewBox") ?? svg.Attribute ("viewPort");
			if (viewBoxA != null) {
				viewBox = ReadRectangle (viewBoxA.Value);
			}

			if (widthA != null && widthA.Value.Contains ("%")) {
				size.Width *= viewBox.Width;
			}
			if (heightA != null && heightA.Value.Contains ("%")) {
				size.Height *= viewBox.Height;
			}

			//
			// Add the elements
			//
			Graphic = new Graphic (size, viewBox);

			AddElements (Graphic.Children, svg.Elements (), null, Brushes.Black);
		}
开发者ID:superlloyd,项目名称:NGraphics,代码行数:44,代码来源:SvgReader.cs


示例15: ForeignObject

		public ForeignObject (Point pos, Size size) : base(null, null)
		{
			this.pos = pos;
			this.size = size;
		}
开发者ID:nakijun,项目名称:NGraphics,代码行数:5,代码来源:ForeignObject.cs


示例16: CreateImageCanvas

 public IImageCanvas CreateImageCanvas(Size size, double scale = 1.0, bool transparency = true)
 {
     return new NullImageSurface ();
 }
开发者ID:xamarin-libraries,项目名称:xamarin-libraries,代码行数:4,代码来源:NullPlatform.cs


示例17: ReadPath

        void ReadPath(Path p, string pathDescriptor)
        {
            var args = pathDescriptor.Split (WSC, StringSplitOptions.RemoveEmptyEntries);

            var i = 0;
            var n = args.Length;

            while (i < n) {
                var a = args[i];
                //
                // Get the operation
                //
                var op = "";
                if (a.Length == 1) {
                    op = a;
                    i++;
                } else {
                    op = a.Substring (0, 1);
                    args [i] = a.Substring (1);
                }

                //
                // Execute
                //
                if (op == "M" && i + 1 < n) {
                    p.MoveTo (new Point (ReadNumber (args [i]), ReadNumber (args [i + 1])));
                    i += 2;
                } else if (op == "L" && i + 1 < n) {
                    p.LineTo (new Point (ReadNumber (args [i]), ReadNumber (args [i + 1])));
                    i += 2;
                } else if (op == "C" && i + 5 < n) {
                    var c1 = new Point (ReadNumber (args [i]), ReadNumber (args [i + 1]));
                    var c2 = new Point (ReadNumber (args [i + 2]), ReadNumber (args [i + 3]));
                    var pt = new Point (ReadNumber (args [i + 4]), ReadNumber (args [i + 5]));
                    p.CurveTo (c1, c2, pt);
                    i += 6;
                } else if (op == "S" && i + 3 < n) {
                    var c  = new Point (ReadNumber (args [i]), ReadNumber (args [i + 1]));
                    var pt = new Point (ReadNumber (args [i + 2]), ReadNumber (args [i + 3]));
                    p.ContinueCurveTo (c, pt);
                    i += 4;
                } else if (op == "A" && i + 6 < n) {
                    var r = new Size (ReadNumber (args [i]), ReadNumber (args [i + 1]));
            //					var xr = ReadNumber (args [i + 2]);
                    var laf = ReadNumber (args [i + 3]) != 0;
                    var swf = ReadNumber (args [i + 4]) != 0;
                    var pt = new Point (ReadNumber (args [i + 5]), ReadNumber (args [i + 6]));
                    p.ArcTo (r, laf, swf, pt);
                    i += 7;
                } else if (op == "z" || op == "Z") {
                    p.Close ();
                } else {
                    throw new NotSupportedException ("Path Operation " + op);
                }
            }
        }
开发者ID:xamarin-libraries,项目名称:xamarin-libraries,代码行数:56,代码来源:SvgReader.cs


示例18: DrawImage

 public void DrawImage(IImage image, Rect frame, double alpha = 1.0)
 {
     var ii = image as BitmapImage;
     if (ii != null) {
         var paint = GetImagePaint (alpha);
         var isize = new Size (ii.Bitmap.Width, ii.Bitmap.Height);
         var scale = frame.Size / isize;
         var m = new Matrix ();
         m.PreTranslate ((float)frame.X, (float)frame.Y);
         m.PreScale ((float)scale.Width, (float)scale.Height);
         graphics.DrawBitmap (ii.Bitmap, m, paint);
     }
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:13,代码来源:AndroidPlatform.cs


示例19: RenderSvgToCanvas

		public IImageCanvas RenderSvgToCanvas (Size outputSize, double finalScale, Func<Size, double, IImageCanvas> createPlatformImageCanvas)
		{
			var originalSvgSize = LoadedGraphic.Size;
			var finalCanvas = createPlatformImageCanvas (outputSize, finalScale);

			if (SvgStretchableInsets != ResizableSvgInsets.Zero) {
				// Doing a stretchy 9-slice manipulation on the original SVG.
				// Partition into 9 segments, based on _formsControl.Svg9SliceInsets, storing both original and scaled sizes.
				var sliceInsets = SvgStretchableInsets;
				var sliceFramePairs = new[] {
					ResizableSvgSection.TopLeft,
					ResizableSvgSection.TopCenter,
					ResizableSvgSection.TopRight,
					ResizableSvgSection.CenterLeft,
					ResizableSvgSection.CenterCenter,
					ResizableSvgSection.CenterRight,
					ResizableSvgSection.BottomLeft,
					ResizableSvgSection.BottomCenter,
					ResizableSvgSection.BottomRight,
				}.Select (section => {
					return Tuple.Create (
						sliceInsets.GetSection (originalSvgSize, section),
						sliceInsets.ScaleSection (outputSize, section));
				}).ToArray ();

				foreach (var sliceFramePair in sliceFramePairs) {
					var sliceImage = RenderSectionToImage (LoadedGraphic, sliceFramePair.Item1, sliceFramePair.Item2, finalScale, createPlatformImageCanvas);
					finalCanvas.DrawImage (sliceImage, sliceFramePair.Item2);
				}
			} else {
				// Typical approach to rendering an SVG; just draw it to the canvas.
				double proportionalOutputScale = originalSvgSize.ScaleThatFits (outputSize);
				// Make sure ViewBox is reset to a proportionally-scaled default in case it was previous set by slicing.
				LoadedGraphic.ViewBox = new Rect (Point.Zero, originalSvgSize / proportionalOutputScale);
				LoadedGraphic.Draw (finalCanvas);
			}
			return finalCanvas;
		}
开发者ID:patridge,项目名称:TwinTechsFormsLib,代码行数:38,代码来源:SvgImageView.cs


示例20: CreateImageCanvas

 /// <summary>
 /// Creates an object implementing the IImageCanvas interface
 /// </summary>
 /// <param name="size"></param>
 /// <param name="scale"></param>
 /// <param name="transparency"></param>
 /// <returns></returns>
 public IImageCanvas CreateImageCanvas(Size size, double scale = 1.0, bool transparency = true)
 {
     throw new NotImplementedException();
 }
开发者ID:rmawani,项目名称:NControl,代码行数:11,代码来源:PhoneSilverlightPlatform.cs



注:本文中的NGraphics.Size类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cache.CacheKey类代码示例发布时间:2022-05-26
下一篇:
C# NGraphics.Rect类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap