mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Add supports_alpha()->bool for PixelFormatEnum
This commit is contained in:
@@ -339,6 +339,17 @@ impl PixelFormatEnum {
|
||||
=> panic!("not supported format: {:?}", *self),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn supports_alpha(&self) -> bool {
|
||||
use ::pixels::PixelFormatEnum::*;
|
||||
match *self {
|
||||
ARGB4444 | ARGB1555 | ARGB8888 | ARGB2101010 |
|
||||
ABGR4444 | ABGR1555 | ABGR8888 |
|
||||
BGRA4444 | BGRA5551 | BGRA8888 |
|
||||
RGBA4444 | RGBA5551 | RGBA8888 => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<ll::SDL_PixelFormatEnum> for PixelFormatEnum {
|
||||
|
||||
Reference in New Issue
Block a user