mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
PixelPaint: Allow pasting a copied bitmap as a new layer :^)
This commit is contained in:
parent
00bdb74c84
commit
6aa7f59608
4 changed files with 35 additions and 2 deletions
|
@ -41,6 +41,17 @@ RefPtr<Layer> Layer::create_with_size(Image& image, const Gfx::IntSize& size, co
|
|||
return adopt(*new Layer(image, size, name));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::create_with_bitmap(Image& image, const Gfx::Bitmap& bitmap, const String& name)
|
||||
{
|
||||
if (bitmap.size().is_empty())
|
||||
return nullptr;
|
||||
|
||||
if (bitmap.size().width() > 16384 || bitmap.size().height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Layer(image, bitmap, name));
|
||||
}
|
||||
|
||||
Layer::Layer(Image& image, const Gfx::IntSize& size, const String& name)
|
||||
: m_image(image)
|
||||
, m_name(name)
|
||||
|
@ -48,6 +59,13 @@ Layer::Layer(Image& image, const Gfx::IntSize& size, const String& name)
|
|||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, size);
|
||||
}
|
||||
|
||||
Layer::Layer(Image& image, const Gfx::Bitmap& bitmap, const String& name)
|
||||
: m_image(image)
|
||||
, m_name(name)
|
||||
, m_bitmap(bitmap)
|
||||
{
|
||||
}
|
||||
|
||||
void Layer::did_modify_bitmap(Image& image)
|
||||
{
|
||||
image.layer_did_modify_bitmap({}, *this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue