summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/ProjectLoader.h
blob: 3acf3f0cdd72d58e226a045d9477bc6d10dcd293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "Image.h"
#include <AK/JsonArray.h>
#include <AK/Result.h>
#include <AK/StringView.h>

namespace PixelPaint {

class ProjectLoader {
public:
    ProjectLoader() = default;
    ~ProjectLoader() = default;

    ErrorOr<void> try_load_from_file(NonnullOwnPtr<Core::Stream::File>);

    bool is_raw_image() const { return m_is_raw_image; }
    bool has_image() const { return !m_image.is_null(); }
    RefPtr<Image> release_image() const { return move(m_image); }
    JsonArray const& json_metadata() const { return m_json_metadata; }

private:
    RefPtr<Image> m_image { nullptr };
    bool m_is_raw_image { false };
    JsonArray m_json_metadata {};
};

}