Vector4.h 830 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include "VectorN.h"
  9. #include <AK/Error.h>
  10. #include <AK/Format.h>
  11. #include <AK/StringView.h>
  12. namespace Gfx {
  13. template<class T>
  14. using Vector4 = VectorN<4, T>;
  15. using DoubleVector4 = Vector4<double>;
  16. using FloatVector4 = Vector4<float>;
  17. using IntVector4 = Vector4<int>;
  18. }
  19. namespace AK {
  20. template<typename T>
  21. struct Formatter<Gfx::Vector4<T>> : Formatter<StringView> {
  22. ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector4<T> const& value)
  23. {
  24. return Formatter<StringView>::format(builder, value.to_byte_string());
  25. }
  26. };
  27. }
  28. using Gfx::DoubleVector4;
  29. using Gfx::FloatVector4;
  30. using Gfx::IntVector4;
  31. using Gfx::Vector4;