CommunityPreview¶
Namespace Nfty.Core.Publish.Community in assembly Nfty.Core.
The preview sheet a shared Set carries: its first assets stitched into one PNG that holds its own nfty-grid chunk, never more than ShareRules.MaxPreviewSide pixels a side.
Remarks¶
It is the ordinary SpriteSheet over a prefix of the Set, so a preview is addressable exactly as a full sheet is: cell n is asset n + 1. Nothing here resamples.
Methods¶
CellCount(int, int, int)¶
How many assets the preview holds.
Parameters
count(int) - How many assets the Set has.cellW(int) - The canvas width.cellH(int) - The canvas height.
Returns. The largest n up to 64 and up to count whose grid stays within the side limit; 0 when not even one cell fits or there is nothing to show.
Check(string, int, int)¶
Checks a preview file against the Set's canvas.
Parameters
pngPath(string) - The preview.canvasW(int) - The Set's canvas width.canvasH(int) - The Set's canvas height.
Returns. No problems, or the single ShareRules.PreviewBad sentence. Never throws.
WriteAsync(IReadOnlyList<SetItem>, string, CancellationToken)¶
public static Task WriteAsync(IReadOnlyList<SetItem> items, string destination, CancellationToken ct);
Writes the preview sheet of a Set.
Parameters
items(IReadOnlyList<SetItem>) - The Set's assets.destination(string) - The.pngto write.ct(CancellationToken) - Stops between assets.
Returns. A task that completes when the file is written.
Exceptions
ArgumentException- There is nothing to show, or the canvas is too large for even one cell.
Remarks
Takes the first cells in Set (number) order. The cell is the Set's canvas, read from the first asset's header.