示例#1
0
        protected override IEnumerable ListParameters()
        {
            ObjcParameter _using = Parameters["Usng"] as ObjcParameter;

            _using.Fill(this);
            yield return("Text: \"" + _text + "\"");
        }
示例#2
0
        CoordinateList <byte> GetControlPoints()
        {
            ObjcParameter objc = _adjustment[0] as ObjcParameter;

            ReferenceParameter obj = objc.Parameters["Chnl"] as
                                     ReferenceParameter;

            ListParameter curve = objc.Parameters["Crv"] as ListParameter;

            CoordinateList <byte> controlPoints = new CoordinateList <byte>();

            // Dirty hack. Fixme!
            if (curve == null)
            {
                return(controlPoints);
            }

            foreach (Parameter parameter in curve)
            {
                ObjcParameter point = parameter as ObjcParameter;
                double        x     =
                    (point.Parameters["Hrzn"] as DoubleParameter).Value;
                double y =
                    (point.Parameters["Vrtc"] as DoubleParameter).Value;

                controlPoints.Add(new Coordinate <byte>((byte)x, (byte)y));
            }

            return(controlPoints);
        }
示例#3
0
        override public bool Execute()
        {
            if (_adjustment != null)
            {
                ObjcParameter objc = _adjustment[0] as ObjcParameter;

                ReferenceParameter obj = objc.Parameters["Chnl"] as
                                         ReferenceParameter;
                string origChannel = (obj.Set[0] as EnmrType).Value;

                ListParameter curve = objc.Parameters["Crv"] as ListParameter;

                CoordinateList <byte> controlPoints = new CoordinateList <byte>();

                foreach (Parameter parameter in curve)
                {
                    ObjcParameter point = parameter as ObjcParameter;
                    double        x     =
                        (point.Parameters["Hrzn"] as DoubleParameter).Value;
                    double y =
                        (point.Parameters["Vrtc"] as DoubleParameter).Value;

                    controlPoints.Add(new Coordinate <byte>((byte)x, (byte)y));
                }

                HistogramChannel channel;

                switch (origChannel)
                {
                case "Cmps":
                    channel = HistogramChannel.Value;
                    break;

                case "Rd":
                    channel = HistogramChannel.Red;
                    break;

                case "Grn":
                    channel = HistogramChannel.Green;
                    break;

                case "Bl":
                    channel = HistogramChannel.Blue;
                    break;

                default:
                    Console.WriteLine("CurvesEvent: " + origChannel);
                    return(false);
                }

                ActiveDrawable.CurvesSpline(channel, controlPoints);
            }
            else
            {
                Console.WriteLine("CurvesEvent: adjustment == null?");
            }
            return(true);
        }
示例#4
0
        protected void GetBounds(ObjcParameter objc, out double x, out double y,
                                 out double width, out double height)
        {
            var    parameters = objc.Parameters;
            double top        = (parameters["Top"] as DoubleParameter).
                                GetPixels(ActiveImage.Height);
            double left = (parameters["Left"] as DoubleParameter).
                          GetPixels(ActiveImage.Width);
            double bottom = (parameters["Btom"] as DoubleParameter).
                            GetPixels(ActiveImage.Height);
            double right = (parameters["Rght"] as DoubleParameter).
                           GetPixels(ActiveImage.Width);

            x      = left;
            y      = top;
            width  = right - left;
            height = bottom - top;
        }
示例#5
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)));
         }
     }
 }
示例#6
0
        override public bool Execute()
        {
            if (Parameters["AuCo"] != null)
            {
                RunProcedure("plug_in_autostretch_hsv");
            }
            if (Parameters["autoBlackWhite"] != null)
            {
                Console.WriteLine("Levels:autoBlackWhite not implemented yet");
            }
            if (Parameters["autoNeutrals"] != null)
            {
                Console.WriteLine("Levels:autoNeutrals not implemented yet");
            }
            if (Parameters["Auto"] != null)
            {
                ActiveDrawable.LevelsStretch();
            }

            if (_adjustment != null)
            {
                ObjcParameter objc  = _adjustment[0] as ObjcParameter;
                double        gamma = (objc.Parameters["Gmm"] as DoubleParameter).Value;

                ReferenceParameter obj = objc.Parameters["Chnl"] as
                                         ReferenceParameter;
                string channel = (obj.Set[0] as EnmrType).Value;

                if (channel == "Cmps")
                {
                    ActiveDrawable.Levels(HistogramChannel.Value, 0, 255, gamma,
                                          0, 255);
                }
                else
                {
                    Console.WriteLine("LevelsEvent: " + channel);
                }
            }

            return(true);
        }
示例#7
0
        public override void Parse(ActionParser parser)
        {
            int number = parser.ReadInt32();

            DebugOutput.Dump("number: " + number);

            for (int i = 0; i < number; i++)
            {
                string type = parser.ReadFourByteString();
                DebugOutput.Dump("type: " + type);

                Parameter parameter = null;

                switch (type)
                {
                case "Objc":
                    parameter = new ObjcParameter();
                    break;

                case "long":
                    parameter = new LongParameter();
                    break;

                case "obj":
                    parameter = new ReferenceParameter();
                    break;

                default:
                    Console.WriteLine("ReadVlLs: type {0} unknown!", type);
                    return;
                }

                if (parameter != null)
                {
                    DebugOutput.Level++;
                    parameter.Parse(parser);
                    DebugOutput.Level--;
                    Set.Add(parameter);
                }
            }
        }
示例#8
0
        protected override IEnumerable ListParameters()
        {
            if (_gefs == null)
            {
                Console.WriteLine("FilterGalleryEvent-1");
                yield break;
            }

            foreach (Parameter parameter in _gefs)
            {
                if (parameter is ObjcParameter)
                {
                    ObjcParameter objc = parameter as ObjcParameter;
                    yield return(Abbreviations.Get(objc.GetValueAsString("GEfk")));
                }
                else
                {
                    Console.WriteLine("FilterGalleryEvent: " + parameter);
                }
            }
        }
示例#9
0
        override public ActionEvent Parse(ActionParser parser)
        {
            base.Parse(parser);

            if (_adjustment == null)
            {
                Console.WriteLine("HueSaturationEvent: implement colorization only");
            }
            else if (_adjustment.Count > 1)
            {
                Console.WriteLine("HueSaturationEvent: implement for > 1 params");
            }
            else if (_adjustment[0] is ObjcParameter)
            {
                ObjcParameter objc = _adjustment[0] as ObjcParameter;

                _hue        = (int)objc.GetValueAsLong("H");
                _saturation = (int)objc.GetValueAsLong("Strt");
                _lightness  = (int)objc.GetValueAsLong("Lght");
            }
            return(this);
        }
示例#10
0
        override public ActionEvent Parse(ActionParser parser)
        {
            if (_parameter is ObjcParameter)
            {
                ObjcParameter objc     = _parameter as ObjcParameter;
                string        classID2 = objc.ClassID2;

                switch (classID2)
                {
                case "Elps":
                    return(new SelectEllipseEvent(this, objc));

                case "Plgn":
                    return(new SelectPolygonEvent(this, objc));

                case "Pnt":
                    return(new SelectPointEvent(this, objc));

                case "Rctn":
                    return(new SelectRectangleEvent(this, objc));

                case "Sngc":
                    return(new SelectSingleRowEvent(this, objc));

                case "Sngr":
                    return(new SelectSingleRowEvent(this, objc));

                default:
                    Console.WriteLine("SelectionEvent Implement " + classID2);
                    break;
                }
            }
            else if (_parameter is EnumParameter)
            {
                string type = (_parameter as EnumParameter).Value;

                switch (type)
                {
                case "Al":
                    return(new SelectAllEvent(this));

                case "None":
                    return(new SelectNoneEvent(this));

                case "Prvs":
                    return(new SelectPreviousEvent(this));

                default:
                    Console.WriteLine("SelectionEvent-1: " + type);
                    break;
                }
            }
            else if (_parameter is ReferenceParameter)
            {
                ReferenceParameter enmr = _parameter as ReferenceParameter;

                if (enmr.Set[0] is EnmrType)
                {
                    EnmrType type = enmr.Set[0] as EnmrType;
                    switch (type.Key)
                    {
                    case "Chnl":
                        return(new SelectionFromChannelEvent(this, type.Value));

                    case "Pxel":
                        return(new SelectPixelEvent(this, type.Value));

                    default:
                        Console.WriteLine("SelectionEvent-3: " + type.Key);
                        break;
                    }
                }
                else if (enmr.Set[0] is IndexType)
                {
                    IndexType index = enmr.Set[0] as IndexType;
                    switch (index.Key)
                    {
                    case "Chnl":
                        return(new SelectionByIndexEvent(this, index.Index));

                    default:
                        Console.WriteLine("SelectionEvent-5: " + index.Key);
                        break;
                    }
                }
                else if (enmr.Set[0] is NameType)
                {
                    NameType name = enmr.Set[0] as NameType;
                    switch (name.ClassID2)
                    {
                    case "Chnl":
                        return(new SelectionFromChannelEvent(this, name.Key));

                    default:
                        Console.WriteLine("SelectionEvent-6: " + name.ClassID2);
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("SelectionEvent-4: " + enmr.Set[0]);
                }
            }
            else
            {
                Console.WriteLine("SelectionEvent-2: " + _parameter);
            }
            return(this);
        }
示例#11
0
 public MoveOffsetEvent(MoveEvent srcEvent, ObjcParameter objc)
     : base(srcEvent)
 {
     objc.Fill(this);
 }
示例#12
0
 public NewChannelEvent(MakeEvent srcEvent, ObjcParameter myObject)
     : base(srcEvent)
 {
     myObject.Fill(this);
 }
示例#13
0
 public SelectSingleColumnEvent(SelectionEvent srcEvent,
                                ObjcParameter objc) :
     base(srcEvent)
 {
     _objc = objc;
 }
示例#14
0
        protected void GetBounds(ObjcParameter objc, out double x, out double y,
			     out double width, out double height)
        {
            var parameters = objc.Parameters;
              double top = (parameters["Top"] as DoubleParameter).
            GetPixels(ActiveImage.Height);
              double left = (parameters["Left"] as DoubleParameter).
            GetPixels(ActiveImage.Width);
              double bottom = (parameters["Btom"] as DoubleParameter).
            GetPixels(ActiveImage.Height);
              double right = (parameters["Rght"] as DoubleParameter).
            GetPixels(ActiveImage.Width);

              x = left;
              y = top;
              width = right - left;
              height = bottom - top;
        }
        public SelectSingleColumnEvent(SelectionEvent srcEvent, 
				   ObjcParameter objc)
            : base(srcEvent)
        {
            _objc = objc;
        }
示例#16
0
        public Parameter ReadItem()
        {
            string key;

            if (PreSix)
            {
                key = ReadFourByteString();
            }
            else
            {
                key = ReadTokenOrString();
            }

            string type = ReadFourByteString();

            DebugOutput.Dump($"key: {key} ({type})");

            Parameter parameter = null;

            switch (type)
            {
            case "alis":
                parameter = new AliasParameter();
                break;

            case "UntF":
                parameter = new DoubleParameter(true);
                break;

            case "bool":
                parameter = new BoolParameter();
                break;

            case "doub":
                parameter = new DoubleParameter(false);
                break;

            case "enum":
                parameter = new EnumParameter();
                break;

            case "obj":
                parameter = new ReferenceParameter();
                break;

            case "VlLs":
                parameter = new ListParameter();
                break;

            case "long":
                parameter = new LongParameter();
                break;

            case "Pth":
                parameter = new PathParameter();
                break;

            case "TEXT":
                parameter = new TextParameter();
                break;

            case "ObAr":
                parameter = new ObArParameter();
                break;

            case "Objc":
                parameter = new ObjcParameter();
                break;

            case "tdta":
                parameter = new RawDataParameter();
                break;

            case "type":
                parameter = new TypeParameter();
                break;

            default:
                Console.WriteLine("ReadItem: type {0} unknown!", type);
                throw new GimpSharpException();
            }

            DebugOutput.Level++;
            parameter.Parse(this);
            DebugOutput.Level--;
            parameter.Name = key;

            return(parameter);
        }
示例#17
0
 public SelectEllipseEvent(SelectionEvent srcEvent, ObjcParameter objc)
     : base(srcEvent)
 {
     _objc = objc;
 }
示例#18
0
        public override void Parse(ActionParser parser)
        {
            int number = parser.ReadInt32();
              DebugOutput.Dump("number: " + number);

              for (int i = 0; i < number; i++)
            {
              string type = parser.ReadFourByteString();
              DebugOutput.Dump("type: " + type);

              Parameter parameter = null;

              switch (type)
            {
            case "Objc":
              parameter = new ObjcParameter();
              break;
            case "long":
              parameter = new LongParameter();
              break;
            case "obj":
              parameter = new ReferenceParameter();
              break;
            default:
              Console.WriteLine("ReadVlLs: type {0} unknown!", type);
              return;
            }

              if (parameter != null)
            {
              DebugOutput.Level++;
              parameter.Parse(parser);
              DebugOutput.Level--;
              _set.Add(parameter);
            }
            }
        }
示例#19
0
        string _units = "#Prc"; // Fix me!

        #endregion Fields

        #region Constructors

        public AddGuideEvent(ActionEvent srcEvent, ObjcParameter myObject)
            : base(srcEvent)
        {
            myObject.Fill(this);
        }
示例#20
0
 public SelectPointEvent(SelectionEvent srcEvent, ObjcParameter objc)
     : base(srcEvent)
 {
     _coordinate = new Coordinate<double>(objc.GetValueAsDouble("Hrzn"),
                objc.GetValueAsDouble("Vrtc"));
 }
示例#21
0
 public SelectPolygonEvent(SelectionEvent srcEvent, ObjcParameter objc) :
     base(srcEvent)
 {
     _objc = objc;
 }
示例#22
0
        override public ActionEvent Parse(ActionParser parser)
        {
            ActionEvent myEvent = base.Parse(parser);

            if (_type != null)
            {
                if (_type is ReferenceParameter)
                {
                    ReferenceParameter type = _type as ReferenceParameter;

                    if (type.Set[0] is EnmrType)
                    {
                        EnmrType enmr = type.Set[0] as EnmrType;

                        switch (enmr.Key)
                        {
                        case "Lyr":
                            return(new MoveLayerEvent(this, enmr.Value));

                        default:
                            Console.WriteLine("MoveEvent, unknown key: " + enmr.Key);
                            break;
                        }
                    }
                    else if (type.Set[0] is IndexType)
                    {
                        IndexType index = type.Set[0] as IndexType;
                        switch (index.Key)
                        {
                        case "Lyr":
                            return(new MoveLayerByIndexEvent(this, index.Index));

                        default:
                            Console.WriteLine("MoveEvent, unknown key: " +
                                              index.Key);
                            break;
                        }
                    }
                }
                else if (_type is ObjcParameter)
                {
                    ObjcParameter type = _type as ObjcParameter;

                    if (type.ClassID2 == "Ofst")
                    {
                        return(new MoveOffsetEvent(this, type));
                    }
                    else
                    {
                        Console.WriteLine("MoveEvent-1: " + type.ClassID2);
                    }
                }
                else
                {
                    Console.WriteLine("MoveEvent-2");
                }
            }
            else
            {
                Console.WriteLine("MoveEvent-3");
            }
            return(myEvent);
        }
示例#23
0
 public NewDocumentEvent(ActionEvent srcEvent, ObjcParameter myObject)
     : base(srcEvent)
 {
     myObject.Fill(this);
 }
示例#24
0
        public Parameter ReadItem()
        {
            string key;
              if (PreSix)
            {
              key = ReadFourByteString();
            }
              else
            {
              key = ReadTokenOrString();
            }

              string type = ReadFourByteString();
              DebugOutput.Dump("key: {0} ({1})", key, type);

              Parameter parameter = null;

              switch (type)
            {
            case "alis":
              parameter = new AliasParameter();
              break;
            case "UntF":
              parameter = new DoubleParameter(true);
              break;
            case "bool":
              parameter = new BoolParameter();
              break;
            case "doub":
              parameter = new DoubleParameter(false);
              break;
            case "enum":
              parameter = new EnumParameter();
              break;
            case "obj":
              parameter = new ReferenceParameter();
              break;
            case "VlLs":
              parameter = new ListParameter();
              break;
            case "long":
              parameter = new LongParameter();
              break;
            case "Pth":
              parameter = new PathParameter();
              break;
            case "TEXT":
              parameter = new TextParameter();
              break;
            case "ObAr":
              parameter = new ObArParameter();
              break;
            case "Objc":
              parameter = new ObjcParameter();
              break;
            case "tdta":
              parameter = new RawDataParameter();
              break;
            case "type":
              parameter = new TypeParameter();
              break;
            default:
              Console.WriteLine("ReadItem: type {0} unknown!", type);
              throw new GimpSharpException();
            }

              DebugOutput.Level++;
              parameter.Parse(this);
              DebugOutput.Level--;
              parameter.Name = key;

              return parameter;
        }
示例#25
0
 public SelectPolygonEvent(SelectionEvent srcEvent, ObjcParameter objc)
     : base(srcEvent)
 {
     _objc = objc;
 }