mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
GraphicsBitmap: Add set_pixel(x, y, Color)
This only works for RGB32 and RGBA32 formats.
This commit is contained in:
parent
ae598116f4
commit
1ec5172ce1
1 changed files with 26 additions and 0 deletions
|
@ -65,6 +65,32 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color get_pixel(const Point& position) const
|
||||||
|
{
|
||||||
|
return get_pixel(position.x(), position.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pixel(int x, int y, Color color)
|
||||||
|
{
|
||||||
|
switch (m_format) {
|
||||||
|
case Format::RGB32:
|
||||||
|
scanline(y)[x] = color.value();
|
||||||
|
break;
|
||||||
|
case Format::RGBA32:
|
||||||
|
scanline(y)[x] = color.value();
|
||||||
|
break;
|
||||||
|
case Format::Indexed8:
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
default:
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pixel(const Point& position, Color color)
|
||||||
|
{
|
||||||
|
set_pixel(position.x(), position.y(), color);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GraphicsBitmap(Format, const Size&);
|
GraphicsBitmap(Format, const Size&);
|
||||||
GraphicsBitmap(Format, const Size&, RGBA32*);
|
GraphicsBitmap(Format, const Size&, RGBA32*);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue