public void filter_RGB_Mode(ImageManipulatorType.Name color)
        {
            // letztes zwischengespeichertes Bild holen
            PixelState    state  = PixelState.getInstance();
            I_ImageObject imgObj = state.get_last();
            // Vergleichsliste mit RGB Klassen Typen erstellen
            List <ImageManipulatorType.Name> container = new List <ImageManipulatorType.Name>();

            container.Add(ImageManipulatorType.Name.RGB_BLUE);
            container.Add(ImageManipulatorType.Name.RGB_RED);
            container.Add(ImageManipulatorType.Name.RGB_GREEN);

            // wenn das letzte zwischengespeicherte Bild mit dieser funktion verändert wurde
            if (container.Contains(imgObj.get_ImageManipulatorType()))
            {
                /* dann diese Veränderung rückgängig machen, da ansonsten das Bild schwarz wird.
                 * 2 aufeinander folgende Kanal filter => schwarzes bild, da jeweils 2 Farbkanäle
                 * pro Funktions aufruf auf 0 gesetzt werden. Nach 2 Funktionsaufrufen sind also
                 * alle Kanäle 0 was schwarzes Bild ergibt.
                 */
                this.undo();
            }

            state.add(new ImageObject(pic.Image, color));

            ThreadHandler thHandler = new ThreadHandler(threads);

            new ImageManipulator((Bitmap)pic.Image, color, thHandler).perform();
            this.show_picture(thHandler);
        }
Exemplo n.º 2
0
        /*
         * Wenn ok button geklickt wurde, bild in das hauptformular übernehmen.
         */
        public void set_Webcam_picture(KeyValuePair <int, string> src)
        {
            // wenn aufnahme geräate verfügbar
            if (capture_possible)
            {
                Image image = model.get_Image();
                // Bild eventuell noch nicht vorhanden, wenn Webcam
                // noch nicht initialisiert
                if (image != null)
                {
                    pic.Image = image;

                    mainForm.setPictureBoxSize(pic.Image);
                    pic.Refresh();
                    // menüs freischalten
                    mainForm.enable_filter_menue();
                    mainForm.enable_edit_menue();
                    mainForm.enable_menue();
                    // Bild zwischenspeichern
                    PixelState state = PixelState.getInstance();
                    state.set_pictureBox(pic);
                    state.reset();
                }
                else
                {
                    MessageBox.Show("Bitte auf Geräteinitialisierung warten.");
                }
            }
            else
            {
                MessageBox.Show("Kein Eingabegerät vorhanden.");
            }
            this.stop_capture();
        }
 private void init()
 {
     try
     {
         pic = PixelState.getInstance().get_pictureBox();
     }
     catch { throw new EmptyPictureBoxException("Before initializing this controller, initialize PictureBox attribute of class PixelState first!"); }
 }
Exemplo n.º 4
0
        private void histogrammToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PixelState.getInstance().set_pictureBox(pictureBox1);
            StatistikController con = StatistikController.getInstance();

            con.setMainForm(this);
            con.openStatistikWindow();
        }
Exemplo n.º 5
0
        private void webcamPictureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PixelState.getInstance().set_pictureBox(pictureBox1);
            WebcamController con = WebcamController.getInstance();

            con.setMainForm(this);
            con.openWebcamWindow();
        }
        public void filter(ImageManipulatorType.Name name)
        {
            PixelState.getInstance().add(new ImageObject(pic.Image, name));
            ThreadHandler thHandler = new ThreadHandler(threads);

            new ImageManipulator((Bitmap)pic.Image, name, thHandler).perform();
            this.show_picture(thHandler);
        }
Exemplo n.º 7
0
 public Form1()
 {
     InitializeComponent();
     this.fb = new FacebookClient();
     // PixelState als ERSTES initialisieren, da pictureBox beim initialisieren der
     // controller Klassen gebraucht wird. Ansonsten EmptyPixelState exception.
     PixelState.getInstance().set_pictureBox(pictureBox1);
     manipulateCon = ManipulationController.getInstance();
     manipulateCon.setMainForm(this);
 }
        public void filter_Sample_Board(int count)
        {
            PixelState state = PixelState.getInstance();

            state.add(new ImageObject(pic.Image, ImageManipulatorType.Name.SAMPLE_BOARD));
            ThreadHandler thHandler = new ThreadHandler(threads);

            int[] colors = new int[1] {
                count
            };
            new ImageManipulator((Bitmap)pic.Image, ImageManipulatorType.Name.SAMPLE_BOARD, thHandler, colors).perform();
            this.show_picture(thHandler);
        }
        private void try_save_PixelState(ImageObject imgObj)
        {
            // solange noch nicht alle Threads beendet wurden -> warten
            while (this.threadsAreAlive())
            {
                // bg_filter_thread
                Thread.Sleep(2);
            }
            // PixelState Objekt besorgen
            PixelState state = PixelState.getInstance();

            // ab hier Thread sicher speichern
            lock (_locker)
            {
                state.add(imgObj);
            }
        }
 public void filter_rotate(RotateFlipType type)
 {
     ImageManipulatorType.Name name = ImageManipulatorType.Name.ROTATE;
     PixelState.getInstance().add(new ImageObject(pic.Image, name));
     RotateFilter.rotate((Bitmap)pic.Image, type);
 }
 public void reset_pixel_state()
 {
     PixelState.getInstance().reset();
 }
 //@todo
 public void undo( )
 {
     pic.Image = PixelState.getInstance().remove_last().get_Image();
 }