public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { 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), (int)fittingMode, (int)samplingMode), true); Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); val.Dispose(); uSize.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static PixelBuffer LoadImageFromBuffer(System.IO.Stream stream, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { 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), (int)fittingMode, (int)samplingMode), true); uSize.Dispose(); buffer.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) { 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, (int)samplingMode, orientationCorrection), true); uSize.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { 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), (int)fittingMode, (int)samplingMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public uint Load(string url, Uint16Pair dimensions, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) { uint ret = NDalicPINVOKE.AsyncImageLoader_Load__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(dimensions), (int)fittingMode, (int)samplingMode, orientationCorrection); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
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); }
public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_1(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static PixelBuffer DownloadImageSynchronously(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)); } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } uSize.Dispose(); return(ret); }
public EncodedBufferImage(SWIGTYPE_p_uint8_t encodedImage, uint encodedImageByteCount, Uint16Pair size, FittingModeType fittingMode, SamplingModeType samplingMode) : this(Interop.BufferImage.EncodedBufferImage_New__SWIG_2(SWIGTYPE_p_uint8_t.getCPtr(encodedImage), encodedImageByteCount, Uint16Pair.getCPtr(size), (int)fittingMode, (int)samplingMode), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } }