internal static CfxImage Wrap(IntPtr nativePtr) { if (nativePtr == IntPtr.Zero) { return(null); } lock (weakCache) { var wrapper = (CfxImage)weakCache.Get(nativePtr); if (wrapper == null) { wrapper = new CfxImage(nativePtr); weakCache.Add(wrapper); } else { CfxApi.cfx_release(nativePtr); } return(wrapper); } }
/// <summary> /// Create a new CfxImage. It will initially be NULL. Use the Add*() functions /// to add representations at different scale factors. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_image_capi.h">cef/include/capi/cef_image_capi.h</see>. /// </remarks> public static CfxImage Create() { return(CfxImage.Wrap(CfxApi.Image.cfx_image_create())); }
/// <summary> /// Returns true (1) if this Image and |that| Image share the same underlying /// storage. Will also return true (1) if both images are NULL. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_image_capi.h">cef/include/capi/cef_image_capi.h</see>. /// </remarks> public bool IsSame(CfxImage that) { return(0 != CfxApi.Image.cfx_image_is_same(NativePtr, CfxImage.Unwrap(that))); }