mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibGfx: Add Bitmap::strip_alpha_channel()
Sets all alpha values to 0xff and sets the bitmap's format to BGRx8888. Currently only implemented for BGRA8888 and BGRx8888.
This commit is contained in:
parent
6e0fc5e221
commit
d70ddc8961
2 changed files with 11 additions and 0 deletions
|
@ -546,6 +546,14 @@ Bitmap::~Bitmap()
|
|||
delete[] m_palette;
|
||||
}
|
||||
|
||||
void Bitmap::strip_alpha_channel()
|
||||
{
|
||||
VERIFY(m_format == BitmapFormat::BGRA8888 || m_format == BitmapFormat::BGRx8888);
|
||||
for (ARGB32& pixel : *this)
|
||||
pixel = 0xff000000 | (pixel & 0xffffff);
|
||||
m_format = BitmapFormat::BGRx8888;
|
||||
}
|
||||
|
||||
void Bitmap::set_mmap_name([[maybe_unused]] DeprecatedString const& name)
|
||||
{
|
||||
VERIFY(m_needs_munmap);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue