Exemple #1
0
        private RasterToLaserForm(GrblCore core, string filename)
        {
            InitializeComponent();

            IP = new ImageProcessor(core, filename, PbConverted.Size);
            PbOriginal.Image                   = IP.Original;
            ImageProcessor.PreviewReady       += OnPreviewReady;
            ImageProcessor.PreviewBegin       += OnPreviewBegin;
            ImageProcessor.GenerationComplete += OnGenerationComplete;

            LblGrayscale.Visible = CbMode.Visible = !IP.IsGrayScale;

            CbResize.SuspendLayout();
            CbResize.Items.Add(InterpolationMode.HighQualityBicubic);
            CbResize.Items.Add(InterpolationMode.NearestNeighbor);
            CbResize.ResumeLayout();

            CbDither.SuspendLayout();
            foreach (ImageTransform.DitheringMode formula in Enum.GetValues(typeof(ImageTransform.DitheringMode)))
            {
                CbDither.Items.Add(formula);
            }
            CbDither.SelectedIndex = 0;
            CbDither.ResumeLayout();
            CbDither.SuspendLayout();

            CbMode.SuspendLayout();
            foreach (ImageTransform.Formula formula in Enum.GetValues(typeof(ImageTransform.Formula)))
            {
                CbMode.Items.Add(formula);
            }
            CbMode.SelectedIndex = 0;
            CbMode.ResumeLayout();
            CbDirections.SuspendLayout();

            foreach (ImageProcessor.Direction direction in Enum.GetValues(typeof(ImageProcessor.Direction)))
            {
                if (direction != ImageProcessor.Direction.None)
                {
                    CbDirections.Items.Add(direction);
                }
            }
            CbDirections.SelectedIndex = 0;
            CbDirections.ResumeLayout();

            CbFillingDirection.SuspendLayout();
            foreach (ImageProcessor.Direction direction in Enum.GetValues(typeof(ImageProcessor.Direction)))
            {
                CbFillingDirection.Items.Add(direction);
            }
            CbFillingDirection.SelectedIndex = 0;
            CbFillingDirection.ResumeLayout();

            RbLineToLineTracing.Visible = supportPWM;

            LoadSettings();
            RefreshVE();
        }
        private RasterToLaserForm(GrblCore core, string filename, bool append)
        {
            InitializeComponent();
            mCore = core;

            UDQuality.Maximum = UDFillingQuality.Maximum = GetMaxQuality();

            BackColor = ColorScheme.FormBackColor;
            GbCenterlineOptions.ForeColor = GbConversionTool.ForeColor = GbLineToLineOptions.ForeColor = GbParameters.ForeColor = GbVectorizeOptions.ForeColor = ForeColor = ColorScheme.FormForeColor;
            BtnCancel.BackColor           = BtnCreate.BackColor = ColorScheme.FormButtonsColor;

            IP = new ImageProcessor(core, filename, GetImageSize(), append);
            //PbOriginal.Image = IP.Original;
            ImageProcessor.PreviewReady       += OnPreviewReady;
            ImageProcessor.PreviewBegin       += OnPreviewBegin;
            ImageProcessor.GenerationComplete += OnGenerationComplete;

            LblGrayscale.Visible = CbMode.Visible = !IP.IsGrayScale;

            CbResize.SuspendLayout();
            CbResize.AddItem(InterpolationMode.HighQualityBicubic);
            CbResize.AddItem(InterpolationMode.NearestNeighbor);
            CbResize.ResumeLayout();

            CbDither.SuspendLayout();
            foreach (ImageTransform.DitheringMode formula in Enum.GetValues(typeof(ImageTransform.DitheringMode)))
            {
                CbDither.Items.Add(formula);
            }
            CbDither.SelectedIndex = 0;
            CbDither.ResumeLayout();
            CbDither.SuspendLayout();

            CbMode.SuspendLayout();
            foreach (ImageTransform.Formula formula in Enum.GetValues(typeof(ImageTransform.Formula)))
            {
                CbMode.AddItem(formula);
            }
            CbMode.SelectedIndex = 0;
            CbMode.ResumeLayout();

            CbDirections.SuspendLayout();
            foreach (ImageProcessor.Direction direction in Enum.GetValues(typeof(ImageProcessor.Direction)))
            {
                if (GrblFile.RasterFilling(direction))
                {
                    CbDirections.AddItem(direction, true);
                }
            }
            CbDirections.SelectedIndex = 0;
            CbDirections.ResumeLayout();

            CbFillingDirection.SuspendLayout();
            CbFillingDirection.AddItem(ImageProcessor.Direction.None);
            foreach (ImageProcessor.Direction direction in Enum.GetValues(typeof(ImageProcessor.Direction)))
            {
                if (GrblFile.VectorFilling(direction))
                {
                    CbFillingDirection.AddItem(direction);
                }
            }
            foreach (ImageProcessor.Direction direction in Enum.GetValues(typeof(ImageProcessor.Direction)))
            {
                if (GrblFile.RasterFilling(direction))
                {
                    CbFillingDirection.AddItem(direction);
                }
            }
            CbFillingDirection.SelectedIndex = 0;
            CbFillingDirection.ResumeLayout();

            RbLineToLineTracing.Visible = supportPWM;

            LoadSettings();
            RefreshVE();
        }