As the documentation for get_bounding_rect
says, get_bounding_rect
will check the pixels in the surface and discard pixels that have an alpha value equal or less to the passed in value.
Returns the smallest rectangular region that contains all the pixels in the surface that have an alpha value greater than or equal to the minimum alpha value.
So for an example, if your surface has 10 pixels of transparent padding around in all sides, the bounding rect will not contain that padding, but instead be a sub-rectangle starting from (10, 10)
and being of size (width - 20, height - 20)
.
The documentation also mentions that the surface pixels will be locked and unlocked during a get_bounding_rect
call, which most likely means that it will be quite a lot slower than calling get_rect
. There's really no direct answer as to which one is better, use the one that suits your needs better. The bounding rectangle will perhaps be more accurate for collisions, but if your surfaces don't contain a lot of empty transparent space, it won't be a big difference.