コード例 #1
0
        /// <summary>
        /// Creates the image and returned new path
        /// </summary>
        private string CreateProcessedImage(string folder, string source)
        {
            // Creating new image path
            string newImagePath = CreateNewPath(folder, source);
            // Processing image
            var processedImage = ImageCollection.GetProcessed(new BitmapImage(new Uri(source)), Effects);

            // Saving the processed picture
            ImageCollection.Save(processedImage, newImagePath);
            return(newImagePath);
        }
コード例 #2
0
        private void UpdateImages()
        {
            try
            {
                ValidateViewsEnablity();
                // updating data if have parced images
                if (GetCountOfParcedImages(MarkerType) > 0)
                {
                    // Getting source image
                    string      pathToSource = GetPathToImage(CurrentImageNumber - 1, MarkerType);
                    BitmapImage sourceImage  = new BitmapImage(new Uri(pathToSource));

                    // Drawing markers
                    BitmapImage markedImage;
                    if (MarkerType == MARKER_TYPE_FRAME)
                    {
                        markedImage = ImageCollection.GetFramed(CurrentImageNumber - 1);
                    }
                    else
                    {
                        markedImage = ImageCollection.GetMasks(CurrentImageNumber - 1, UserData.CroppingType)[0];
                    }
                    // Processing effcts
                    BitmapImage processedImage = ImageCollection.GetProcessed(markedImage, Effects);

                    PathToCurrentImage = pathToSource;
                    MainImageSource    = sourceImage;
                    EditedImageSource  = processedImage;

                    // Disposing the memory
                    GC.Collect();
                }
            }
            catch (Exception e)
            {
                string           messageBoxText = e.Message;
                string           caption        = "Couldn't open image";
                MessageBoxButton button         = MessageBoxButton.OK;
                MessageBoxImage  icon           = MessageBoxImage.Error;
                System.Windows.MessageBox.Show(messageBoxText, caption, button, icon);
                ResetViews();
            }
        }