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


C# RectangleD.Grow方法代码示例

本文整理汇总了C#中RectangleD.Grow方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleD.Grow方法的具体用法?C# RectangleD.Grow怎么用?C# RectangleD.Grow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RectangleD的用法示例。


在下文中一共展示了RectangleD.Grow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

		internal Present Render(MapRectangle mapRect, System.Drawing.Size size, bool useDocumentTransparency, bool exactColors)
		{
			Monitor.Enter(this);
			Present result;
			try
			{
				RectangleD rectangleD = new RectangleD(mapRect.lon0 * (double)this.boundingBox.Width - 0.5, -mapRect.lat1 * (double)this.boundingBox.Height + (double)this.actualBoundingBox.Height - 0.5, (mapRect.lon1 - mapRect.lon0) * (double)this.boundingBox.Width + (double)this.hackRectangleAdjust, (mapRect.lat1 - mapRect.lat0) * (double)this.boundingBox.Height + (double)this.hackRectangleAdjust);
				RectangleD rectangleD2 = rectangleD.Grow(2.0);
				RectangleD r = new RectangleD((double)this.actualBoundingBox.X, (double)this.actualBoundingBox.Y, (double)this.actualBoundingBox.Width, (double)this.actualBoundingBox.Height);
				RectangleD dest = new RectangleD(0.0, 0.0, (double)size.Width, (double)size.Height);
				ScaleAndTranslate scaleAndTranslate = new ScaleAndTranslate(rectangleD, dest);
				RectangleD rectangleD3 = rectangleD2.Intersect(r).Round();
				RectangleD rectangleD4 = scaleAndTranslate.Apply(rectangleD.Intersect(r));
				RectangleD rectangleD5 = scaleAndTranslate.Apply(rectangleD3);
				ScaleAndTranslate scaleAndTranslate2 = new ScaleAndTranslate(-rectangleD5.X, -rectangleD5.Y);
				RectangleD rectangleD6 = scaleAndTranslate2.Apply(rectangleD4);
				GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(size, "WPFVerb");
				GDIBigLockedImage image = gDIBigLockedImage;
				if (!rectangleD3.IntIsEmpty() && !rectangleD6.IntIsEmpty())
				{
					try
					{
						GDIBigLockedImage obj;
						Monitor.Enter(obj = gDIBigLockedImage);
						try
						{
							Bitmap bitmap = (Bitmap)gDIBigLockedImage.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage();
							BitmapSource source = new CroppedBitmap(this.primarySource, rectangleD3.ToInt32Rect());
							BitmapSource source2 = new TransformedBitmap(source, scaleAndTranslate.ToScaleTransform());
							BitmapSource bitmapSource = new CroppedBitmap(source2, rectangleD6.ToInt32Rect());
							Int32Rect int32Rect = rectangleD4.ToInt32Rect();
							BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, size.Width, size.Height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
							try
							{
								IntPtr buffer = new IntPtr(bitmapData.Scan0.ToInt32() + int32Rect.Y * bitmapData.Stride + int32Rect.X * 4);
								bitmapSource.CopyPixels(new Int32Rect(0, 0, bitmapSource.PixelWidth, bitmapSource.PixelHeight), buffer, bitmapData.Stride * bitmapData.Height, bitmapData.Stride);
							}
							finally
							{
								bitmap.UnlockBits(bitmapData);
							}
						}
						finally
						{
							Monitor.Exit(obj);
						}
					}
					catch (Exception ex)
					{
						if (BigDebugKnob.theKnob.debugFeaturesEnabled)
						{
							this.LabelThisImage(gDIBigLockedImage, ex.ToString());
						}
					}
					if (useDocumentTransparency)
					{
						image = gDIBigLockedImage;
					}
					else
					{
						GDIBigLockedImage gDIBigLockedImage2 = new GDIBigLockedImage(size, "WPFVerb-untransparent");
						GDIBigLockedImage obj2;
						Monitor.Enter(obj2 = gDIBigLockedImage2);
						try
						{
							Graphics graphics = gDIBigLockedImage2.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheGraphics();
							graphics.FillRectangle(new SolidBrush(System.Drawing.Color.White), 0, 0, size.Width, size.Height);
							graphics.DrawImage(gDIBigLockedImage.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage(), 0, 0);
							graphics.Dispose();
							image = gDIBigLockedImage2;
							gDIBigLockedImage.Dispose();
						}
						finally
						{
							Monitor.Exit(obj2);
						}
					}
				}
				result = new ImageRef(new ImageRefCounted(image));
			}
			finally
			{
				Monitor.Exit(this);
			}
			return result;
		}
开发者ID:chharam,项目名称:Capstone_IPM_RV,代码行数:86,代码来源:WPFOpenDocument.cs


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