本文整理汇总了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;
}