示例#1
0
        void ParseParameters(GimpParamSet parameters, int num_args, IntPtr argsPtr,
                             params object[] list)
        {
            var paramDef = GetParamDef(num_args, argsPtr);

            int i = parameters.Count;

            foreach (object obj in list)
            {
                Console.WriteLine("ParseParameters: " + paramDef[i].type);
                switch (paramDef[i].type)
                {
                case PDBArgType.Int32:
                    parameters.Add(GimpParam.GetIntParam(obj));
                    break;

                case PDBArgType.Float:
                    parameters.Add(GimpParam.GetFloatParam(obj));
                    break;

                case PDBArgType.String:
                    parameters.Add(GimpParam.GetStringParam(obj));
                    break;

                default:
                    Console.WriteLine("Procedure: Implement this: " +
                                      paramDef[i].type);
                    break;
                }
                i++;
            }
        }
示例#2
0
        public void Marshall(IntPtr paramPtr, int n_params)
        {
            var parameters = new GimpParamSet(paramPtr, n_params);
            int i          = 0;

            foreach (var param in parameters)
            {
                FillValue(i++, param);
            }
        }
示例#3
0
        List <object> RunProcedure2(string Name, GimpParamSet parameters)
        {
            int    n_return_vals;
            IntPtr returnArgsPtr = gimp_run_procedure2(Name, out n_return_vals,
                                                       parameters.Count,
                                                       parameters.ToArray());

            //      return ParseReturnArgs(returnArgsPtr, n_return_vals);

            return(null);
        }
示例#4
0
        public void Run(Image image, Drawable drawable, params object[] list)
        {
            PDBProcType proc_type;
            int         num_args;
            int         num_values;
            IntPtr      argsPtr;
            IntPtr      return_vals;

            if (gimp_procedural_db_proc_info(Name,
                                             out _blurb,
                                             out _help,
                                             out _author,
                                             out _copyright,
                                             out _date,
                                             out proc_type,
                                             out num_args,
                                             out num_values,
                                             out argsPtr,
                                             out return_vals))
            {
                Console.WriteLine("Run 1: " + image.Width);
                Console.WriteLine("Run 1: " + drawable.Width);
                // First 3 parameters are default
                var parameters = new GimpParamSet()
                {
                    new GimpParam(PDBArgType.Int32, RunMode.Noninteractive),
                    new GimpParam(PDBArgType.Image, image),
                    new GimpParam(PDBArgType.Drawable, drawable)
                };
                Console.WriteLine("Run 2: " + GimpParam.Size);

                ParseParameters(parameters, num_args, argsPtr, list);
                // Todo: destroy argsPtr!
                Console.WriteLine("Run 3 with " + parameters.Count);

                RunProcedure2(Name, parameters);
                // RunProcedure2(Name, image, drawable);
            }
            else
            {
                Console.WriteLine(Name + " not found!");
            }
        }
示例#5
0
        public List <object> Run(params object[] list)
        {
            PDBProcType proc_type;
            int         num_args;
            int         num_values;
            IntPtr      argsPtr;
            IntPtr      return_vals;

            if (gimp_procedural_db_proc_info(Name,
                                             out _blurb,
                                             out _help,
                                             out _author,
                                             out _copyright,
                                             out _date,
                                             out proc_type,
                                             out num_args,
                                             out num_values,
                                             out argsPtr,
                                             out return_vals))
            {
                var parameters = new GimpParamSet()
                {
                    new GimpParam(PDBArgType.Int32, RunMode.Noninteractive)
                };

                ParseParameters(parameters, num_args, argsPtr, list);
                // Todo: destroy argsPtr!

                return(RunProcedure2(Name, parameters));
            }
            else
            {
                Console.WriteLine(Name + " not found!");
            }
            return(null);
        }
示例#6
0
        public List <object> Run(params object[] list)
        {
            if (gimp_procedural_db_proc_info(Name,
                                             out _blurb,
                                             out _help,
                                             out _author,
                                             out _copyright,
                                             out _date,
                                             out var proc_type,
                                             out int num_args,
                                             out int num_values,
                                             out IntPtr argsPtr,
                                             out IntPtr return_vals))
            {
                var parameters = new GimpParamSet()
                {
                    new GimpParam(PDBArgType.Int32, RunMode.Noninteractive)
                };

                ParseParameters(parameters, num_args, argsPtr, list);
                // Todo: destroy argsPtr!

                return(RunProcedure2(Name, parameters));
            }