12#include "../color/module.hpp"
13#include "../geometry/module.hpp"
14#include "../SIMD/module.hpp"
15#include "../utility/module.hpp"
20namespace hi::inline
v1 {
38 constexpr sfloat_rgba16(f16x4
const &rhs) noexcept : v(std::bit_cast<
decltype(v)>(rhs)) {}
42 v = std::bit_cast<decltype(v)>(rhs);
46 constexpr explicit operator f16x4()
const noexcept
48 return std::bit_cast<f16x4>(v);
55 return *
this =
static_cast<f16x4
>(rhs);
62 return *
this =
static_cast<f16x4
>(rhs);
65 constexpr explicit operator color()
const noexcept
67 return color{
static_cast<f16x4
>(*this)};
74 return hash_mix(v[0], v[1], v[2], v[3]);
83 std::get<3>(r.v) = 0x0000;
98inline void composit(pixmap_span<sfloat_rgba16> under, pixmap_span<sfloat_rgba16 const> over)
noexcept
100 hi_assert(over.height() >= under.height());
101 hi_assert(over.width() >= under.width());
103 for (
auto y = 0_uz; y != under.height(); ++y) {
104 hilet over_line = over[y];
105 hilet under_line = under[y];
106 for (
auto x = 0_uz; x != under.width(); ++x) {
107 hilet &overPixel = over_line[x];
108 auto &underPixel = under_line[x];
110 underPixel =
composit(
static_cast<f16x4
>(underPixel),
static_cast<f16x4
>(overPixel));
115inline void composit(pixmap_span<sfloat_rgba16> under, color over, pixmap_span<uint8_t const> mask)
noexcept
117 hi_assert(mask.height() >= under.height());
118 hi_assert(mask.width() >= under.width());
120 auto mask_pixel = color{1.0f, 1.0f, 1.0f, 1.0f};
122 for (
auto y = 0_uz; y != under.height(); ++y) {
123 hilet mask_line = mask[y];
124 hilet under_line = under[y];
125 for (
auto x = 0_uz; x != under.width(); ++x) {
126 hilet mask_value = mask_line[x] / 255.0f;
127 mask_pixel.a() = mask_value;
129 auto &pixel = under_line[x];
130 pixel =
composit(
static_cast<color
>(pixel), over * mask_pixel);
Defines the pixmap_span type.
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:184
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:13
void composit(pixmap_span< sfloat_rgba16 > dst, hi::color color, graphic_path const &mask) noexcept
Composit color onto the destination image where the mask is solid.
geometry/margins.hpp
Definition cache.hpp:11
Definition graphic_path.hpp:18
4 x float16 pixel format.
Definition sfloat_rgba16.hpp:26