MCPcopy Create free account
hub / github.com/carbonengine/trinity / PyGetPixel

Method PyGetPixel

trinity/Tr2HostBitmap.cpp:738–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736}
737
738PyObject* 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
773PyObject* Tr2HostBitmap::PySetPixels( PyObject* args )
774{

Callers

nothing calls this directly

Calls 2

DetachMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected