File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2439,7 +2439,7 @@ inline void pause(Numeric interval)
2439
2439
Py_DECREF (res);
2440
2440
}
2441
2441
2442
- inline void save (const std::string& filename)
2442
+ inline void save (const std::string& filename, const int dpi= 0 )
2443
2443
{
2444
2444
detail::_interpreter::get ();
2445
2445
@@ -2448,10 +2448,18 @@ inline void save(const std::string& filename)
2448
2448
PyObject* args = PyTuple_New (1 );
2449
2449
PyTuple_SetItem (args, 0 , pyfilename);
2450
2450
2451
- PyObject* res = PyObject_CallObject (detail::_interpreter::get ().s_python_function_save , args);
2451
+ PyObject* kwargs = PyDict_New ();
2452
+
2453
+ if (dpi > 0 )
2454
+ {
2455
+ PyDict_SetItemString (kwargs, " dpi" , PyLong_FromLong (dpi));
2456
+ }
2457
+
2458
+ PyObject* res = PyObject_Call (detail::_interpreter::get ().s_python_function_save , args, kwargs);
2452
2459
if (!res) throw std::runtime_error (" Call to save() failed." );
2453
2460
2454
2461
Py_DECREF (args);
2462
+ Py_DECREF (kwargs);
2455
2463
Py_DECREF (res);
2456
2464
}
2457
2465
You can’t perform that action at this time.
0 commit comments