예제 #1
0
        private void buttonMakeCensor_Click(object sender, RoutedEventArgs e)
        {
            //translate global positioning into imageVideoPreview positioning
            Point selectionStart = SelectionRectangle.TranslatePoint(
                new Point(0, 0), imageVideoPreview);

            int beginY         = (int)selectionStart.Y;
            int endY           = beginY + (int)SelectionRectangle.Height;
            int beginX         = (int)selectionStart.X;
            int endX           = beginX + (int)SelectionRectangle.Width;
            int beginSelection = (int)sliderCensorStart.Value;
            int endSelection   = (int)sliderCensorStop.Value;


            if (sliderCensorStop.Value > sliderCensorStart.Value)
            {
                Selections selectedCensor = new Selections(
                    beginX,
                    endX,
                    beginY,
                    endY,
                    beginSelection,
                    endSelection,
                    temporaryFilesPath);

                buttonMakeCensor.IsEnabled = false;
                censoredSelections.Add(selectedCensor);
                workToDo = Work.MakeCensor;
                bw.RunWorkerAsync();
            }
            else
            {
                MessageBoxResult result = MessageBox.Show("Censor start must be greater than Censor stop");
            }
        }
예제 #2
0
        private void MakeCensorProcess(BackgroundWorker worker)
        {
            Selections lastSelection = censoredSelections[censoredSelections.Count - 1];

            for (int actualSelection = lastSelection.BeginSelection;
                 actualSelection <= lastSelection.EndSelection; actualSelection++)
            {
                ModifyImage modification = new ModifyImage(actualSelection, lastSelection, false);
                modification.pixelateSize = pixelate;
                modification.StartModification();
                if (PassException.exceptionThrown != null)
                {
                    break;
                }
                int framesAmount       = lastSelection.EndSelection - lastSelection.BeginSelection;
                int frameNumber        = actualSelection - lastSelection.BeginSelection;
                int progressCalculated = CalculateProgress.Calculate(frameNumber, framesAmount);
                worker.ReportProgress(progressCalculated);
            }
        }
예제 #3
0
파일: ModifyImage.cs 프로젝트: wite/Censor
        public ModifyImage(int actualSelection, Selections selectionData, bool customColor)
        {
            this.beginX             = selectionData.beginX;
            this.endX               = selectionData.endX;
            this.beginY             = selectionData.beginY;
            this.endY               = selectionData.endY;
            this.temporaryFilesPath = selectionData.temporaryFilesPath;
            this.actualSelection    = actualSelection;

            if (customColor == true)
            {
                setColor = SetColor.custom;
            }
            else
            {
                setColor = SetColor.fromImage;
            }

            loadedBitmap         = new LoadBitmap(actualSelection, temporaryFilesPath);
            this.bitmapFromInput = loadedBitmap.BitmapFromStream;
        }