Esempio n. 1
0
        /// <summary>
        /// Saves the cropped image to a stream with the specified format.
        /// </summary>
        /// <param name="stream">The target stream.</param>
        /// <param name="bitmapFileFormat">the specified format.</param>
        /// <returns>Task</returns>
        public async Task SaveAsync(IRandomAccessStream stream, BitmapFileFormat bitmapFileFormat)
        {
            if (SourceImage == null)
            {
                return;
            }
            var bitmapEncoder = await BitmapEncoder.CreateAsync(WriteableBitmapExtensions.GetEncoderId(bitmapFileFormat), stream);

            await WriteableBitmapExtensions.CropImageAsync(SourceImage, _currentCroppedRect, bitmapEncoder);
        }