protected override bool CanDo(out ImageGrid currentState, out ImageGrid newState)
        {
            currentState = this.Project.ImageGrid;
            newState     = null;

            if (this.Project.Image == null)
            {
                this.CommandsInput.ShowMessage("Load an image or project to start");
                return(false);
            }

            if (this.Project.Palette.Count() < 2)
            {
                this.CommandsInput.ShowMessage("Select at least 2 colors for the pattern by clicking on the image");
                return(false);
            }

            if (this.Project.Width < 10)
            {
                this.CommandsInput.ShowMessage("Width must be at least 10");
                return(false);
            }

            this.CommandsInput.SetBusy(true);
            try
            {
                newState = ImageGridder.Create(this.Project.Width, this.Project.Image, this.Project.Palette);
                return(true);
            }
            finally
            {
                this.CommandsInput.SetBusy(false);
            }
        }
Esempio n. 2
0
        public static ImageGrid Create(int columns, Image originalImage, IEnumerable <IPaletteItem> palette)
        {
            ImageGridder gridder = new ImageGridder(columns);

            return(gridder.Load(originalImage, palette));
        }