Пример #1
0
 public unsafe int IsSame(cef_image_t *that)
 {
     fixed(cef_image_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_image_t *, cef_image_t *, int >)is_same)(self, that));
     }
 }
Пример #2
0
        public unsafe static CefImage Wrap(Func <IntPtr, CefImage> create, cef_image_t *instance)
        {
            if (instance == null)
            {
                return(null);
            }

            IntPtr key = new IntPtr(instance);

            lock (WeakRefs)
            {
                CefImage wrapper;
                foreach (WeakReference <CefImage> weakRef in WeakRefs)
                {
                    if (weakRef.TryGetTarget(out wrapper))
                    {
                        if (wrapper._instance == key ||
                            instance->IsSame(wrapper.GetNativeInstance()) != 0)
                        {
                            instance->@base.Release();
                            return(wrapper);
                        }
                    }
                }
                wrapper = CefBaseRefCounted <cef_image_t> .Wrap(create, instance);

                WeakRefs.Add(wrapper.WeakRef);
                return(wrapper);
            }
        }
Пример #3
0
 internal static CefImage FromNativeOrNull(cef_image_t *ptr)
 {
     if (ptr == null)
     {
         return(null);
     }
     return(new CefImage(ptr));
 }
Пример #4
0
 private CefImage(cef_image_t *ptr)
 {
     if (ptr == null)
     {
         throw new ArgumentNullException("ptr");
     }
     _self = ptr;
 }
Пример #5
0
 public void Dispose()
 {
     if (_self != null)
     {
         Release();
         _self = null;
     }
     GC.SuppressFinalize(this);
 }
        public static int add_jpeg(cef_image_t *self, float scale_factor, void *jpeg_data, UIntPtr jpeg_data_size)
        {
            add_jpeg_delegate d;
            var p = self->_add_jpeg;

            if (p == _p8)
            {
                d = _d8;
            }
            else
            {
                d = (add_jpeg_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_jpeg_delegate));
                if (_p8 == IntPtr.Zero)
                {
                    _d8 = d; _p8 = p;
                }
            }
            return(d(self, scale_factor, jpeg_data, jpeg_data_size));
        }
        public static int is_same(cef_image_t *self, cef_image_t *that)
        {
            is_same_delegate d;
            var p = self->_is_same;

            if (p == _p5)
            {
                d = _d5;
            }
            else
            {
                d = (is_same_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(is_same_delegate));
                if (_p5 == IntPtr.Zero)
                {
                    _d5 = d; _p5 = p;
                }
            }
            return(d(self, that));
        }
        public static int is_empty(cef_image_t *self)
        {
            is_empty_delegate d;
            var p = self->_is_empty;

            if (p == _p4)
            {
                d = _d4;
            }
            else
            {
                d = (is_empty_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(is_empty_delegate));
                if (_p4 == IntPtr.Zero)
                {
                    _d4 = d; _p4 = p;
                }
            }
            return(d(self));
        }
        public static int has_at_least_one_ref(cef_image_t *self)
        {
            has_at_least_one_ref_delegate d;
            var p = self->_base._has_at_least_one_ref;

            if (p == _p3)
            {
                d = _d3;
            }
            else
            {
                d = (has_at_least_one_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_at_least_one_ref_delegate));
                if (_p3 == IntPtr.Zero)
                {
                    _d3 = d; _p3 = p;
                }
            }
            return(d(self));
        }
        public static int release(cef_image_t *self)
        {
            release_delegate d;
            var p = self->_base._release;

            if (p == _p1)
            {
                d = _d1;
            }
            else
            {
                d = (release_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(release_delegate));
                if (_p1 == IntPtr.Zero)
                {
                    _d1 = d; _p1 = p;
                }
            }
            return(d(self));
        }
        public static int add_bitmap(cef_image_t *self, float scale_factor, int pixel_width, int pixel_height, CefColorType color_type, CefAlphaType alpha_type, void *pixel_data, UIntPtr pixel_data_size)
        {
            add_bitmap_delegate d;
            var p = self->_add_bitmap;

            if (p == _p6)
            {
                d = _d6;
            }
            else
            {
                d = (add_bitmap_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_bitmap_delegate));
                if (_p6 == IntPtr.Zero)
                {
                    _d6 = d; _p6 = p;
                }
            }
            return(d(self, scale_factor, pixel_width, pixel_height, color_type, alpha_type, pixel_data, pixel_data_size));
        }
        public static UIntPtr get_height(cef_image_t *self)
        {
            get_height_delegate d;
            var p = self->_get_height;

            if (p == _pa)
            {
                d = _da;
            }
            else
            {
                d = (get_height_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_height_delegate));
                if (_pa == IntPtr.Zero)
                {
                    _da = d; _pa = p;
                }
            }
            return(d(self));
        }
        public static int has_representation(cef_image_t *self, float scale_factor)
        {
            has_representation_delegate d;
            var p = self->_has_representation;

            if (p == _pb)
            {
                d = _db;
            }
            else
            {
                d = (has_representation_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_representation_delegate));
                if (_pb == IntPtr.Zero)
                {
                    _db = d; _pb = p;
                }
            }
            return(d(self, scale_factor));
        }
        public static cef_binary_value_t *get_as_png(cef_image_t *self, float scale_factor, int with_transparency, int *pixel_width, int *pixel_height)
        {
            get_as_png_delegate d;
            var p = self->_get_as_png;

            if (p == _pf)
            {
                d = _df;
            }
            else
            {
                d = (get_as_png_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_as_png_delegate));
                if (_pf == IntPtr.Zero)
                {
                    _df = d; _pf = p;
                }
            }
            return(d(self, scale_factor, with_transparency, pixel_width, pixel_height));
        }
        public static cef_binary_value_t *get_as_jpeg(cef_image_t *self, float scale_factor, int quality, int *pixel_width, int *pixel_height)
        {
            get_as_jpeg_delegate d;
            var p = self->_get_as_jpeg;

            if (p == _p10)
            {
                d = _d10;
            }
            else
            {
                d = (get_as_jpeg_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_as_jpeg_delegate));
                if (_p10 == IntPtr.Zero)
                {
                    _d10 = d; _p10 = p;
                }
            }
            return(d(self, scale_factor, quality, pixel_width, pixel_height));
        }
        public static int get_representation_info(cef_image_t *self, float scale_factor, float *actual_scale_factor, int *pixel_width, int *pixel_height)
        {
            get_representation_info_delegate d;
            var p = self->_get_representation_info;

            if (p == _pd)
            {
                d = _dd;
            }
            else
            {
                d = (get_representation_info_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_representation_info_delegate));
                if (_pd == IntPtr.Zero)
                {
                    _dd = d; _pd = p;
                }
            }
            return(d(self, scale_factor, actual_scale_factor, pixel_width, pixel_height));
        }
        public static cef_binary_value_t *get_as_bitmap(cef_image_t *self, float scale_factor, CefColorType color_type, CefAlphaType alpha_type, int *pixel_width, int *pixel_height)
        {
            get_as_bitmap_delegate d;
            var p = self->_get_as_bitmap;

            if (p == _pe)
            {
                d = _de;
            }
            else
            {
                d = (get_as_bitmap_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_as_bitmap_delegate));
                if (_pe == IntPtr.Zero)
                {
                    _de = d; _pe = p;
                }
            }
            return(d(self, scale_factor, color_type, alpha_type, pixel_width, pixel_height));
        }
        public static int remove_representation(cef_image_t *self, float scale_factor)
        {
            remove_representation_delegate d;
            var p = self->_remove_representation;

            if (p == _pc)
            {
                d = _dc;
            }
            else
            {
                d = (remove_representation_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(remove_representation_delegate));
                if (_pc == IntPtr.Zero)
                {
                    _dc = d; _pc = p;
                }
            }
            return(d(self, scale_factor));
        }
        public static void add_ref(cef_image_t *self)
        {
            add_ref_delegate d;
            var p = self->_base._add_ref;

            if (p == _p0)
            {
                d = _d0;
            }
            else
            {
                d = (add_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_ref_delegate));
                if (_p0 == IntPtr.Zero)
                {
                    _d0 = d; _p0 = p;
                }
            }
            d(self);
        }
        public static UIntPtr get_width(cef_image_t *self)
        {
            get_width_delegate d;
            var p = self->_get_width;

            if (p == _p9)
            {
                d = _d9;
            }
            else
            {
                d = (get_width_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_width_delegate));
                if (_p9 == IntPtr.Zero)
                {
                    _d9 = d; _p9 = p;
                }
            }
            return(d(self));
        }
Пример #21
0
 public CefImage(cef_image_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
Пример #22
0
 internal static CefImage FromNative(cef_image_t *ptr)
 {
     return(new CefImage(ptr));
 }
 public unsafe void OnDownloadImageFinished([Immutable] cef_string_t *image_url, int http_status_code, cef_image_t *image)
 {
     fixed(cef_download_image_callback_t *self = &this)
     {
         ((delegate * unmanaged[Stdcall] < cef_download_image_callback_t *, cef_string_t *, int, cef_image_t *, void >)on_download_image_finished)(self, image_url, http_status_code, image);
     }
 }
        private void on_download_image_finished(cef_download_image_callback_t *self, cef_string_t *image_url, int http_status_code, cef_image_t *image)
        {
            CheckSelf(self);

            var m_imageUrl = cef_string_t.ToString(image_url);
            var m_image    = CefImage.FromNativeOrNull(image);

            OnDownloadImageFinished(m_imageUrl, http_status_code, m_image);
        }
Пример #25
0
        private static unsafe void OnDownloadImageFinishedImpl(cef_download_image_callback_t *self, cef_string_t *image_url, int http_status_code, cef_image_t *image)
        {
            var instance = GetInstance((IntPtr)self) as CefDownloadImageCallback;

            if (instance == null || ((ICefDownloadImageCallbackPrivate)instance).AvoidOnDownloadImageFinished())
            {
                ReleaseIfNonNull((cef_base_ref_counted_t *)image);
                return;
            }
            instance.OnDownloadImageFinished(CefString.Read(image_url), http_status_code, CefImage.Wrap(CefImage.Create, image));
        }
 public unsafe extern void OnDownloadImageFinished([Immutable] cef_string_t *image_url, int http_status_code, cef_image_t *image);
Пример #27
0
 public unsafe extern int IsSame(cef_image_t *that);