VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Drawing Namespace / DrawingEngine Class / Clip Property
Синтаксис Example Требования Смотрите также
В этом разделе
    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* value
    );
    public:
    abstract property IRegion^ Clip { IRegion^ get(); void set(IRegion^ value); }

    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 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также