/// <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>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
        /// </remarks>
        public bool SetBinary(string key, CfxBinaryValue value)
        {
            var key_pinned = new PinnedString(key);
            var __retval   = CfxApi.DictionaryValue.cfx_dictionary_value_set_binary(NativePtr, key_pinned.Obj.PinnedPtr, key_pinned.Length, CfxBinaryValue.Unwrap(value));

            key_pinned.Obj.Free();
            return(0 != __retval);
        }
        /// <summary>
        /// Returns the value at the specified key as type binary. The returned value
        /// will reference existing data.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
        /// </remarks>
        public CfxBinaryValue GetBinary(string key)
        {
            var key_pinned = new PinnedString(key);
            var __retval   = CfxApi.DictionaryValue.cfx_dictionary_value_get_binary(NativePtr, key_pinned.Obj.PinnedPtr, key_pinned.Length);

            key_pinned.Obj.Free();
            return(CfxBinaryValue.Wrap(__retval));
        }
        /// <summary>
        /// Creates a new object that is not owned by any other object. The specified
        /// |data| will be copied.
        /// </summary>
        public static CfxBinaryValue Create(byte[] data)
        {
            if (data == null || data.Length == 0)
            {
                throw new ArgumentException("Data is null or zero length", "data");
            }
            var po     = new PinnedObject(data);
            var retval = CfxBinaryValue.Create(po.PinnedPtr, (ulong)data.LongLength);

            po.Free();
            return(retval);
        }
示例#4
0
 internal static CfxBinaryValue Wrap(IntPtr nativePtr)
 {
     if (nativePtr == IntPtr.Zero)
     {
         return(null);
     }
     lock (weakCache) {
         var wrapper = (CfxBinaryValue)weakCache.Get(nativePtr);
         if (wrapper == null)
         {
             wrapper = new CfxBinaryValue(nativePtr);
             weakCache.Add(wrapper);
         }
         else
         {
             CfxApi.cfx_release(nativePtr);
         }
         return(wrapper);
     }
 }
示例#5
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>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetBinary(CfxBinaryValue value)
 {
     return(0 != CfxApi.cfx_value_set_binary(NativePtr, CfxBinaryValue.Unwrap(value)));
 }
示例#6
0
 /// <summary>
 /// Creates a new object that is not owned by any other object. The specified
 /// |data| will be copied.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public static CfxBinaryValue Create(IntPtr data, ulong dataSize)
 {
     return(CfxBinaryValue.Wrap(CfxApi.BinaryValue.cfx_binary_value_create(data, (UIntPtr)dataSize)));
 }
示例#7
0
 /// <summary>
 /// Returns the value at the specified index as type binary. The returned value
 /// will reference existing data.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public CfxBinaryValue GetBinary(ulong index)
 {
     return(CfxBinaryValue.Wrap(CfxApi.ListValue.cfx_list_value_get_binary(NativePtr, (UIntPtr)index)));
 }
示例#8
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>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetBinary(int index, CfxBinaryValue value)
 {
     return 0 != CfxApi.cfx_list_value_set_binary(NativePtr, index, CfxBinaryValue.Unwrap(value));
 }
示例#9
0
 /// <summary>
 /// Creates a new object that is not owned by any other object. The specified
 /// |data| will be copied.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public static CfxBinaryValue Create(IntPtr data, int dataSize)
 {
     return(CfxBinaryValue.Wrap(CfxApi.cfx_binary_value_create(data, dataSize)));
 }
示例#10
0
 /// <summary>
 /// Returns true (1) if this object and |that| object have the same underlying
 /// data.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool IsSame(CfxBinaryValue that)
 {
     return(0 != CfxApi.cfx_binary_value_is_same(NativePtr, CfxBinaryValue.Unwrap(that)));
 }
示例#11
0
 /// <summary>
 /// Returns the JPEG representation that most closely matches |scaleFactor|.
 /// |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. |pixelWidth| and |pixelHeight| are
 /// the output representation size in pixel coordinates. Returns a
 /// CfxBinaryValue containing the JPEG image data on success or NULL on
 /// failure.
 /// </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 CfxBinaryValue GetAsJpeg(float scaleFactor, int quality, out int pixelWidth, out int pixelHeight)
 {
     return(CfxBinaryValue.Wrap(CfxApi.Image.cfx_image_get_as_jpeg(NativePtr, scaleFactor, quality, out pixelWidth, out pixelHeight)));
 }
示例#12
0
 /// <summary>
 /// Returns the PNG representation that most closely matches |scaleFactor|. If
 /// |withTransparency| is true (1) any alpha transparency in the image will be
 /// represented in the resulting PNG data. |pixelWidth| and |pixelHeight| are
 /// the output representation size in pixel coordinates. Returns a
 /// CfxBinaryValue containing the PNG image data on success or NULL on
 /// failure.
 /// </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 CfxBinaryValue GetAsPng(float scaleFactor, bool withTransparency, out int pixelWidth, out int pixelHeight)
 {
     return(CfxBinaryValue.Wrap(CfxApi.Image.cfx_image_get_as_png(NativePtr, scaleFactor, withTransparency ? 1 : 0, out pixelWidth, out pixelHeight)));
 }
示例#13
0
 /// <summary>
 /// Returns the bitmap representation that most closely matches |scaleFactor|.
 /// Only 32-bit RGBA/BGRA formats are supported. |colorType| and |alphaType|
 /// values specify the desired output pixel format. |pixelWidth| and
 /// |pixelHeight| are the output representation size in pixel coordinates.
 /// Returns a CfxBinaryValue containing the pixel data on success or NULL
 /// on failure.
 /// </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 CfxBinaryValue GetAsBitmap(float scaleFactor, CfxColorType colorType, CfxAlphaType alphaType, out int pixelWidth, out int pixelHeight)
 {
     return(CfxBinaryValue.Wrap(CfxApi.Image.cfx_image_get_as_bitmap(NativePtr, scaleFactor, (int)colorType, (int)alphaType, out pixelWidth, out pixelHeight)));
 }
示例#14
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>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetBinary(ulong index, CfxBinaryValue value)
 {
     return(0 != CfxApi.ListValue.cfx_list_value_set_binary(NativePtr, (UIntPtr)index, CfxBinaryValue.Unwrap(value)));
 }
示例#15
0
 /// <summary>
 /// Returns the value at the specified index as type binary. The returned value
 /// will reference existing data.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public CfxBinaryValue GetBinary(int index)
 {
     return(CfxBinaryValue.Wrap(CfxApi.cfx_list_value_get_binary(NativePtr, index)));
 }
示例#16
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>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetBinary(int index, CfxBinaryValue value)
 {
     return(0 != CfxApi.cfx_list_value_set_binary(NativePtr, index, CfxBinaryValue.Unwrap(value)));
 }
示例#17
0
 /// <summary>
 /// Returns true (1) if this object and |that| object have an equivalent
 /// underlying value but are not necessarily the same object.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool IsEqual(CfxBinaryValue that)
 {
     return(0 != CfxApi.BinaryValue.cfx_binary_value_is_equal(NativePtr, CfxBinaryValue.Unwrap(that)));
 }
示例#18
0
 /// <summary>
 /// Returns a copy of this object. The data in this object will also be copied.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public CfxBinaryValue Copy()
 {
     return(CfxBinaryValue.Wrap(CfxApi.BinaryValue.cfx_binary_value_copy(NativePtr)));
 }
示例#19
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>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetBinary(string key, CfxBinaryValue value)
 {
     var key_pinned = new PinnedString(key);
     var __retval = CfxApi.cfx_dictionary_value_set_binary(NativePtr, key_pinned.Obj.PinnedPtr, key_pinned.Length, CfxBinaryValue.Unwrap(value));
     key_pinned.Obj.Free();
     return 0 != __retval;
 }