示例#1
0
        public List <PropDesc> get_props_descs(PropType prop_type, string group = "")
        {
            List <PropDesc> descs  = new List <PropDesc>();
            string          result = "";
            string          args   = "";

            switch (prop_type)
            {
            case PropType.Options:
                args   = "options," + group;
                result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                break;

            case PropType.ToneMapping:
                args   = "tone," + group;
                result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                break;

            default:
                result = "";
                break;
            }

            string[] words = result.Split(',');
            for (int i = 0; i < words.Length; i = i + 2)
            {
                descs.Add(new PropDesc(words[i], words[i + 1]));
            }
            return(descs);
        }
示例#2
0
        public bool render()
        {
            string ret = PyUtils.ExectueObjMethod(this.ID, "render", "");

            if (ret == "True")
            {
                return(true);
            }
            else if (ret == "False")
            {
                return(false);
            }
            else
            {
                throw new Exception("True or False is expeted to be returned from render function!");
            }
        }
示例#3
0
        public BitmapSource output_image()
        {
            // NOTE bgra format is expected
            // "width, height, pixels, pitch"
            string ret = PyUtils.ExectueObjMethod(this.ID, "output_image", "");

            string[] tokens = ret.Split(',');
            int      width  = int.Parse(tokens[0]);
            int      height = int.Parse(tokens[1]);
            int      pitch  = int.Parse(tokens[3]);
            long     adr    = long.Parse(tokens[2]);
            IntPtr   pixels = new IntPtr(adr);

            PixelFormat  pixformat = PixelFormats.Bgra32;
            BitmapSource image     = BitmapSource.Create(width, height, 96, 96, pixformat,
                                                         null, pixels, height * pitch, pitch);

            return(image);
        }
示例#4
0
文件: Class1.cs 项目: mario007/renmas
        public static PyImage CreateImage(int width, int height, ImageType type)
        {
            string size = width.ToString() + "," + height.ToString();
            string id   = "";

            switch (type)
            {
            case ImageType.RGBA:
                id = PyUtils.ExecuteMethod("create_image", "RGBA," + size);
                break;

            case ImageType.BGRA:
                id = PyUtils.ExecuteMethod("create_image", "BGRA," + size);
                break;

            case ImageType.PRGBA:
                id = PyUtils.ExecuteMethod("create_image", "PRGBA," + size);
                break;
            }
            return(new PyImage(id, type));
        }
示例#5
0
文件: Class1.cs 项目: mario007/renmas
        public PyBGRAImage convert_to_bgra()
        {
            string id = PyUtils.ExecuteMethod("conv_to_bgra", this.ID);

            return(new PyBGRAImage(id));
        }
示例#6
0
文件: Class1.cs 项目: mario007/renmas
        protected IntPtr get_pointer(string name)
        {
            long adr = long.Parse(PyUtils.GetProp(this._id, name, "int"));

            return(new IntPtr(adr));
        }
示例#7
0
文件: Class1.cs 项目: mario007/renmas
 protected int get_int(string name)
 {
     return(int.Parse(PyUtils.GetProp(this._id, name, "int")));
 }
示例#8
0
 public void save_project(string filename)
 {
     // TODO check if file exists or null raise exception
     PyUtils.ExectueObjMethod(this.ID, "save_project", filename);
 }
示例#9
0
 public void import_scene(string filename)
 {
     // TODO check if file exists or null raise exception
     PyUtils.ExectueObjMethod(this.ID, "parse_scene_file", filename);
 }
示例#10
0
        public static Renmas create()
        {
            string id = PyUtils.ExecuteMethod("create_renderer", "");

            return(new Renmas(id));
        }