Пример #1
0
        private void setupController(TWLoadingImageLib loadImageLibrary, ImageLoadType imageLoadType)
        {
            aspectRatioFitter = loadImage.gameObject.GetComponent <AspectRatioFitter>();

            this.loadImageLibrary = loadImageLibrary;

            changeImageLoadAspectFitter(imageLoadType);
        }
Пример #2
0
        private unsafe static IImage load(string fileName, ImageLoadType imageLoadType)
        {
            var iplImagePtr = CvInvoke.cvLoadImage(fileName, imageLoadType);
            var image       = (*iplImagePtr).AsImage((_) =>
            {
                if (iplImagePtr == null)
                {
                    return;
                }
                CvInvoke.cvReleaseImage(ref iplImagePtr);
            });

            return(image);
        }
Пример #3
0
        unsafe static TColor[,] decodeImage <TColor>(byte[] encodedImage, ImageLoadType loadType)
        where TColor : unmanaged, IColor
        {
            CvMat *matDecoded;

            fixed(byte *encodedImPtr = encodedImage)
            {
                CvMat mat = CvMat.FromUserData((IntPtr)encodedImPtr, encodedImage.Length, 1, encodedImage.Length, CvMat.CvChannelDepth.CV_8U, 1);

                matDecoded = CvInvoke.cvDecodeImageM(&mat, ImageLoadType.Color);
            }

            var imDecoded = (*matDecoded).ToArray <TColor>();

            CvInvoke.cvReleaseMat(ref matDecoded);

            return(imDecoded);
        }
Пример #4
0
        private void changeImageLoadAspectFitter(ImageLoadType imageLoadType)
        {
            switch (imageLoadType)
            {
            case ImageLoadType.WIDTH_PARENT:
                aspectRatioFitter.aspectMode = AspectRatioFitter.AspectMode.WidthControlsHeight;
                break;

            case ImageLoadType.HEIGHT_PARENT:
                aspectRatioFitter.aspectMode = AspectRatioFitter.AspectMode.HeightControlsWidth;
                break;

            case ImageLoadType.FILL:
                aspectRatioFitter.aspectMode = AspectRatioFitter.AspectMode.EnvelopeParent;
                break;

            case ImageLoadType.AUTO_FIT:
                aspectRatioFitter.aspectMode = AspectRatioFitter.AspectMode.FitInParent;
                break;
            }
        }
Пример #5
0
        public static void SetImage(this UIImageView current, string url, ImageLoadType type = ImageLoadType.Xamarin,
                                    Action success          = null, Action <Exception> error = null, Action startLoading = null,
                                    string imagePlaceholder = "error_placeholder.png", bool showLoadIndicator = true,
                                    UIActivityIndicatorViewStyle loadIndicatorType = UIActivityIndicatorViewStyle.Gray)
        {
            if (url.IsNullOrWhiteSpace())
            {
                AppTools.InvokeOnMainThread(() =>
                {
                    current.Image = null;
                });

                return;
            }

            var activityIndicator = PrepareImageView(current, showLoadIndicator, loadIndicatorType);

            TaskParameter loader = null;

            if (!url.Contains("http"))
            {
                loader = ImageService.Instance.LoadCompiledResource(url);
            }
            else
            {
                loader = ImageService.Instance.LoadUrl(url);
            }

            if (url.Contains(".svg"))
            {
                loader
                .WithCustomDataResolver(new SvgDataResolver(200, 0, true))
                .WithCustomLoadingPlaceholderDataResolver(new SvgDataResolver(200, 0, true));
            }

            RunImageLoader(current, success, error, startLoading, imagePlaceholder, activityIndicator, loader);
        }
Пример #6
0
 public static extern IntPtr cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
Пример #7
0
 public static unsafe extern IplImage* cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
Пример #8
0
 public unsafe static extern CvMat *cvDecodeImageM(void *buffer, ImageLoadType loadType);
Пример #9
0
 public unsafe static extern IplImage *cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
Пример #10
0
 public static void ChangeImageLoadAspectFitter(ImageLoadType imageLoadType)
 {
     Instance?.changeImageLoadAspectFitter(imageLoadType);
 }
Пример #11
0
 public static void SetupController(TWLoadingImageLib backgroundLibrary, ImageLoadType imageLoadType = ImageLoadType.AUTO_FIT)
 {
     Instance?.setupController(backgroundLibrary, imageLoadType);
 }
 public static extern IntPtr cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
Пример #13
0
 public unsafe static extern CvMat* cvDecodeImageM(void* buffer, ImageLoadType loadType);