예제 #1
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            DisposableHelper.TryDisposeAndSetToNull(ref m_blurEffect);
            DisposableHelper.TryDisposeAndSetToNull(ref m_downscaleEffect);
            DisposableHelper.TryDisposeAndSetToNull(ref m_downscaleCachingEffect);
            DisposableHelper.TryDisposeAndSetToNull(ref m_highPassBlendEffect);
            DisposableHelper.TryDisposeAndSetToNull(ref m_highPassGrayscaleEffect);
        }
예제 #2
0
        private async Task <SoftwareBitmap> LoadPhotoInternalAsync(IImageProvider unnormalizedSource)
        {
            DisposableHelper.TryDisposeAndSetToNull(ref m_source);

            var info = await unnormalizedSource.GetInfoAsync().AsTask().ConfigureAwait(false);

            var unnormalizedSourceSize = info.ImageSize;

            if ((uint)unnormalizedSourceSize.Width == 0 || (uint)unnormalizedSourceSize.Height == 0)
            {
                throw new ArgumentException("Image source appears to be zero sized.");
            }

            // Normalize source bitmap to ~5 MP
            m_sourceSize = NormalizeSourceSize(unnormalizedSourceSize);

            using (var bitmapRenderer = new SoftwareBitmapRenderer(unnormalizedSource))
            {
                bitmapRenderer.Size          = m_sourceSize;
                bitmapRenderer.OutputOption  = OutputOption.PreserveAspectRatio;
                bitmapRenderer.RenderOptions = RenderOptions.Cpu;

                var normalizedSourceBitmap = await bitmapRenderer.RenderAsync().AsTask().ConfigureAwait(false);

                m_source = new SoftwareBitmapImageSource(normalizedSourceBitmap);
            }

            using (var bitmapRenderer = new SoftwareBitmapRenderer(m_source))
            {
                bitmapRenderer.Size          = PreviewSize;
                bitmapRenderer.OutputOption  = OutputOption.PreserveAspectRatio;
                bitmapRenderer.RenderOptions = RenderOptions.Cpu;

                return(await bitmapRenderer.RenderAsync().AsTask().ConfigureAwait(false));
            }
        }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     DisposableHelper.TryDisposeAndSetToNull(ref m_lomoStack);
 }
 protected override void Dispose(bool disposing)
 {
     DisposableHelper.TryDisposeAndSetToNull(ref m_layerList);
 }