/* * Copyright (c) 2024, Lucas Chollet * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Gfx { namespace Details { struct ColorSpaceImpl; } class ColorSpace { public: ColorSpace(); ColorSpace(ColorSpace const&); ColorSpace(ColorSpace&&); ColorSpace& operator=(ColorSpace const&); ColorSpace& operator=(ColorSpace&&); ~ColorSpace(); static ErrorOr load_from_icc_bytes(ReadonlyBytes); // In order to keep this file free of Skia types, this function can't return // a sk_sp. To work around that issue, we define a template here // and only provide a specialization for sk_sp. template T& color_space(); private: template friend ErrorOr IPC::encode(IPC::Encoder&, T const&); template friend ErrorOr IPC::decode(IPC::Decoder&); explicit ColorSpace(NonnullOwnPtr&& color_pace); NonnullOwnPtr m_color_space; }; } namespace IPC { template<> ErrorOr encode(Encoder&, Gfx::ColorSpace const&); template<> ErrorOr decode(Decoder&); }