public CGImage AsCGImage(IntPtr proposedDestRectPtr, NSGraphicsContext context, NSDictionary hints) { var proposedDestRect = Marshal.PtrToStructure <CGRect>(proposedDestRectPtr); var result = Rep.AsCGImage(ref proposedDestRect, context, hints); Marshal.StructureToPtr(proposedDestRect, proposedDestRectPtr, false); return(result); }
public override object CropBitmap(object backend, int srcX, int srcY, int width, int height) { NSImage img = (NSImage)backend; NSBitmapImageRep bitmap = img.Representations().OfType <NSBitmapImageRep> ().FirstOrDefault(); if (bitmap != null) { var empty = CGRect.Empty; var cgi = bitmap.AsCGImage(ref empty, null, null).WithImageInRect(new CGRect(srcX, srcY, width, height)); NSImage res = new NSImage(cgi, new CGSize(width, height)); cgi.Dispose(); return(res); } else { throw new InvalidOperationException("Not a bitmap image"); } }
public override CGImage AsCGImage(ref CGRect proposedDestRect, NSGraphicsContext context, NSDictionary hints) { return(Rep.AsCGImage(ref proposedDestRect, context, hints)); }