private void setupController(TWLoadingImageLib loadImageLibrary, ImageLoadType imageLoadType) { aspectRatioFitter = loadImage.gameObject.GetComponent <AspectRatioFitter>(); this.loadImageLibrary = loadImageLibrary; changeImageLoadAspectFitter(imageLoadType); }
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); }
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); }
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; } }
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); }
public static extern IntPtr cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
public static unsafe extern IplImage* cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
public unsafe static extern CvMat *cvDecodeImageM(void *buffer, ImageLoadType loadType);
public unsafe static extern IplImage *cvLoadImage([MarshalAs(UnmanagedType.LPStr)] String filename, ImageLoadType loadType);
public static void ChangeImageLoadAspectFitter(ImageLoadType imageLoadType) { Instance?.changeImageLoadAspectFitter(imageLoadType); }
public static void SetupController(TWLoadingImageLib backgroundLibrary, ImageLoadType imageLoadType = ImageLoadType.AUTO_FIT) { Instance?.setupController(backgroundLibrary, imageLoadType); }
public unsafe static extern CvMat* cvDecodeImageM(void* buffer, ImageLoadType loadType);