1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 14:05:06 +00:00
serenity/Userland/Libraries/LibCards/CardPainter.h
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

41 lines
1.2 KiB
C++

/*
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Array.h>
#include <LibCards/Card.h>
#include <LibGfx/Bitmap.h>
namespace Cards {
class CardPainter {
public:
static CardPainter& the();
NonnullRefPtr<Gfx::Bitmap> card_front(Suit, Rank);
NonnullRefPtr<Gfx::Bitmap> card_back();
NonnullRefPtr<Gfx::Bitmap> card_front_inverted(Suit, Rank);
NonnullRefPtr<Gfx::Bitmap> card_back_inverted();
void set_background_image_path(DeprecatedString path);
private:
CardPainter();
NonnullRefPtr<Gfx::Bitmap> create_card_bitmap();
void paint_card_front(Gfx::Bitmap&, Suit, Rank);
void paint_card_back(Gfx::Bitmap&);
void paint_inverted_card(Gfx::Bitmap& bitmap, Gfx::Bitmap const& source_to_invert);
Array<Array<RefPtr<Gfx::Bitmap>, to_underlying(Rank::__Count)>, to_underlying(Suit::__Count)> m_cards;
Array<Array<RefPtr<Gfx::Bitmap>, to_underlying(Rank::__Count)>, to_underlying(Suit::__Count)> m_cards_inverted;
RefPtr<Gfx::Bitmap> m_card_back;
RefPtr<Gfx::Bitmap> m_card_back_inverted;
DeprecatedString m_background_image_path;
};
}