public static IMemoryObject CreateImage2D(ContextHandle context,
                                 MemFlags flags,
                                 ImageFormat imageFormat,
                                 IntPtr imageWidth,
                                 IntPtr imageHeight,
                                 IntPtr imageRowPitch,
                                 IntPtr hostPtr,
                                 out OpenCLErrorCode errorcodeRet)
 {
     using (var imageFormatPtr = imageFormat.Pin())
         return new MemoryObject(clCreateImage2D((context as IHandleData).Handle, flags, imageFormatPtr, imageWidth, imageHeight, imageRowPitch, hostPtr, out errorcodeRet));
 }
 public static OpenCLErrorCode GetSupportedImageFormats(ContextHandle context,
                                                  MemFlags flags,
                                                  MemObjectType imageType,
                                                  uint numEntries,
                                                  ImageFormat[] imageFormats,
                                                  out uint numImageFormats)
 {
     return clGetSupportedImageFormats((context as IHandleData).Handle, flags, imageType, numEntries, imageFormats, out numImageFormats);
 }