Example #1
0
        public Dialog(Image image, Drawable drawable, VariableSet variables) :
            base("Ministeck", drawable, variables, () => new DrawablePreview(drawable))
        {
            _image = image;

            var table = new GimpTable(2, 2)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            Vbox.PackStart(table, false, false, 0);

            var size = new GimpSpinButton(3, 100, 1, GetVariable <int>("size"));

            table.AttachAligned(0, 0, _("_Size:"), 0.0, 0.5, size, 2, true);

            var limit = new GimpCheckButton(_("_Limit Shapes"),
                                            GetVariable <bool>("limit"));

            table.Attach(limit, 2, 3, 0, 1);

            var colorButton = new GimpColorButton("", 16, 16, GetVariable <RGB>("color"),
                                                  ColorAreaType.Flat)
            {
                Update = true
            };

            table.AttachAligned(0, 1, _("C_olor:"), 0.0, 0.5, colorButton, 1, true);
        }
Example #2
0
        public Dialog(Drawable drawable, VariableSet variables) :
            base("QR", drawable, variables, () => new AspectPreview(drawable))
        {
            var table = new GimpTable(4, 2)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            var text = CreateText();

            table.Attach(text, 0, 2, 0, 2);

            var encoding = CreateOutputEncoding();

            table.Attach(encoding, 0, 1, 2, 3);

            var errorCorrection = CreateErrorCorrection();

            table.Attach(errorCorrection, 1, 2, 2, 3);

            CreateMargin(table);

            Vbox.PackStart(table, false, false, 0);

            InvalidatePreview();
        }
Example #3
0
        public ListComboBoxTouch(Window pSourceWindow, string pLabelText, List <string> pItemList, string pInitialValue, bool pAddUndefinedValue, bool pRequired)
            : base(pSourceWindow, pLabelText)
        {
            //Entry
            _listComboBox = new ListComboBox(pItemList, pInitialValue, pAddUndefinedValue, pRequired);
            _listComboBox.ComboBoxCell.FontDesc = _fontDescription;

            //Pack
            Vbox.PackStart(_listComboBox);
        }
Example #4
0
        public Dialog(Drawable drawable, VariableSet variables) :
            base("Mezzotint", drawable, variables,
                 () => new DrawablePreview(drawable))
        {
            var type = new GimpComboBox(GetVariable <int>("type"),
                                        new string[] { _("Fine dots"), _("Medium dots"), _("Grainy dots"),
                                                       _("Coarse dots"), _("Short lines"), _("Medium lines"),
                                                       _("Long lines"), _("Short strokes"), _("Medium strokes"),
                                                       _("Long strokes") });

            Vbox.PackStart(type, false, false, 0);
        }
Example #5
0
        public Dialog(Drawable drawable, VariableSet variables) :
            base("Shatter", drawable, variables, () => new AspectPreview(drawable))
        {
            var table = new GimpTable(4, 3, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            Vbox.PackStart(table, false, false, 0);

            new ScaleEntry(table, 0, 1, "Pieces:", 150, 3,
                           GetVariable <int>("pieces"), 1.0, 256.0, 1.0, 8.0, 0);
        }
Example #6
0
        public Dialog(Drawable drawable, VariableSet variables) :
            base(_("Forge"), drawable, variables, () => new AspectPreview(drawable))
        {
            _type = GetVariable <int>("type");

            var hbox = new HBox(false, 12);

            Vbox.PackStart(hbox);

            CreateTypeFrame(hbox);
            CreateRandomSeedEntry(hbox);
            CreateParametersTable();
        }
            /**
             * Split this color box at the mid-point along its longest dimension
             *
             * @return the new ColorBox
             */
            internal Vbox SplitBox()
            {
                if (!CanSplit())
                {
                    throw new Exception("Can not split a box with only 1 color");
                }
                // find median along the longest dimension
                int  splitPoint = FindSplitPoint();
                Vbox newBox     = new Vbox(splitPoint + 1, _upperIndex);

                // Now change this box's upperIndex and recompute the color boundaries
                _upperIndex = splitPoint;
                FitBox();
                return(newBox);
            }
Example #8
0
        public ListRadioButtonTouch(Window pSourceWindow, string pLabelText, List <string> pItemList, string pInitialValue, bool pRequired)
            : base(pSourceWindow, pLabelText)
        {
            _listRadioButton = new ListRadioButton(pItemList, pInitialValue);
            for (int i = 0; i < _listRadioButton.RadioButtonList.Count; i++)
            {
                _listRadioButton.RadioButtonList[i].Child.ModifyFont(_fontDescription);
            }

            //Pack
            EventBox evbox = new EventBox();

            evbox.Add(_listRadioButton);
            evbox.Add(Vbox);
            Vbox.BorderWidth = 5;
            Vbox.PackStart(evbox);
        }
        private List <Swatch> GenerateAverageColors(PriorityQueue <Vbox> vboxes)
        {
            List <Swatch> colors = new List <Swatch>();

            while (vboxes.Count > 0)
            {
                Vbox   vbox   = vboxes.Poll();
                Swatch swatch = vbox.GetAverageColor();
                if (!ShouldIgnoreColor(swatch))
                {
                    // As we're averaging a color box, we can still get colors which we do not want, so
                    // we check again here
                    colors.Add(swatch);
                }
            }
            return(colors);
        }
Example #10
0
        void CreateParametersTable()
        {
            var table = new GimpTable(4, 6)
            {
                ColumnSpacing = 10, RowSpacing = 10
            };

            Vbox.PackEnd(table);

            CreateDimensionEntry(table);
            CreatePowerEntry(table);
            CreateGlaciersEntry(table);
            CreateIceEntry(table);
            CreateHourEntry(table);
            CreateInclinationEntry(table);
            CreateStarPercentageEntry(table);
            CreateSaturationEntry(table);
        }
Example #11
0
            /**
             * Split this color box at the mid-point along it's longest dimension
             *
             * @return the new ColorBox
             */
            public Vbox splitBox()
            {
                if (!canSplit())
                {
                    throw new InvalidOperationException("Can not split a box with only 1 color");
                }

                // find median along the longest dimension
                int splitPoint = findSplitPoint();

                Vbox newBox = new Vbox(splitPoint + 1, upperIndex);

                // Now change this box's upperIndex and recompute the color boundaries
                upperIndex = splitPoint;
                fitBox();

                return(newBox);
            }
Example #12
0
        public Dialog(Image image, Drawable drawable, VariableSet variables) :
            base("Raindrops", drawable, variables, () => new AspectPreview(drawable))
        {
            _image = image;

            var table = new GimpTable(2, 2, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            Vbox.PackStart(table, false, false, 0);

            CreateDropSizeEntry(table);
            CreateNumberEntry(table);
            CreateFishEyeEntry(table);

            // variables.ValueChanged += delegate {InvalidatePreview();};
        }
Example #13
0
 /**
  * Iterate through the {@link java.util.Queue}, popping
  * {@link ColorCutQuantizer.Vbox} objects from the queue
  * and splitting them. Once split, the new box and the remaining box are offered back to the
  * queue.
  *
  * @param queue {@link java.util.PriorityQueue} to poll for boxes
  * @param maxSize Maximum amount of boxes to split
  */
 private void SplitBoxes(PriorityQueue <Vbox> queue, int maxSize)
 {
     while (queue.Count < maxSize)
     {
         Vbox vbox = queue.Poll();
         if (vbox != null && vbox.CanSplit())
         {
             // First split the box, and offer the result
             queue.Offer(vbox.SplitBox());
             // Then offer the box back
             queue.Offer(vbox);
         }
         else
         {
             // If we get here then there are no more boxes to split, so return
             return;
         }
     }
 }
Example #14
0
        public CheckButtonBoxGroup(string pLabelText, Dictionary <string, bool> pButtonGroup)
            : base(pLabelText)
        {
            VBox vbox = new VBox()
            {
                BorderWidth = 5
            };
            EventBox eventBox = new EventBox()
            {
                BorderWidth = 2
            };

            int key = -1;

            foreach (var item in pButtonGroup)
            {
                key++;

                //CheckButtonExtended
                CheckButtonExtended checkButtonExtended = new CheckButtonExtended(item.Key)
                {
                    Active = item.Value, Index = key
                };
                checkButtonExtended.Child.ModifyFont(_fontDescription);
                checkButtonExtended.Clicked += checkButtonExtended_Clicked;
                //Pack in local Vbox
                vbox.PackStart(checkButtonExtended);
                //Add to value List
                _buttons.Add(checkButtonExtended);
                //Add checkButton to items
                if (item.Value)
                {
                    _items.Add(key, checkButtonExtended);
                }
            }

            //Put in White EventBox
            eventBox.Add(vbox);

            //Pack in Base VBox
            Vbox.PackStart(eventBox);
        }
Example #15
0
        /// <summary>
        /// Iterate through the Queue, popping ColorCutQuantizer.Vbox objects from the queue and splitting them.
        /// Once split, the new box and the remaining box are offered back to the queue.
        /// </summary>
        /// <param name="queue">PriorityQueue to poll for boxes</param>
        /// <param name="maxSize">Maximum amount of boxes to split</param>
        private void SplitBoxes(MaxHeap <Vbox> queue, int maxSize)
        {
            while (queue.Count < maxSize)
            {
                Vbox vbox = queue.ExtractDominating();

                if (vbox != null && vbox.CanSplit())
                {
                    // First split the box, and offer the result
                    queue.Add(vbox.SplitBox());

                    // Then offer the box back
                    queue.Add(vbox);
                }
                else
                {
                    // If we get here then there are no more boxes to split, so return
                    return;
                }
            }
        }
Example #16
0
        public Dialog(Drawable drawable, VariableSet variables) :
            base(_("Swirlies"), drawable, variables, () => new AspectPreview(drawable))
        {
            _progress = new ProgressBar();
            Vbox.PackStart(_progress, false, false, 0);

            var table = new GimpTable(4, 3, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            Vbox.PackStart(table, false, false, 0);

            var seed = new RandomSeed(GetVariable <UInt32>("seed"),
                                      GetVariable <bool>("random_seed"));

            table.AttachAligned(0, 0, _("Random _Seed:"), 0.0, 0.5, seed, 2, true);

            new ScaleEntry(table, 0, 1, _("Po_ints:"), 150, 3,
                           GetVariable <int>("points"), 1.0, 16.0, 1.0, 8.0, 0);
        }
Example #17
0
        public Dialog(Drawable drawable, VariableSet variables) :
            base("ncp", drawable, variables, () => new AspectPreview(drawable))
        {
            var table = new GimpTable(4, 3)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            Vbox.PackStart(table, false, false, 0);

            var pointsVariable = GetVariable <int>("points");
            var closest        = GetVariable <int>("closest");
            var color          = GetVariable <bool>("color");

            CreateRandomSeedWidget(table);
            CreatePointsWidget(table, pointsVariable);
            CreateClosestEntryWidget(table, closest, pointsVariable);
            CreateUseColorWidget(table, color);

            pointsVariable.ValueChanged += delegate {
                int points = pointsVariable.Value;
                if (points > _closestEntry.Upper)
                {
                    _closestEntry.Upper = points;
                }

                if (points < closest.Value)
                {
                    closest.Value       = points;
                    _closestEntry.Upper = closest.Value;
                    _closestEntry.Value = closest.Value;
                }
                else
                {
                    InvalidatePreview();
                }
            };
            closest.ValueChanged += delegate { InvalidatePreview(); };
            color.ValueChanged   += delegate { InvalidatePreview(); };
        }
Example #18
0
        /**
         * Iterate through the {@link java.util.Queue}, popping
         * {@link ColorCutQuantizer.Vbox} objects from the queue
         * and splitting them. Once split, the new box and the remaining box are offered back to the
         * queue.
         *
         * @param queue {@link java.util.PriorityQueue} to poll for boxes
         * @param maxSize Maximum amount of boxes to split
         */
        private Queue <Vbox> splitBoxes(Queue <Vbox> queue, int maxSize)
        {
            while (queue.Count < maxSize)
            {
                queue = new Queue <Vbox>(queue.OrderByDescending(v => v.getVolume()));
                Vbox vbox = queue.Dequeue();

                if (vbox != null && vbox.canSplit())
                {
                    // First split the box, and offer the result
                    queue.Enqueue(vbox.splitBox());
                    // Then offer the box back
                    queue.Enqueue(vbox);
                }
                else
                {
                    break;
                }
            }

            queue = new Queue <Vbox>(queue.OrderBy(v => v.getVolume()));
            return(queue);
        }
            /**
             * Split this color box at the mid-point along it's longest dimension
             *
             * @return the new ColorBox
             */
            public Vbox splitBox()
            {
                if (!canSplit())
                {
                    throw new InvalidOperationException("Can not split a box with only 1 color");
                }

                // find median along the longest dimension
                int splitPoint = findSplitPoint();

                Vbox newBox = new Vbox(splitPoint + 1, upperIndex);

                // Now change this box's upperIndex and recompute the color boundaries
                upperIndex = splitPoint;
                fitBox();

                return newBox;
            }