diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index d6e58959c0..7a1343c003 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -325,6 +325,15 @@ inline void Bitmap::set_pixel(int x, int y, Color color VERIFY(x >= 0 && x < physical_width()); scanline(y)[x] = color.value(); // drop alpha } +template<> +inline void Bitmap::set_pixel(int x, int y, Color color) +{ + VERIFY(x >= 0 && x < physical_width()); + // FIXME: There's a lot of inaccurately named functions in the Color class right now (RGBA vs BGRA), + // clear those up and then make this more convenient. + auto rgba = (color.alpha() << 24) | (color.blue() << 16) | (color.green() << 8) | color.red(); + scanline(y)[x] = rgba; +} inline void Bitmap::set_pixel(int x, int y, Color color) { switch (determine_storage_format(m_format)) { @@ -334,6 +343,9 @@ inline void Bitmap::set_pixel(int x, int y, Color color) case StorageFormat::BGRA8888: set_pixel(x, y, color); break; + case StorageFormat::RGBA8888: + set_pixel(x, y, color); + break; case StorageFormat::Indexed8: VERIFY_NOT_REACHED(); default: