Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
PresentedFrameComposer.h File Reference
#include <optional>
#include <span>
#include <vector>
#include "donner/base/Box.h"
#include "donner/base/EcsRegistry.h"
#include "donner/base/Transform.h"
#include "donner/base/Vector2.h"
Include dependency graph for PresentedFrameComposer.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::PresentedFrameTileGeometry
 Backend-neutral geometry for one presented composited tile. More...
struct  donner::editor::PresentedDragBaseline
 Active drag baseline needed to resolve a presented tile offset. More...
struct  donner::editor::PresentedTileQuad
 Output-space quad for one presented tile. More...
struct  donner::editor::PresentedTileRect
 Output-space rectangle for one presented tile. More...
struct  donner::editor::PresentedPixelRect
 Integer output-space rectangle used by headless bitmap presentation. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

Vector2d donner::editor::ResolvePresentedTileDragTranslation (const PresentedFrameTileGeometry &tile, const std::optional< PresentedDragBaseline > &dragBaseline)
 Resolve the drag translation to apply while presenting a cached tile.
Transform2d donner::editor::ResolvePresentedTileDocumentTransform (const PresentedFrameTileGeometry &tile, const std::optional< PresentedDragBaseline > &dragBaseline)
 Resolve the affine transform to apply while presenting a cached tile.
std::optional< PresentedTileQuaddonner::editor::ComputePresentedTileQuad (const PresentedFrameTileGeometry &tile, const Transform2d &outputFromCanvasTransform, const std::optional< PresentedDragBaseline > &dragBaseline)
 Compute the output-space quad for a presented tile.
std::optional< Transform2ddonner::editor::ComputePresentedOutputFromTextureTransform (const PresentedTileQuad &tileQuad, const Vector2i &textureSizePx)
 Recover the affine transform that maps source texture pixels onto a presented tile quad.
std::optional< PresentedTileRectdonner::editor::ComputePresentedTileRect (const PresentedFrameTileGeometry &tile, const Transform2d &outputFromCanvasTransform, const std::optional< PresentedDragBaseline > &dragBaseline)
 Compute the output-space rectangle for a presented tile.
std::optional< PresentedPixelRectdonner::editor::RoundPresentedTileRectToPixelRect (const PresentedTileRect &rect)
 Round a floating-point presented rectangle to integer pixel coordinates.
std::vector< Box2ddonner::editor::SubtractPresentedTileBoundsFromClip (const Box2d &clipRect, std::span< const Box2d > coveredRects)
 Split a clip rectangle into regions not covered by current active tile bounds.

Function Documentation

◆ ComputePresentedOutputFromTextureTransform()

std::optional< Transform2d > donner::editor::ComputePresentedOutputFromTextureTransform ( const PresentedTileQuad & tileQuad,
const Vector2i & textureSizePx )
nodiscard

Recover the affine transform that maps source texture pixels onto a presented tile quad.

Parameters
tileQuadPresented output-space tile corners.
textureSizePxSource texture dimensions in pixels.
Returns
Transform from texture pixels to output coordinates, or std::nullopt for invalid inputs.

◆ ComputePresentedTileQuad()

std::optional< PresentedTileQuad > donner::editor::ComputePresentedTileQuad ( const PresentedFrameTileGeometry & tile,
const Transform2d & outputFromCanvasTransform,
const std::optional< PresentedDragBaseline > & dragBaseline )
nodiscard

Compute the output-space quad for a presented tile.

Parameters
tileGeometry for the tile being presented.
outputFromCanvasTransformTransform from canvas/document coordinates to output space.
dragBaselineActive drag baseline represented by the presented tiles.
Returns
Output quad, or std::nullopt when tile or transform geometry is invalid.

◆ ComputePresentedTileRect()

std::optional< PresentedTileRect > donner::editor::ComputePresentedTileRect ( const PresentedFrameTileGeometry & tile,
const Transform2d & outputFromCanvasTransform,
const std::optional< PresentedDragBaseline > & dragBaseline )
nodiscard

Compute the output-space rectangle for a presented tile.

Parameters
tileGeometry for the tile being presented.
outputFromCanvasTransformTransform from canvas/document coordinates to output space.
dragBaselineActive drag baseline represented by the presented tiles.
Returns
Output rectangle, or std::nullopt when tile or transform geometry is invalid.

◆ ResolvePresentedTileDocumentTransform()

Transform2d donner::editor::ResolvePresentedTileDocumentTransform ( const PresentedFrameTileGeometry & tile,
const std::optional< PresentedDragBaseline > & dragBaseline )
nodiscard

Resolve the affine transform to apply while presenting a cached tile.

Parameters
tileGeometry for the tile being presented.
dragBaselineActive drag baseline represented by the presented tiles.
Returns
Transform from cached document placement to presented document placement.

◆ ResolvePresentedTileDragTranslation()

Vector2d donner::editor::ResolvePresentedTileDragTranslation ( const PresentedFrameTileGeometry & tile,
const std::optional< PresentedDragBaseline > & dragBaseline )
nodiscard

Resolve the drag translation to apply while presenting a cached tile.

Parameters
tileGeometry for the tile being presented.
dragBaselineActive drag baseline represented by the presented tiles.
Returns
Translation to add to the tile's canvas offset.

◆ RoundPresentedTileRectToPixelRect()

std::optional< PresentedPixelRect > donner::editor::RoundPresentedTileRectToPixelRect ( const PresentedTileRect & rect)
nodiscard

Round a floating-point presented rectangle to integer pixel coordinates.

Parameters
rectPresented tile rectangle in output coordinates.
Returns
Pixel rectangle, or std::nullopt when the rectangle is invalid or rounds to no area.

◆ SubtractPresentedTileBoundsFromClip()

std::vector< Box2d > donner::editor::SubtractPresentedTileBoundsFromClip ( const Box2d & clipRect,
std::span< const Box2d > coveredRects )
nodiscard

Split a clip rectangle into regions not covered by current active tile bounds.

Overview infill is an older, lower-resolution fallback. It must fill areas the active viewport render does not cover, but it must not show through transparent pixels inside active tiles.

Parameters
clipRectOutput-space clip rectangle to split.
coveredRectsOutput-space active tile bounds that occlude overview infill.
Returns
Non-overlapping rectangles inside clipRect and outside coveredRects.