ASP. NET MVC Website Development Summary (vii)--c# operation Picture: mosaic of multiple graphs (rotation)

Source: Internet
Author: User

In fact, the use of C # to manipulate the stitching of the picture is to use graphic drawing. Personal feeling is very interesting, various types of library provides a variety of functions.

Source code (ported to a simple C # program that is not placed in an ASP. NET project):

usingSystem.Drawing;usingSystem.Drawing.Drawing2D;usingSystem.Drawing.Imaging;namespacetest{classProgram {Static voidMain (string[] args) {Image img=NewBitmap (NewBitmap ("Model1.png"), -, the);//Loading PicturesGraphics g = Graphics.fromimage (IMG);//convert pictures to graphicsG.smoothingmode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;//Plus anti-aliasing effect//point[] DestPoints1 = {                        NewPoint (453, the),//top left point of the picture                         NewPoint (638, +),//top right point of the picture                         NewPoint (497,212),//picture lower left Dot                    }; G.drawimage (NewBitmap ("img1.jpg"), destPoints1);//draw by the specified vertexG.drawlines (NewPen (Brushes.gray),Newpoint[] {NewPoint (453, the),                         NewPoint (638, +),                         NewPoint (683,144),                         NewPoint (497,212),                         NewPoint (453, the),                    });//draw lines that depict the boundaries of IMG1 picturespoint[] DestPoints2= {                        NewPoint ( -,158),                        NewPoint (590,203),                        NewPoint (370,287)                    }; G.drawimage (NewBitmap ("img1.jpg"), destPoints2); G.drawlines (NewPen (Brushes.gray),Newpoint[] {NewPoint ( -,158),                        NewPoint (590,203),                        NewPoint (559,332),                        NewPoint (370,287),                        NewPoint ( -,158),                    }); G.fillrectangle (Brushes.gray,525,279,201,135);//Draw a rectangleG.drawimage (NewBitmap ("img1.jpg"),526,280,199,133);//draw directly by the specified length and widthImg. Save ("Test1.png");//Save as PictureImg. Dispose ();//Show Free ResourcesG.dispose (); }    }}
View Code

This knowledge sharing is here, please look forward to the next share. ^_^

< my blog homepage;:http://www.cnblogs.com/forcheng/

<wing Studio homepage;:http://www.wingstudio.org/

ASP. NET MVC Website Development Summary (vii)--c# operation Picture: mosaic of multiple graphs (rotation)

Related Article

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.