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

            Init();
        }
        // 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();
        }
示例#3
0
文件: FourierDoc.cs 项目: jdilt/iplab
        // 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 );
        }
示例#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);
        }
 // Constructors
 private ImageHandlerForm(IDocumentsHost host)
 {
     this.host = host;
     ((MainForm)host).IHFList.Add(this);
 }
示例#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( );
        }
示例#7
0
 // Constructors
 private ImageDoc( IDocumentsHost host )
 {
     this.host = host;
 }
示例#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( );
        }
示例#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( );
        }
示例#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( );
        }
示例#11
0
 private void ImageDoc(IDocumentsHost host)
 {
     this.host = host;
 }
示例#12
0
        // Constructors
        private ImageDoc( IDocumentsHost host )
        {
            this.host = host;

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