| 736 | } |
| 737 | |
| 738 | PyObject* Tr2HostBitmap::PyGetPixel( PyObject* args ) |
| 739 | { |
| 740 | if( PyTuple_Size( args ) != 1 ) |
| 741 | { |
| 742 | return GetPixelPy( args ); |
| 743 | } |
| 744 | else |
| 745 | { |
| 746 | PyObject* list; |
| 747 | PyArg_ParseTuple( args, "O", &list ); |
| 748 | if( !PySequence_Check( list ) ) |
| 749 | { |
| 750 | PyErr_SetString( PyExc_TypeError, "Expected sequence of tuples" ); |
| 751 | return nullptr; |
| 752 | } |
| 753 | Py_ssize_t len = PySequence_Size( list ); |
| 754 | BluePyTuple res( len ); |
| 755 | for( Py_ssize_t i = 0; i < len; i++ ) |
| 756 | { |
| 757 | BluePy tuple( PySequence_GetItem( list, i ) ); |
| 758 | if( !tuple ) |
| 759 | { |
| 760 | return 0; |
| 761 | } |
| 762 | BluePy obj( GetPixelPy( tuple ) ); |
| 763 | if( !obj ) |
| 764 | { |
| 765 | return 0; |
| 766 | } |
| 767 | res.Set( i, obj ); |
| 768 | } |
| 769 | return res.Detach(); |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | PyObject* Tr2HostBitmap::PySetPixels( PyObject* args ) |
| 774 | { |