示例#1
0
        public ProgressDialog(MosaicData mData)
        {
            InitializeComponent();

            InitBackgroundWorker();

            Utility.SetEnabled(Btn_OK, false);

            _mData = mData ??
                     throw new ArgumentNullException("mData");

            Size newSize = Utility.GetNewImageSize(_mData.LoadedImage.Size,
                                                   _mData.ElementSize);

            _pData = new ProgressData(this, newSize, _mData.ElementSize);

            SetMaxProgress();

            BW_Builder.RunWorkerAsync();
        }
示例#2
0
        private void Btn_Generate_Click(object sender, EventArgs e)
        {
            MosaicData mData = new MosaicData(
                Checked_Elements.CheckedItems, _nameToPath,
                Utility.GetElementSize(Picture_Loaded.Image.Size,
                                       Radio_1, Radio_4, Radio_8, Radio_16, Radio_32, Radio_64),
                (Bitmap)Picture_Loaded.Image);

            using (ProgressDialog dialog = new ProgressDialog(mData))
            {
                DialogResult result = dialog.ShowDialog();

                if (result != DialogResult.OK)
                {
                    return;
                }

                ReplaceImage(Picture_Preview, dialog.MosaicImage);
            }

            Utility.SetEnabled(Btn_Save, Actions_Save, _Btn_Save_Enable);
        }
示例#3
0
        public ImageResizer(MosaicData mData, ProgressData pData)
        {
            if (mData == null)
            {
                throw new ArgumentNullException("mData");
            }

            _pData = pData ??
                     throw new ArgumentNullException("pData");

            _paths = mData.Paths;

            ResizedImage  = mData.LoadedImage;
            OriginalSize  = ResizedImage.Size;
            ElementPixels = new List <ColorBlock>(_paths.Count);

            // Prefill the list

            for (int i = 0; i < _paths.Count; i++)
            {
                ElementPixels.Add(null);
            }
        }