Clip Свойство (DrawingEngine)
В этом разделе
Возвращает или задает копию области, ограничивающей область рисования этого движка рисования.
Синтаксис
'Declaration
Public MustOverride Property Clip As IRegion
public abstract IRegion Clip { get; set; }
public: __property abstract IRegion* get_Clip();
public: __property abstract void set_Clip(
IRegion*
);
Property Value
Копия
IRegion, представляющая область, ограничивающую область рисования этого движка рисования.
Пример
Вот пример, показывающий, как изменить область отсечения движка с помощью свойства DrawingEngine.Clip.
''' <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);
}
}
}
Требования
Целевые платформы: .NET 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также