public CVPixelBuffer(int width, int height, CVPixelFormatType pixelFormatType, NSDictionary pixelBufferAttributes) { if (width <= 0) { throw new ArgumentOutOfRangeException("width"); } if (height <= 0) { throw new ArgumentOutOfRangeException("height"); } IntPtr pixelBufferOut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); CVReturn ret = CVPixelBufferCreate(IntPtr.Zero, (IntPtr)width, (IntPtr)height, pixelFormatType, pixelBufferAttributes == null ? IntPtr.Zero : pixelBufferAttributes.Handle, pixelBufferOut); if (ret != CVReturn.Success) { Marshal.FreeHGlobal(pixelBufferOut); throw new ArgumentException(ret.ToString()); } this.handle = Marshal.ReadIntPtr(pixelBufferOut); Marshal.FreeHGlobal(pixelBufferOut); }
public CVPixelBufferPool(NSDictionary poolAttributes, NSDictionary pixelBufferAttributes) { CVReturn ret = CVPixelBufferPoolCreate(IntPtr.Zero, poolAttributes.GetHandle(), pixelBufferAttributes.GetHandle(), out handle); if (ret != CVReturn.Success) { throw new Exception("CVPixelBufferPoolCreate returned " + ret.ToString()); } }
public CVPixelBuffer CreatePixelBuffer() { IntPtr pixelBufferOut; CVReturn ret = CVPixelBufferPoolCreatePixelBuffer(IntPtr.Zero, handle, out pixelBufferOut); if (ret != CVReturn.Success) { throw new Exception("CVPixelBufferPoolCreatePixelBuffer returned " + ret.ToString()); } return(new CVPixelBuffer(pixelBufferOut, true)); }
CVPixelBuffer(nint width, nint height, CVPixelFormatType pixelFormatType, NSDictionary pixelBufferAttributes) { if (width <= 0) throw new ArgumentOutOfRangeException ("width"); if (height <= 0) throw new ArgumentOutOfRangeException ("height"); CVReturn ret = CVPixelBufferCreate (IntPtr.Zero, width, height, pixelFormatType, pixelBufferAttributes == null ? IntPtr.Zero : pixelBufferAttributes.Handle, out handle); if (ret != CVReturn.Success) throw new ArgumentException (ret.ToString ()); }
public CVPixelBufferPool(NSDictionary poolAttributes, NSDictionary pixelBufferAttributes) { IntPtr poolOut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); CVReturn ret = CVPixelBufferPoolCreate(IntPtr.Zero, poolAttributes.Handle, pixelBufferAttributes.Handle, poolOut); if (ret != CVReturn.Success) { Marshal.FreeHGlobal(poolOut); throw new Exception("CVPixelBufferPoolCreate returned " + ret.ToString()); } this.handle = Marshal.ReadIntPtr(poolOut); Marshal.FreeHGlobal(poolOut); }
public CVPixelBuffer CreatePixelBuffer() { IntPtr pixelBufferOut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); CVReturn ret = CVPixelBufferPoolCreatePixelBuffer(IntPtr.Zero, handle, pixelBufferOut); if (ret != CVReturn.Success) { Marshal.FreeHGlobal(pixelBufferOut); throw new Exception("CVPixelBufferPoolCreatePixelBuffer returned " + ret.ToString()); } CVPixelBuffer pixelBuffer = new CVPixelBuffer(Marshal.ReadIntPtr(pixelBufferOut)); Marshal.FreeHGlobal(pixelBufferOut); return(pixelBuffer); }