Example #1
0
 public bool SetBinary(byte[] buffer)
 {
     using (var v = new CefBinaryValue(buffer))
     {
         return(SetBinary(v));
     }
 }
Example #2
0
 public bool SetBinary(long index, byte[] buffer)
 {
     using (var v = new CefBinaryValue(buffer))
     {
         return(SetBinary(index, v));
     }
 }
Example #3
0
 /// <summary>
 /// Returns the JPEG representation that most closely matches |scale_factor|.
 /// |quality| determines the compression level with 0 == lowest and 100 ==
 /// highest. The JPEG format does not support alpha transparency and the alpha
 /// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
 /// the output representation size in pixel coordinates. Returns a
 /// cef_binary_value_t containing the JPEG image data on success or NULL on
 /// failure.
 /// </summary>
 public unsafe virtual CefBinaryValue GetAsJpeg(float scaleFactor, bool quality, ref int pixelWidth, ref int pixelHeight)
 {
     fixed(int *p2 = &pixelWidth)
     fixed(int *p3 = &pixelHeight)
     {
         return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetAsJpeg(scaleFactor, quality ? 1 : 0, p2, p3))));
     }
 }
Example #4
0
 /// <summary>
 /// Returns the bitmap representation that most closely matches |scale_factor|.
 /// Only 32-bit RGBA/BGRA formats are supported. |color_type| and |alpha_type|
 /// values specify the desired output pixel format. |pixel_width| and
 /// |pixel_height| are the output representation size in pixel coordinates.
 /// Returns a cef_binary_value_t containing the pixel data on success or NULL
 /// on failure.
 /// </summary>
 public unsafe virtual CefBinaryValue GetAsBitmap(float scaleFactor, CefColorType colorType, CefAlphaType alphaType, ref int pixelWidth, ref int pixelHeight)
 {
     fixed(int *p3 = &pixelWidth)
     fixed(int *p4 = &pixelHeight)
     {
         return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetAsBitmap(scaleFactor, colorType, alphaType, p3, p4))));
     }
 }
Example #5
0
        /// <summary>
        /// Sets the value at the specified key as type binary. Returns true (1) if the
        /// value was set successfully. If |value| is currently owned by another object
        /// then the value will be copied and the |value| reference will not change.
        /// Otherwise, ownership will be transferred to this object and the |value|
        /// reference will be invalidated.
        /// </summary>
        public unsafe virtual bool SetBinary(string key, CefBinaryValue value)
        {
            fixed(char *s0 = key)
            {
                var cstr0 = new cef_string_t {
                    Str = s0, Length = key != null ? key.Length : 0
                };

                return(SafeCall(NativeInstance->SetBinary(&cstr0, (value != null) ? value.GetNativeInstance() : null) != 0));
            }
        }
Example #6
0
        /// <summary>
        /// Returns the value at the specified key as type binary. The returned value
        /// will reference existing data.
        /// </summary>
        public unsafe virtual CefBinaryValue GetBinary(string key)
        {
            fixed(char *s0 = key)
            {
                var cstr0 = new cef_string_t {
                    Str = s0, Length = key != null ? key.Length : 0
                };

                return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetBinary(&cstr0))));
            }
        }
Example #7
0
        /// <summary>
        /// Returns the PEM encoded data for the certificate issuer chain. If we failed
        /// to encode a certificate in the chain it is still present in the array but
        /// is an NULL string.
        /// </summary>
        public unsafe virtual void GetPEMEncodedIssuerChain(ref long chainCount, ref CefBinaryValue[] chain)
        {
            var c1 = new UIntPtr((uint)chain.Length);
            cef_binary_value_t **arr1 = (cef_binary_value_t **)Marshal.AllocHGlobal(sizeof(cef_binary_value_t *) * chain.Length);

            for (int i = 0; i < chain.Length; i++)
            {
                var e1 = chain[i];
                *(arr1 + i) = e1 != null?e1.GetNativeInstance() : null;
            }
            NativeInstance->GetPEMEncodedIssuerChain(&c1, arr1);
            chainCount = (long)c1;
            for (int i = (int)c1; i >= 0; i--)
            {
                chain[i] = CefBinaryValue.Wrap(CefBinaryValue.Create, *(arr1 + i));
            }
            Marshal.FreeHGlobal((IntPtr)arr1);
            GC.KeepAlive(this);
        }
Example #8
0
 /// <summary>
 /// Returns a cef_binary_value_t containing the decompressed contents of the
 /// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
 /// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
 /// independent resources or call GetDataResource instead.Include
 /// cef_pack_resources.h for a listing of valid resource ID values.
 /// </summary>
 public unsafe virtual CefBinaryValue GetDataResourceForScale(int resourceId, CefScaleFactor scaleFactor)
 {
     return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetDataResourceForScale(resourceId, scaleFactor))));
 }
Example #9
0
 /// <summary>
 /// Returns a cef_binary_value_t containing the decompressed contents of the
 /// specified scale independent |resource_id| or NULL if not found. Include
 /// cef_pack_resources.h for a listing of valid resource ID values.
 /// </summary>
 public unsafe virtual CefBinaryValue GetDataResource(int resourceId)
 {
     return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetDataResource(resourceId))));
 }
Example #10
0
 /// <summary>
 /// Sets the value at the specified index as type binary. Returns true (1) if
 /// the value was set successfully. If |value| is currently owned by another
 /// object then the value will be copied and the |value| reference will not
 /// change. Otherwise, ownership will be transferred to this object and the
 /// |value| reference will be invalidated.
 /// </summary>
 public unsafe virtual bool SetBinary(long index, CefBinaryValue value)
 {
     return(SafeCall(NativeInstance->SetBinary(new UIntPtr((ulong)index), (value != null) ? value.GetNativeInstance() : null) != 0));
 }
Example #11
0
 /// <summary>
 /// Returns the value at the specified index as type binary. The returned value
 /// will reference existing data.
 /// </summary>
 public unsafe virtual CefBinaryValue GetBinary(long index)
 {
     return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetBinary(new UIntPtr((ulong)index)))));
 }
Example #12
0
 /// <summary>
 /// Sets the underlying value as type binary. Returns true (1) if the value was
 /// set successfully. This object keeps a reference to |value| and ownership of
 /// the underlying data remains unchanged.
 /// </summary>
 public unsafe virtual bool SetBinary(CefBinaryValue value)
 {
     return(SafeCall(NativeInstance->SetBinary((value != null) ? value.GetNativeInstance() : null) != 0));
 }
Example #13
0
 /// <summary>
 /// Returns the underlying value as type binary. The returned reference may
 /// become invalid if the value is owned by another object or if ownership is
 /// transferred to another object in the future. To maintain a reference to the
 /// value after assigning ownership to a dictionary or list pass this object to
 /// the set_value() function instead of passing the returned reference to
 /// set_binary().
 /// </summary>
 public unsafe virtual CefBinaryValue GetBinary()
 {
     return(SafeCall(CefBinaryValue.Wrap(CefBinaryValue.Create, NativeInstance->GetBinary())));
 }
Example #14
0
 /// <summary>
 /// Returns true (1) if this object and |that| object have an equivalent
 /// underlying value but are not necessarily the same object.
 /// </summary>
 public unsafe virtual bool IsEqual(CefBinaryValue that)
 {
     return(SafeCall(NativeInstance->IsEqual((that != null) ? that.GetNativeInstance() : null) != 0));
 }