Texture: Add invisible color when copying textures
This should probably support proper alpha blending but I'm lazy :)
This commit is contained in:
parent
397219c22e
commit
7bf7bfbe13
|
@ -86,7 +86,8 @@ namespace LibGUI
|
|||
|
||||
for (uint32_t y_off = 0; y_off < height; y_off++)
|
||||
for (uint32_t x_off = 0; x_off < width; x_off++)
|
||||
set_pixel(x + x_off, y + y_off, texture.get_pixel(sub_x + x_off, sub_y + y_off));
|
||||
if (const uint32_t color = texture.get_pixel(sub_x + x_off, sub_y + y_off); color != color_invisible)
|
||||
set_pixel(x + x_off, y + y_off, color);
|
||||
}
|
||||
|
||||
void Texture::draw_character(uint32_t codepoint, const LibFont::Font& font, int32_t tl_x, int32_t tl_y, uint32_t color)
|
||||
|
|
|
@ -11,6 +11,9 @@ namespace LibGUI
|
|||
|
||||
class Texture
|
||||
{
|
||||
public:
|
||||
static constexpr uint32_t color_invisible = 0x69000000;
|
||||
|
||||
public:
|
||||
static BAN::ErrorOr<Texture> create(uint32_t width, uint32_t height, uint32_t color);
|
||||
Texture() = default;
|
||||
|
|
Loading…
Reference in New Issue