
This is a simple container for 2d CMYK data. This is a new class instead of a new format in Bitmap because: * Almost all clients of Bitmap will want to deal with RGB data * It keeps the ARGB32 typedef working * Bitmap already does a lot of things The idea is that a few select places will be able to use CMYKBitmap and a color profile to do a better CMYK -> RGB conversion than an image decoder could do, and then store the result in a Bitmap for later display then. CMYKBitmap misses some of Bitmap's features, such as shared memory support, high-dpi scaling capability, etc.
18 lines
459 B
C++
18 lines
459 B
C++
/*
|
|
* Copyright (c) 2024, Nico Weber <thakis@chromium.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibGfx/CMYKBitmap.h>
|
|
|
|
namespace Gfx {
|
|
|
|
ErrorOr<NonnullRefPtr<CMYKBitmap>> CMYKBitmap::create_with_size(IntSize const& size)
|
|
{
|
|
VERIFY(size.width() >= 0 && size.height() >= 0);
|
|
auto data = TRY(ByteBuffer::create_uninitialized(size.width() * size.height() * sizeof(CMYK)));
|
|
return adopt_ref(*new CMYKBitmap(size, move(data)));
|
|
}
|
|
|
|
}
|