Пример #1
0
        public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode)
        {
            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #2
0
        public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
        {
            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #3
0
        public static PixelBuffer DownloadImageSynchronously(string url, Size2D size)
        {
            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #4
0
        public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
        {
            var    uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            var    val   = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_0(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
            Size2D ret   = new Size2D(val.GetWidth(), val.GetHeight());

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #5
0
        public static Size2D GetClosestImageSize(string filename, Size2D size)
        {
            var    uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            var    val   = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_3(filename, Uint16Pair.getCPtr(uSize)), true);
            Size2D ret   = new Size2D(val.GetWidth(), val.GetHeight());

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #6
0
        public static PixelBuffer DownloadImageSynchronously(string url, Size2D size)
        {
            if (null == size)
            {
                throw new ArgumentNullException(nameof(size));
            }
            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize)), true);

            uSize.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #7
0
        public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode)
        {
            if (null == size)
            {
                throw new ArgumentNullException(nameof(size));
            }
            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);

            uSize.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #8
0
        public static Size2D GetClosestImageSize(string filename, Size2D size)
        {
            if (null == size)
            {
                throw new ArgumentNullException(nameof(size));
            }
            var    uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            var    val   = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize(filename, Uint16Pair.getCPtr(uSize)), true);
            Size2D ret   = new Size2D(val.GetWidth(), val.GetHeight());

            val.Dispose();
            uSize.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #9
0
        public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode)
        {
            if (null == size)
            {
                throw new ArgumentNullException(nameof(size));
            }
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);

            uSize.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #10
0
        public static PixelBuffer LoadImageFromBuffer(System.IO.Stream stream, Size2D size)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }
            if (size == null)
            {
                throw new ArgumentNullException(nameof(size));
            }
            long streamLength = stream.Length - stream.Position;

            if (streamLength <= 0)
            {
                throw new InvalidOperationException("stream lenght is <= 0");
            }

            // Read data from stream
            byte[] streamData = new byte[streamLength];
            stream.Read(streamData, 0, (int)streamLength);

            // Allocate buffer that internal DALi engine can read
            VectorUnsignedChar buffer = new VectorUnsignedChar();

            buffer.Resize((uint)streamLength);
            var bufferBegin = buffer.Begin();

            global::System.Runtime.InteropServices.HandleRef bufferRef = SWIGTYPE_p_unsigned_char.getCPtr(bufferBegin);

            // Copy data from stream to buffer
            System.Runtime.InteropServices.Marshal.Copy(streamData, 0, bufferRef.Handle, (int)streamLength);

            var         uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
            PixelBuffer ret   = new PixelBuffer(Interop.ImageLoading.LoadImageFromBuffer(VectorUnsignedChar.getCPtr(buffer), Uint16Pair.getCPtr(uSize)), true);

            uSize.Dispose();
            buffer.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #11
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Пример #12
0
        /// <summary>
        /// Constructor taking separate x and y (width and height) parameters.
        /// </summary>
        /// <param name="rhs">A reference to assign.</param>
        /// <return>The created object.</return>
        /// <since_tizen> 3 </since_tizen>
        public Uint16Pair Assign(Uint16Pair rhs)
        {
            Uint16Pair ret = new Uint16Pair(Interop.Uint16Pair.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #13
0
 /// <summary>
 /// Constructor taking separate x and y (width and height) parameters.
 /// </summary>
 /// <param name="rhs">A reference to assign.</param>
 /// <since_tizen> 3 </since_tizen>
 public Uint16Pair(Uint16Pair rhs) : this(Interop.Uint16Pair.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true)
 {
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #14
0
        public static PixelBuffer LoadImageFromFile(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
        {
            if (null == size)
            {
                throw new ArgumentNullException(nameof(size));
            }
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            PixelBuffer ret;

            using (var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height))
            {
                ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
            }
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }