smasherprog / screen_capture_lite

cross platform screen/window capturing library
MIT License
616 stars 156 forks source link

why BGRA is used instead of just BGR? #70

Closed yuliswe closed 5 years ago

yuliswe commented 5 years ago

May I ask a (stupid) question? Why does this library use 4 channels instead of just 3 for capturing screenshots?

When is the alpha channel not entirely filled with 255? I'm asking because I'm trying to push the boundary of the capture frame rate, and I thought maybe using just 3 channels would be more efficient, also out of curiosity.

I saw that you mentioned the alpha channel is used in onMouseChanged, could you please elaborate what exactly the alpha channel represents in onMouseChanged?

Thanks.

smasherprog commented 5 years ago

I dont think its possible to get a 24 bit image naively in video cards. Directx doesnt even allow 24 bit image formats https://docs.microsoft.com/en-us/windows/desktop/api/dxgiformat/ne-dxgiformat-dxgi_format

So if you can show that using 24 bit images is available and it is as fast as 32 bit ill switch over.

The mouse image needs alpha because it has transparent parts to the image, whereas desktop images do not have transparent parts.

yuliswe commented 5 years ago

Ok thank you, that answered my question. I'll close this question.