当前位置: 首页>>代码示例>>C#>>正文


C# NGraphics.Size类代码示例

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


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


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