Ejemplo n.º 1
0
            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);
            }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
 public override CGImage AsCGImage(ref CGRect proposedDestRect, NSGraphicsContext context, NSDictionary hints)
 {
     return(Rep.AsCGImage(ref proposedDestRect, context, hints));
 }