ladybird/Libraries/LibGfx/Vector2.h

42 lines
830 B
C
Raw Normal View History

2021-05-11 17:25:06 +00:00
/*
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
2021-05-11 17:25:06 +00:00
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "VectorN.h"
2021-05-11 17:25:06 +00:00
#include <AK/Error.h>
#include <AK/Format.h>
#include <AK/StringView.h>
2021-05-11 17:25:06 +00:00
namespace Gfx {
2021-05-11 17:25:06 +00:00
template<class T>
using Vector2 = VectorN<2, T>;
using DoubleVector2 = Vector2<double>;
using FloatVector2 = Vector2<float>;
using IntVector2 = Vector2<int>;
2021-05-11 17:25:06 +00:00
}
2021-05-14 23:31:28 +00:00
namespace AK {
template<typename T>
struct Formatter<Gfx::Vector2<T>> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector2<T> const& value)
2021-05-14 23:31:28 +00:00
{
return Formatter<StringView>::format(builder, value.to_byte_string());
2021-05-14 23:31:28 +00:00
}
};
}
2021-05-11 17:25:06 +00:00
using Gfx::DoubleVector2;
using Gfx::FloatVector2;
using Gfx::IntVector2;
2021-05-11 17:25:06 +00:00
using Gfx::Vector2;