2023-11-24 13:45:45 +00:00
|
|
|
/*
|
2024-11-09 01:36:31 +00:00
|
|
|
* Copyright (c) 2023-2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
2023-11-24 13:45:45 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
2024-11-09 04:48:17 +00:00
|
|
|
#include <AK/NonnullOwnPtr.h>
|
2023-11-24 13:45:45 +00:00
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
#include <LibGfx/Bitmap.h>
|
|
|
|
#include <LibGfx/Forward.h>
|
|
|
|
#include <LibGfx/Rect.h>
|
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
class SkImage;
|
|
|
|
|
2023-11-24 13:45:45 +00:00
|
|
|
namespace Gfx {
|
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
struct ImmutableBitmapImpl;
|
|
|
|
|
2023-11-24 13:45:45 +00:00
|
|
|
class ImmutableBitmap final : public RefCounted<ImmutableBitmap> {
|
|
|
|
public:
|
|
|
|
static NonnullRefPtr<ImmutableBitmap> create(NonnullRefPtr<Bitmap> bitmap);
|
2024-11-09 05:47:16 +00:00
|
|
|
static NonnullRefPtr<ImmutableBitmap> create_snapshot_from_painting_surface(NonnullRefPtr<PaintingSurface>);
|
2023-11-24 13:45:45 +00:00
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
~ImmutableBitmap();
|
|
|
|
|
|
|
|
int width() const;
|
|
|
|
int height() const;
|
|
|
|
IntRect rect() const;
|
|
|
|
IntSize size() const;
|
|
|
|
|
|
|
|
Gfx::AlphaType alpha_type() const;
|
2023-11-24 13:45:45 +00:00
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
SkImage const* sk_image() const;
|
2023-11-24 13:45:45 +00:00
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
Color get_pixel(int x, int y) const;
|
2023-11-24 13:45:45 +00:00
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
RefPtr<Bitmap const> bitmap() const;
|
2023-11-24 13:45:45 +00:00
|
|
|
|
|
|
|
private:
|
2024-11-09 04:48:17 +00:00
|
|
|
NonnullOwnPtr<ImmutableBitmapImpl> m_impl;
|
2023-11-24 13:45:45 +00:00
|
|
|
|
2024-11-09 04:48:17 +00:00
|
|
|
explicit ImmutableBitmap(NonnullOwnPtr<ImmutableBitmapImpl> bitmap);
|
2023-11-24 13:45:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|