Image Cutting
Today, I want to crop the image we want.
First, create a WPF application.Program.
To cut images, you must use the image control. Use the clip attribute of the image.
Next we will take an ellipse.
<Grid> <Image Source ="Tulips.jpg"Width ="300"Height ="200"Stretch ="Fill"> <Image. Clip> <ellipsegeometry center ="150,100"Radiusx ="120"Radiusy ="90"/> </Image. Clip> </image> </GRID>
Effect
There are 6 printable images under image. clip.
1. combinedgeometry represents a two-dimensional geometric shape defined by a combination of two system. Windows. Media. Geometry objects.
2. geometrygroup indicates a composite ry composed of other system. Windows. Media. Geometry objects.
3. linegeometry indicates the line ry.
4. pathgeometry
Specify the ry used to generate the output value of this animation. This is a Dependency Property.
Return Value:
The path used to generate the animation output value. The default value is null.
5. rectanglegeometry describes two-dimensional rectangles.
6. streamgeometry
Define the geometric shape and use system. Windows. Media. streamgeometrycontext to describe it. This ry is a lightweight alternative to system. Windows. Media. pathgeometry: it does not support data binding, animation, or modification.
Next we will use pathgeomitry to draw.
<Image Source =" Tulips.jpg "Width =" 300 "Height ="200 "Stretch =" Fill "> <Image. Clip> <pathgeometry. Figures> <pathfigurecollection> <pathfigure startpoint =" 150,30 "Isclosed =" True "> <Linesegment point =" 60,180 "/> <Linesegment point =" 240,180 "/> </Pathfigure> </pathfigurecollection> </pathgeometry. Figures> </pathgeometry> </image. Clip> </image>
Here isclosed = "true" is used to close the image.