Clip Property (DrawingEngine)
Gets or sets a copy of region that limits the drawing region of this drawing engine.
Property Value
A copy of the
IRegion that represents the region that limits the drawing region of this drawing engine.
Here is an example that shows how to change engine clipping region using DrawingEngine.Clip property.
''' <summary>
''' Sets a clip on specified drawing engine and draws an image.
''' </summary>
''' <param name="drawingEngine">Drawing engine.</param>
''' <param name="area">Area to draw objects in.</param>
Public Shared Sub EngineClipExample(drawingEngine As DrawingEngine, area As RectangleF)
' create clipping graphics path
Using path As IGraphicsPath = drawingEngine.DrawingFactory.CreateGraphicsPath()
' add path elements
path.AddLine(New PointF(area.X + area.Width / 2, area.Y + area.Height / 2), New PointF(area.Right, area.Y + area.Height / 2))
path.AddArc(area, 180, 180)
path.CloseFigure()
' create clip region from path
Using clipRegion As IRegion = drawingEngine.DrawingFactory.CreateRegion(path)
' create clip holder to save current engine clip and restore it aftewards
Using drawingEngine.CreateClipHolder()
' set new clip to engine
drawingEngine.Clip = clipRegion
' path to image file for drawing
' this image is located in <install path>/VintaSoft/Imaging .NET/Images/
Dim imagePath As String = "AutoContrast.jpg"
' create VintaSoft image and draw it
Using image As New VintasoftImage(imagePath)
drawingEngine.DrawImage(image, area)
End Using
End Using
End Using
End Using
End Sub
/// <summary>
/// Sets a clip on specified drawing engine and draws an image.
/// </summary>
/// <param name="drawingEngine">Drawing engine.</param>
/// <param name="area">Area to draw objects in.</param>
public static void EngineClipExample(DrawingEngine drawingEngine, RectangleF area)
{
// create clipping graphics path
using (IGraphicsPath path = drawingEngine.DrawingFactory.CreateGraphicsPath())
{
// add path elements
path.AddLine(new PointF(area.X + area.Width / 2, area.Y + area.Height / 2), new PointF(area.Right, area.Y + area.Height / 2));
path.AddArc(area, 180, 180);
path.CloseFigure();
// create clip region from path
using (IRegion clipRegion = drawingEngine.DrawingFactory.CreateRegion(path))
// create clip holder to save current engine clip and restore it aftewards
using (drawingEngine.CreateClipHolder())
{
// set new clip to engine
drawingEngine.Clip = clipRegion;
// path to image file for drawing
// this image is located in <install path>/VintaSoft/Imaging .NET/Images/
string imagePath = "AutoContrast.jpg";
// create VintaSoft image and draw it
using (VintasoftImage image = new VintasoftImage(imagePath))
drawingEngine.DrawImage(image, area);
}
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5