mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:07:44 +00:00
Start working on a simple Launcher app.
Let GButton have an optional icon (GraphicsBitmap) that gets rendered in the middle of the button if present. Also add GraphicsBitmap::load_from_file() which allows mmap'ed RGBA32 files. I wrote a little program to take "raw" files from GIMP and swizzle them into the correct byte order.
This commit is contained in:
parent
71b9ec1ae0
commit
887b4a7a1a
29 changed files with 293 additions and 11 deletions
|
@ -29,9 +29,20 @@ public:
|
|||
Color(byte r, byte g, byte b) : m_value((r << 16) | (g << 8) | b) { }
|
||||
Color(RGBA32 rgba) : m_value(rgba) { }
|
||||
|
||||
int red() const { return (m_value >> 16) & 0xff; }
|
||||
int green() const { return (m_value >> 8) & 0xff; }
|
||||
int blue() const { return m_value & 0xff; }
|
||||
byte red() const { return (m_value >> 16) & 0xff; }
|
||||
byte green() const { return (m_value >> 8) & 0xff; }
|
||||
byte blue() const { return m_value & 0xff; }
|
||||
byte alpha() const { return (m_value >> 24) & 0xff; }
|
||||
|
||||
Color blend(Color source) const
|
||||
{
|
||||
RGBA32 redblue1 = ((0x100u - source.alpha()) * (m_value & 0xff00ff)) >> 8;
|
||||
RGBA32 redblue2 = (source.alpha() * (source.m_value & 0xff00ff)) >> 8;
|
||||
RGBA32 green1 = ((0x100u - source.alpha()) * (m_value & 0x00ff00)) >> 8;
|
||||
RGBA32 green2 = (source.alpha() * (source.m_value & 0x00ff00)) >> 8;
|
||||
return Color(((redblue1 | redblue2) & 0xff00ff) + ((green1 | green2) & 0x00ff00));
|
||||
}
|
||||
|
||||
|
||||
RGBA32 value() const { return m_value; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue