Msdn tutorial video wpf10 (image cutting)

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.