KgpVisibility
Namespace: Hex1b.Surfaces
Assembly: Hex1b.dll
Tracks visibility of a KGP image placement after occlusion by other content.
public sealed class KgpVisibilityInheritance
Object → KgpVisibility
Constructors
KgpVisibility(TrackedObject<KgpCellData>, int, int, int)
Creates a new KGP visibility tracker.
Parameters:
public KgpVisibility(TrackedObject<KgpCellData> kgp, int anchorX, int anchorY, int layerIndex)Properties
AnchorPosition
Gets the anchor position (top-left cell) of the KGP image.
Returns: ValueTuple<Int32, Int32>
public (int X, int Y) AnchorPosition { get; }IsFullyOccluded
Gets whether the image is fully occluded (no visible regions).
Returns: Boolean
public bool IsFullyOccluded { get; }IsFullyVisible
Gets whether the image is fully visible (no occlusions applied).
Returns: Boolean
public bool IsFullyVisible { get; }Kgp
Gets the tracked KGP cell data.
Returns: TrackedObject<KgpCellData>
public TrackedObject<KgpCellData> Kgp { get; }LayerIndex
Gets the layer index for z-ordering.
Returns: Int32
public int LayerIndex { get; }VisibleRegions
Gets the visible pixel regions after occlusion.
Returns: IReadOnlyList<PixelRect>
public IReadOnlyList<PixelRect> VisibleRegions { get; }Methods
ApplyOcclusion(Rect, CellMetrics)
Applies an occlusion from a cell rect, subtracting the occluded area from visible regions.
Parameters:
cellRect(Rect): The occluding rectangle in cell coordinates, relative to the surface.metrics(CellMetrics): Cell metrics for pixel conversion.
public void ApplyOcclusion(Rect cellRect, CellMetrics metrics)GeneratePlacements(CellMetrics)
Generates placement data for each visible region. Each placement uses the same ImageId but different source rectangles.
Parameters:
metrics(CellMetrics):
Returns: IReadOnlyList<KgpCellData, Int32, Int32>>
public IReadOnlyList<(KgpCellData Data, int CellX, int CellY)> GeneratePlacements(CellMetrics metrics)Remarks
Similar to but leverages KGP's native source-rectangle clipping — adjusting placement parameters is a pure metadata operation, no image re-encoding is needed.
Usage: create a for each KGP image, apply occlusions from overlapping text or higher-layer content, then call to produce clipped instances for emission.