Hi, I was testing the camera module and was a bit disappointed to find that my camera doesn't support flipping via Camera.set_controls(). I thought that it would be a good idea if these basic settings should work whether the camera supports them or not. So I set out to write a patch which implements this. The patch does three things: 1) it exposes a C-API for transform.flip() 2) it adds a new field "filter" to the camera object. When the user calls set_controls() and the camera doesn't support h/vflip then it sets a flag in the filter variable. when Camera.get_image() is called and the flag is set the surface returned from the camera is passed through transform.flip() to get the desired result. 3) adds a new public method Camera.get_hw_capabilities() which returns a tuple (hflip, vflip) containing booleans so signal if the camera device supports flipping. caveat: the transform.flip() function doesn't perform the flip in-place but rather returns a new surface. therefor the software filter so far only works when creating a new surface in the get_image() call (i.e. "new_surf = cam.get_image()" and not "cam.get_image(screen)") I tried to design this in an extensible way so that one can use the "filter" variable to later add other filters like color inversion. regards, Lorenz
Attachment:
camera_sw_filter.patch
Description: Binary data