You will first need to use ctypes. First, build a struct:
import ctypes
class BlurRect(ctypes.Structure):
"""
rectangular area to blur
"""
_fields_ = [("bottom", ctypes.c_int),
("top", ctypes.c_int),
("left", ctypes.c_int),
("right", ctypes.c_int),
]
Now load your function. You will need to figure out the best name for
the shared library, and then load it. You should have this code already
implemented as a dll or .so and available in the ld path.
The other tricky bit is your function has an "output" parameter, and the
function is expected to write its result there. You will need to create
a buffer for that.
The ctypes code will look something like this:
blurlib = ctypes.cdll.LoadLibrary("libblur.so")
outbuf = ctypes.create_string_buffer(1024) # not sure how big you need this
inputStructs = [BlurRect(*x) for x in application_defined_data]
successFlag = blurlib.bitmapblur("input",
outbuf,
inputStructs,
count,
reps)