CursorParams.h 771 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/StringView.h>
  8. #include <LibGfx/Point.h>
  9. namespace Gfx {
  10. class CursorParams {
  11. public:
  12. static CursorParams parse_from_filename(StringView, Gfx::IntPoint);
  13. CursorParams() = default;
  14. CursorParams(Gfx::IntPoint hotspot)
  15. : m_hotspot(hotspot)
  16. {
  17. }
  18. CursorParams constrained(Gfx::Bitmap const&) const;
  19. Gfx::IntPoint hotspot() const { return m_hotspot; }
  20. unsigned frames() const { return m_frames; }
  21. unsigned frame_ms() const { return m_frame_ms; }
  22. private:
  23. Gfx::IntPoint m_hotspot;
  24. unsigned m_frames { 1 };
  25. unsigned m_frame_ms { 0 };
  26. bool m_have_hotspot { false };
  27. };
  28. }