Пример #1
0
 public static NSImage ScaleImageSquare(NSImage sourceImage, int size)
 {
     var newSize = new SizeF(size, size);
     var newImage = new NSImage(newSize);
     newImage.LockFocus();
     sourceImage.Size = newSize;
     NSGraphicsContext.CurrentContext.ImageInterpolation = NSImageInterpolation.High;
     sourceImage.DrawInRect(new RectangleF(0, 0, size, size), new RectangleF(), NSCompositingOperation.Copy, 1);
     //sourceImage.Draw(new PointF(), new RectangleF(0, 0, newSize.Width, newSize.Height), NSCompositingOperation.Copy, 1); 
     newImage.UnlockFocus();
     return newImage;
 }