I haven't had the time to work much on it yet, but I found the equation for the line and used that equation to find where the line hits the bitmap, and where it comes out.
That was how far I got when I did the testing, I might do some more today.
After finding the two points, you can use one of those to create a new bitmap and copy the information on either side of the two points. It's easiest when it's a clear cut and you end up with rectangles on both sides of the line, since you wont have any excess information being copied.
To be clear, I'll be using the point that is furthest away from the side the other point is closest to and use that point to copy out a rectangle of the bitmap.
I've attached a png of a bitmap where the line is a bit slanted(if that's the correct word).
As you can see, the copying will copy more than we want, but we can easily draw a rectangle over that area we don't want to use and then make it transparent. We then have the cut off part stored in a new bitmap ready to be used.
We also do the same to the original bitmap, make the "cut off" part transparent. I was thinking about just using al_draw_filled_rectangle and al_draw_filled_triangle and then al_convert_mask_to_alpha using the color I drew the triangle and rectangles with. But I suspect there might be a better way to do it. I don't know if you can use al_map_rgba with the primitives?
But in summary, figure out the points using the equation of the line. Determine if the line is slanted which will result in excess information being copied and make the excess area transparent. Then make the "cut off" area of the original bitmap transparent.
I'm sorry if my explanation was a bit convoluted, English isn't my first language so it's a bit hard to explain.
Edit: On the image, I was going to use the width and hight to explain something, but I didn't. You can ignore those.