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); }
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!"); } }
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); }
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)); }
public PyBGRAImage convert_to_bgra() { string id = PyUtils.ExecuteMethod("conv_to_bgra", this.ID); return(new PyBGRAImage(id)); }
protected IntPtr get_pointer(string name) { long adr = long.Parse(PyUtils.GetProp(this._id, name, "int")); return(new IntPtr(adr)); }
protected int get_int(string name) { return(int.Parse(PyUtils.GetProp(this._id, name, "int"))); }
public void save_project(string filename) { // TODO check if file exists or null raise exception PyUtils.ExectueObjMethod(this.ID, "save_project", filename); }
public void import_scene(string filename) { // TODO check if file exists or null raise exception PyUtils.ExectueObjMethod(this.ID, "parse_scene_file", filename); }
public static Renmas create() { string id = PyUtils.ExecuteMethod("create_renderer", ""); return(new Renmas(id)); }