Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Perspective Image Transformation with tiling
  2. using (System.Drawing.Bitmap sourceImg = new System.Drawing.Bitmap(@"c:image.jpg"))
  3. {
  4.     YLScsDrawing.Imaging.Filters.FreeTransform filter = new YLScsDrawing.Imaging.Filters.FreeTransform();
  5.     filter.Bitmap = sourceImg;
  6.     // assign FourCorners (the four X/Y coords) of the new perspective shape
  7.     filter.FourCorners = new System.Drawing.PointF[] { new System.Drawing.PointF(0, 0), new System.Drawing.PointF(300, 50), new System.Drawing.PointF(300, 411), new System.Drawing.PointF(0, 461)};
  8.     filter.IsBilinearInterpolation = true; // optional for higher quality
  9.     using (System.Drawing.Bitmap perspectiveImg = filter.Bitmap)
  10.     {
  11.         // perspectiveImg contains your completed image. save the image or do whatever.
  12.     }
  13. }