Struct Anchor
Defined in File anchor.h
Struct Documentation
-
struct Anchor
Convert a top-left-origin image rectangle into local Y-up geometry.
The pointer overloads and MakeQuad write six vertices for two independent triangles; MakeQuadStrip produces a separate four-vertex atlas frame. CPU-only: pixel dimensions and offsets, normalized UVs, finite [0,1] pivot and nonzero texture dimensions required. Source rectangle bounds/size are not checked. Pointer destinations must hold six Vertex2D or thirty floats (x,y,z,u,v); they are borrowed through the call. Invalid pivot/texture throws before writes.
Public Static Functions
-
static ::CE::Rendering::Geometry::Quad MakeQuad(::CE::Rendering::Geometry::Pivot pivot, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Declaration:
[[nodiscard]]Return six vertices for two independent triangles around a normalized pivot.
See also
- Parameters:
pivot – Finite components in [0,1], measured from the source frame’s top-left.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs.
- Throws:
CE::Exceptions::invalid_args – For invalid pivot/zero texture dimensions, before producing output.
- Returns:
Owned geometry value.
-
static ::CE::Rendering::Geometry::QuadTriangleStrip MakeQuadStrip(::CE::Rendering::Geometry::Pivot pivot, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Declaration:
[[nodiscard]]Return four vertices for an independent two-face strip around a normalized pivot.
See also
- Parameters:
pivot – Finite components in [0,1], measured from the source frame’s top-left.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs.
- Throws:
CE::Exceptions::invalid_args – For invalid pivot/zero texture dimensions, before producing output.
- Returns:
Owned geometry value.
-
static void MakePivot(::CE::Rendering::Geometry::Pivot pivot, float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write an independent-triangle quad into borrowed caller storage.
See also
- Parameters:
pivot – Finite normalized top-left-origin pivot.
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order, borrowed only for this call.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs.
- Throws:
CE::Exceptions::invalid_args – For invalid pivot/texture dimensions before any destination writes. Storage validity/capacity is the caller’s precondition.
-
static void MakePivot(::CE::Rendering::Geometry::Pivot pivot, ::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write an independent-triangle quad into borrowed caller storage.
See also
- Parameters:
pivot – Finite normalized top-left-origin pivot.
vertices – Non-null writable storage for six Vertex2D values, borrowed only for this call.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs.
- Throws:
CE::Exceptions::invalid_args – For invalid pivot/texture dimensions before any destination writes. Storage validity/capacity is the caller’s precondition.
-
static void MakeAnchor(::CE::Rendering::Geometry::AnchorType type, float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write the six-vertex quad for a named pivot preset.
See also
- Parameters:
type – Preset; unknown values fall back to Center.
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Zero texture dimensions reject before writes; storage validity/capacity remains the caller’s responsibility.
-
static void MakeAnchor(::CE::Rendering::Geometry::AnchorType type, ::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write the six-vertex quad for a named pivot preset.
See also
- Parameters:
type – Preset; unknown values fall back to Center.
vertices – Non-null writable storage for six Vertex2D values.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Zero texture dimensions reject before writes; storage validity/capacity remains the caller’s responsibility.
-
static void Center(::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the Center pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for six Vertex2D values, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void TopLeft(::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the TopLeft pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for six Vertex2D values, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void TopRight(::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the TopRight pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for six Vertex2D values, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void BottomLeft(::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the BottomLeft pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for six Vertex2D values, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void BottomRight(::CE::Rendering::Geometry::Vertex2D *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the BottomRight pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for six Vertex2D values, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void Center(float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the Center pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void TopLeft(float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the TopLeft pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void TopRight(float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the TopRight pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void BottomLeft(float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the BottomLeft pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static void BottomRight(float *vertices, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)
Write a six-vertex quad using the BottomRight pivot preset.
See also
- Parameters:
vertices – Non-null writable storage for thirty floats in x,y,z,u,v order, retained only by the caller.
texture_width – Nonzero texture width in pixels.
texture_height – Nonzero texture height in pixels.
width – Source/frame width in pixels.
height – Source/frame height in pixels.
x0 – Top-left source pixel X, default0.
y0 – Top-left source pixel Y, default0. Source rectangle bounds/size are not checked. CPU-only output uses local Y-up pixels, z0 and normalized UVs converted from top-left source coordinates. No backend allocation or publication occurs. Equivalent to MakeAnchor() for this preset. Zero texture dimensions reject before writes; source rectangle bounds and destination capacity are not validated.
-
static ::CE::Rendering::Geometry::Quad MakeQuad(::CE::Rendering::Geometry::Pivot pivot, std::uint32_t texture_width, std::uint32_t texture_height, std::uint32_t width, std::uint32_t height, std::uint32_t x0 = 0, std::uint32_t y0 = 0)