c# - Cutting rectangle not using Rectangle :) -


if have 4 points @ bitmap (left top corner, right top corner, left bottom corner, right bottom corner) how cut bitmap not using rectangle method cut rectangle of points? , save .png?

suppose have 4 points: p1, p2, p3, p4. can draw image part of image in region of polygon made 4 points using clip property of graphics object. here test draws image on form:

private void form1_paint(object sender, painteventargs e) {   graphicspath gp = new graphicspath();   gp.addpolygon(new []{point.empty, new point(100,10), new point(200,300), new point(30,200) });//add p1,p2,p3,p4 polygon   e.graphics.clip = new region(gp);   e.graphics.drawimage(yourimage, point.empty); }  

enter image description here


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -