mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibGfx: Add Bitmap::invert()
Helper function to invert a bitmap in-place
This commit is contained in:
parent
59598ded15
commit
48d3db3c3d
2 changed files with 10 additions and 0 deletions
|
@ -469,6 +469,14 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::to_bitmap_backed_by_anonymous_buffer() co
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
void Bitmap::invert()
|
||||
{
|
||||
for (auto y = 0; y < height(); y++) {
|
||||
for (auto x = 0; x < width(); x++)
|
||||
set_pixel(x, y, get_pixel(x, y).inverted());
|
||||
}
|
||||
}
|
||||
|
||||
Bitmap::~Bitmap()
|
||||
{
|
||||
if (m_needs_munmap) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue