summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/CursorParams.h
blob: d3bbd079458ef7d0d896aae85dd78fd5feac440f (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
35
36
37
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/StringView.h>
#include <LibGfx/Point.h>

namespace Gfx {

class CursorParams {
public:
    static CursorParams parse_from_filename(StringView const&, Gfx::IntPoint const&);

    CursorParams() = default;

    CursorParams(Gfx::IntPoint const& hotspot)
        : m_hotspot(hotspot)
    {
    }
    CursorParams constrained(Gfx::Bitmap const&) const;

    Gfx::IntPoint const& hotspot() const { return m_hotspot; }
    unsigned frames() const { return m_frames; }
    unsigned frame_ms() const { return m_frame_ms; }

private:
    Gfx::IntPoint m_hotspot;
    unsigned m_frames { 1 };
    unsigned m_frame_ms { 0 };
    bool m_have_hotspot { false };
};

}