Esempio n. 1
0
        private void preprocesadoBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            conometro.Start();

            if (perfilActual.preprocesado.redimensionarImagen)
            {
                double factorAlto  = 1.0;
                double factorAncho = 1.0;

                if (perfilActual.preprocesado.mantenerProporcion)
                {
                    if (perfilActual.preprocesado.cambiarAlto)
                    {
                        factorAlto  = ((double)perfilActual.preprocesado.pixelesAlto) / textoActual.GetAlto();
                        factorAncho = textoActual.GetAncho() * factorAlto / textoActual.GetAlto();
                    }
                    else
                    if (perfilActual.preprocesado.cambiarAncho)
                    {
                        factorAncho = ((double)perfilActual.preprocesado.pixelesAncho) / textoActual.GetAncho();
                        factorAlto  = textoActual.GetAlto() * factorAncho / textoActual.GetAncho();
                    }
                }
                else
                {
                    if (perfilActual.preprocesado.cambiarAlto)
                    {
                        factorAlto = ((double)perfilActual.preprocesado.pixelesAlto) / textoActual.GetAlto();
                    }

                    if (perfilActual.preprocesado.cambiarAncho)
                    {
                        factorAncho = ((double)perfilActual.preprocesado.pixelesAncho) / textoActual.GetAncho();
                    }
                }

                textoActual.Escalacion(factorAncho, factorAlto);
            }

            textoActual.Umbralizar(perfilActual.preprocesado.umbral);
            estadoImagen = EstadoImagen.umbralizada;

            if (perfilActual.preprocesado.enderezadoAutomatico)
            {
                textoActual.Enderezar();
            }

            conometro.Stop();
        }
Esempio n. 2
0
        public EscaladoForm(PrincipalForm Padre)
        {
            InitializeComponent();

            formPadre  = (PrincipalForm)Padre;
            copiaTexto = formPadre.textoActual;

            altoNumericUpDown.Value      = copiaTexto.GetAlto();
            anchoNumericUpDown.Value     = copiaTexto.GetAncho();
            proporcionesCheckBox.Checked = formPadre.perfilActual.preprocesado.mantenerProporcion;
        }
Esempio n. 3
0
        private void anchoNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            if (proporcionesCheckBox.Checked)
            {
                altoNumericUpDown.Value = (anchoNumericUpDown.Value * copiaTexto.GetAlto()) / copiaTexto.GetAncho();
            }

            if (previsualizarCheckBox.Checked)
            {
                if (formPadre.textoActual != copiaTexto)
                {
                    formPadre.textoActual.LiberarTextoManejado();
                }

                formPadre.textoActual = copiaTexto.Copia();

                formPadre.textoActual.Escalacion((double)anchoNumericUpDown.Value / copiaTexto.GetAncho(), (double)altoNumericUpDown.Value / copiaTexto.GetAlto());

                formPadre.CargarImagen();
            }
        }
Esempio n. 4
0
        private void lineasSegmentadasPictureBox_MouseClick(object sender, MouseEventArgs e)
        {
            int linea = textoEscalado.GetLinea(e.Y, e.X);

            textoEscalado.LiberarTextoManejado();

            if (fusionar)
            {
                if (lineaSeleccionada < linea)
                {
                    copiaTexto.Fusionar(lineaSeleccionada, linea);
                }
                else
                {
                    copiaTexto.Fusionar(linea, lineaSeleccionada);
                }
            }

            textoEscalado = copiaTexto.Copia();
            textoEscalado.EscalacionLineal(((double)lineasSegmentadasPictureBox.Size.Width) / copiaTexto.GetAncho(), ((double)lineasSegmentadasPictureBox.Size.Height) / copiaTexto.GetAlto());

            if (!fusionar && linea != -1 && linea != lineaSeleccionada)
            {
                textoEscalado.PintarLinea(linea);
                lineaSeleccionada = linea;
            }
            else
            {
                lineaSeleccionada = -1;
            }

            IntPtr ptrDIB;      //Puntero al DIB
            IntPtr ptrMapaBits; //Puntero al mapa de bits en sí (nos saltamos el bitmapinfoheader y la paleta, si la hay)

            unsafe              //Zona no segura (transformación de punteros C++ a C#)
            {
                ptrDIB = (IntPtr)textoEscalado.GetDIB();

                ptrMapaBits = (IntPtr)textoEscalado.GetMapaBits();
            }

            lineasSegmentadasPictureBox.Image = PrincipalForm.BitmapFromDIB(ptrDIB, ptrMapaBits);

            fusionar = false;
        }
Esempio n. 5
0
        public ArreglarLineasForm(PrincipalForm Padre)
        {
            InitializeComponent();

            lineaSeleccionada = -1;
            fusionar          = false;

            formPadre     = (PrincipalForm)Padre;
            copiaTexto    = formPadre.textoSegmentado.Copia();
            textoEscalado = copiaTexto.Copia();

            textoEscalado.EscalacionLineal(((double)lineasSegmentadasPictureBox.Size.Width) / copiaTexto.GetAncho(), ((double)lineasSegmentadasPictureBox.Size.Height) / copiaTexto.GetAlto());

            IntPtr ptrDIB;      //Puntero al DIB
            IntPtr ptrMapaBits; //Puntero al mapa de bits en sí (nos saltamos el bitmapinfoheader y la paleta, si la hay)

            unsafe              //Zona no segura (transformación de punteros C++ a C#)
            {
                ptrDIB = (IntPtr)textoEscalado.GetDIB();

                ptrMapaBits = (IntPtr)textoEscalado.GetMapaBits();
            }

            lineasSegmentadasPictureBox.Image = PrincipalForm.BitmapFromDIB(ptrDIB, ptrMapaBits);
        }