Bilinear texel mapping that a whole-pixel move of the target or the source cannot change. More...
#include <array>#include <optional>#include "donner/base/Transform.h"#include "donner/base/Vector2.h"Classes | |
| struct | donner::geode::AnchoredTexelRows |
| Maps a target pixel position p to source texel coordinates as texel = linear * (p - anchor) + fraction + whole, where linear is the single-precision linear part of the inverse transform, fraction lies in [0, 1) and whole is an integer texel offset. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Functions | |
| std::optional< AnchoredTexelRows > | donner::geode::AnchoredTexelRowsFor (const Transform2d &targetFromTexel, const Vector2i &anchor) |
Splits the texel mapping of targetFromTexel at anchor. | |
| std::optional< Vector2i > | donner::geode::AnchorPixelFor (const Vector2d &position) |
The target pixel containing position, for use as an anchor that moves with content placed at position. | |
Bilinear texel mapping that a whole-pixel move of the target or the source cannot change.
| std::optional< AnchoredTexelRows > donner::geode::AnchoredTexelRowsFor | ( | const Transform2d & | targetFromTexel, |
| const Vector2i & | anchor ) |
Splits the texel mapping of targetFromTexel at anchor.
The fraction is computed in double precision from the anchor's exact texel coordinate, so moving the source by whole texels changes only whole, and moving the target and the anchor together by whole pixels changes nothing. Bilinear weights computed from these rows are then the same for corresponding pixels of two renders that differ by such a move, which a texture coordinate interpolated across the quad, or a single-precision transform of the absolute pixel position, does not guarantee.
| targetFromTexel | Transform from source texel coordinates to target pixels. |
| anchor | A target pixel that moves with the content the target pixels are aligned to. |
| std::optional< Vector2i > donner::geode::AnchorPixelFor | ( | const Vector2d & | position | ) |
The target pixel containing position, for use as an anchor that moves with content placed at position.
A position on a pixel boundary up to double rounding counts as that boundary's pixel, so two placements a whole number of pixels apart select anchors the same distance apart.
| position | Target-space position of a point fixed to the content. |
position is not finite; the caller then has no anchor to sample through.