Esempio n. 1
0
        override public bool Execute()
        {
            double x1 = _from.GetValueAsDouble("Hrzn");
            double y1 = _from.GetValueAsDouble("Vrtc");

            double x2 = _to.GetValueAsDouble("Hrzn");
            double y2 = _to.GetValueAsDouble("Vrtc");

            Console.WriteLine("from ({0}, {1}) to ({2}, {3})", x1, y1, x2, y2);

            // Fix me!
            GradientType gradientType;

            switch (_type.Value)
            {
            case "Lnr":
                gradientType = GradientType.Linear;
                break;

            default:
                Console.WriteLine("Gradient-2: " + _type.Value);
                gradientType = GradientType.Linear;
                break;
            }

            Gradient gradient;

            if (_gradient != null)
            {
                string name = _gradient.GetValueAsString("Nm");
                Console.WriteLine("Name: " + name);
                ListParameter colors = _gradient.Parameters["Clrs"] as ListParameter;

                gradient = CreateGradient(name, colors);
            }
            else if (_with != null)
            {
                gradient = CreateGradient("Photoshop.Temp", _with);
            }
            else
            {
                Console.WriteLine("Gradient-3");
                return(false);
            }

            Context.Push();
            Context.Gradient = gradient;
            ActiveDrawable.EditBlend(BlendMode.Custom, LayerModeEffects.Normal,
                                     gradientType, 100.0, 0.0, RepeatMode.None,
                                     false, false, 0, 0, _dither,
                                     x1, y1, x2, y2);
            Context.Pop();

            return(true);
        }
Esempio n. 2
0
        protected override IEnumerable ListParameters()
        {
            ObjcParameter objc = Parameters["Ofst"] as ObjcParameter;

            if (objc != null)
            {
                yield return("Offset");
            }

            DoubleParameter width = Parameters["Wdth"] as DoubleParameter;

            if (width != null)
            {
                yield return(width.Format());
            }

            ObjcParameter position = Parameters["Pstn"] as ObjcParameter;

            if (position != null)
            {
                if (position.Contains("Hrzn"))
                {
                    _horizontal = position.GetValueAsDouble("Hrzn");
                }
                if (position.Contains("Vrtc"))
                {
                    _vertical = position.GetValueAsDouble("Vrtc");
                }
                yield return(String.Format("Position: {0}, {1}", _horizontal,
                                           _vertical));
            }

            BoolParameter relative = Parameters["Rltv"] as BoolParameter;

            if (relative != null)
            {
                yield return(relative.Format("Relative"));
            }
        }
Esempio n. 3
0
 protected override IEnumerable ListParameters()
 {
     if (_adjustment != null)
     {
         ObjcParameter objc = _adjustment[0] as ObjcParameter;
         if (objc.Contains("Gmm"))
         {
             yield return("Gamma: " + objc.GetValueAsDouble("Gmm"));
         }
         if (objc.Contains("Chnl"))
         {
             ReferenceParameter channel = objc.Parameters["Chnl"] as
                                          ReferenceParameter;
             string value = (channel.Set[0] as EnmrType).Value;
             yield return(String.Format("{0}: {1}",
                                        Abbreviations.Get("Chnl"),
                                        Abbreviations.Get(value)));
         }
     }
 }
Esempio n. 4
0
 public SelectPointEvent(SelectionEvent srcEvent, ObjcParameter objc) :
     base(srcEvent)
 {
     _coordinate = new Coordinate <double>(objc.GetValueAsDouble("Hrzn"),
                                           objc.GetValueAsDouble("Vrtc"));
 }
Esempio n. 5
0
        override public bool Execute()
        {
            Context.Push();

            var drawable = ActiveImage.ActiveDrawable;

            if (_from == null && _mode == null)
            {
                FillType fillType;
                switch (_using.Value)
                {
                case "BckC":
                    fillType = FillType.Background;
                    break;

                case "Blck":
                    Context.Foreground = new RGB(0, 0, 0);
                    fillType           = FillType.Foreground;
                    break;

                case "FrgC":
                    fillType = FillType.Foreground;
                    break;

                case "Ptrn":
                    fillType = FillType.Pattern;
                    break;

                case "Wht":
                    Context.Foreground = new RGB(255, 255, 255);
                    fillType           = FillType.Foreground;
                    break;

                default:
                    Console.WriteLine("FillEvent-1: with {0} not supported!",
                                      _using.Value);
                    return(false);
                }

                drawable.EditFill(fillType);
            }
            else
            {
                var    layerMode = LayerModeEffects.Normal;
                double x, y;

                if (_mode != null)
                {
                    switch (_mode.Value)
                    {
                    case "Mltp":
                        layerMode = LayerModeEffects.Multiply;
                        break;

                    case "Nrml":
                        layerMode = LayerModeEffects.Normal;
                        break;

                    default:
                        Console.WriteLine("FillEvent-2: with {0} not supported!",
                                          _mode.Value);
                        break;
                    }
                    x = y = 0;
                }
                else
                {
                    x = _from.GetValueAsDouble("Hrzn");
                    y = _from.GetValueAsDouble("Vrtc");
                }

                BucketFillMode fillMode;

                switch (_using.Value)
                {
                case "BckC":
                    fillMode = BucketFillMode.Background;
                    break;

                case "Blck":
                    Context.Foreground = new RGB(0, 0, 0);
                    fillMode           = BucketFillMode.Foreground;
                    break;

                case "FrgC":
                    fillMode = BucketFillMode.Foreground;
                    break;

                case "Ptrn":
                    fillMode = BucketFillMode.Pattern;
                    break;

                case "Wht":
                    Context.Foreground = new RGB(255, 255, 255);
                    fillMode           = BucketFillMode.Foreground;
                    break;

                default:
                    Console.WriteLine("FillEvent-3: with {0} not supported!",
                                      _using.Value);
                    return(false);
                }

                drawable.EditBucketFill(fillMode, layerMode,
                                        _opacity, _tolerance, false, true,
                                        SelectCriterion.Composite, x, y);
            }

            Context.Pop();

            return(true);
        }
Esempio n. 6
0
 public SelectPointEvent(SelectionEvent srcEvent, ObjcParameter objc)
     : base(srcEvent)
 {
     _coordinate = new Coordinate<double>(objc.GetValueAsDouble("Hrzn"),
                objc.GetValueAsDouble("Vrtc"));
 }