Ejemplo n.º 1
0
        // Construct from image
        public ImageHandlerForm(Bitmap image, IDocumentsHost host)
            : this(host)
        {
            this.image = image;
            AForge.Imaging.Image.FormatImage(ref this.image);

            Init();
        }
Ejemplo n.º 2
0
        // Construct from file
        public ImageHandlerForm(string fileName, IDocumentsHost host)
            : this(host)
        {
            try
            {
                // load image
                image = (Bitmap)System.Drawing.Bitmap.FromFile(fileName);

                // format image
                AForge.Imaging.Image.FormatImage(ref image);

                this.fileName = fileName;
            }
            catch (Exception) { ((MainForm)host).ReadyToolStripStatusLabel.Text = "Failed loading image"; }
            Init();
        }
Ejemplo n.º 3
0
        // Constructors
        public FourierDoc( ComplexImage image, IDocumentsHost host )
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent( );

            //
            this.host = host;
            this.image = image;

            width = image.Width;
            height = image.Height;

            UpdateNewImage( );

            // form style
            SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true );

            // init scroll bars
            this.AutoScroll = true;
            // scroll bar size
            this.AutoScrollMinSize = new Size( width, height );
        }
Ejemplo n.º 4
0
        // Constructors
        public FourierDoc(ComplexImage image, IDocumentsHost host)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent( );

            //
            this.host  = host;
            this.image = image;

            width  = image.Width;
            height = image.Height;

            UpdateNewImage( );

            // form style
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true);

            // init scroll bars
            this.AutoScroll = true;
            // scroll bar size
            this.AutoScrollMinSize = new Size(width, height);
        }
Ejemplo n.º 5
0
 // Constructors
 private ImageHandlerForm(IDocumentsHost host)
 {
     this.host = host;
     ((MainForm)host).IHFList.Add(this);
 }
Ejemplo n.º 6
0
        // Construct from file
        public ImageDoc( string fileName, IDocumentsHost host )
            : this(host)
        {
            try
            {
                // load image
                image = (Bitmap) Bitmap.FromFile( fileName );

                // format image
                AForge.Imaging.Image.FormatImage( ref image );

                this.fileName = fileName;
            }
            catch ( Exception )
            {
                throw new ApplicationException( "Failed loading image" );
            }

            Init( );
        }
Ejemplo n.º 7
0
 // Constructors
 private ImageDoc( IDocumentsHost host )
 {
     this.host = host;
 }
Ejemplo n.º 8
0
        // Construct from image
        public ImageDoc( Bitmap image, IDocumentsHost host ) : this( host )
        {
            this.image = image;

            if ( !AForge.Imaging.Image.IsGrayscale( this.image ) )
            {
                this.image = AForge.Imaging.Image.Clone( image, PixelFormat.Format24bppRgb );
            }

            Init( );
        }
Ejemplo n.º 9
0
        // Construct from file
        public ImageDoc( string fileName, IDocumentsHost host ) : this( host )
        {
            FileStream stream = null;
            try
            {
                // read image to temporary memory stream
                // (.NET locks any stream until bitmap is disposed,
                // so that is why this work around is required)
                stream = File.OpenRead( fileName );
                MemoryStream memoryStream = new MemoryStream( );

                byte[] buffer = new byte[10000];
                while ( true )
                {
                    int read = stream.Read( buffer, 0, 10000 );

                    if ( read == 0 )
                        break;

                    memoryStream.Write( buffer, 0, read );
                }

                image = (Bitmap) Bitmap.FromStream( memoryStream );

                // format image
                if ( !AForge.Imaging.Image.IsGrayscale( image ) && ( image.PixelFormat != PixelFormat.Format24bppRgb ) )
                {
                    Bitmap temp = AForge.Imaging.Image.Clone( image, PixelFormat.Format24bppRgb );
                    image.Dispose( );
                    image = temp;
                }


                this.fileName = fileName;
            }
            catch ( Exception )
            {
                throw new ApplicationException( "Failed loading image" );
            }
            finally
            {
                if ( stream != null )
                {
                    stream.Close( );
                    stream.Dispose( );
                }
            }

            Init( );
        }
Ejemplo n.º 10
0
        // Construct from file
        public ImageDoc( string fileName, IDocumentsHost host ) : this( host )
        {
            try
            {
                image = LoadImageFromFile( fileName );

                // format image
                if ( !AForge.Imaging.Image.IsGrayscale( image ) && ( image.PixelFormat != PixelFormat.Format24bppRgb ) )
                {
                    Bitmap temp = AForge.Imaging.Image.Clone( image, PixelFormat.Format24bppRgb );
                    image.Dispose( );
                    image = temp;
                }

                this.fileName = fileName;
            }
            catch ( Exception )
            {
                throw new ApplicationException( "Failed loading image" );
            }

            Init( );
        }
Ejemplo n.º 11
0
 private void ImageDoc(IDocumentsHost host)
 {
     this.host = host;
 }
Ejemplo n.º 12
0
        // Constructors
        private ImageDoc( IDocumentsHost host )
        {
            this.host = host;

            //SS: экземпляр класса для ведения логов
            logger = new Logger(this);
        }