private Image(Session session, IntPtr imagePtr) { if (imagePtr == IntPtr.Zero) { throw new ArgumentException("imagePtr can't be zero."); } if (session == null) { throw new ArgumentNullException("Session can't be null."); } this.session = session; this.imagePtr = imagePtr; this.image_loaded = new image_loaded_cb(ImageLoadedCallback); this.imageLoadedPtr = Marshal.GetFunctionPointerForDelegate(this.image_loaded); lock (libspotify.Mutex) { libspotify.sp_image_add_ref(imagePtr); libspotify.sp_image_add_load_callback(imagePtr, this.imageLoadedPtr, IntPtr.Zero); } session.DisposeAll += new SessionEventHandler(session_DisposeAll); }
public static extern sp_error sp_image_remove_load_callback(IntPtr imagePtr, image_loaded_cb callback, IntPtr userDataPtr);