public static class SpriteSlicerCuts a texture into sprite rects.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The part of a sprite editor that is not a user interface. Everything here is a pure function of the pixels and the options, which is what lets the three slicing modes be checked against images built in a test rather than against a screenshot of a panel — the same split TextureLadder makes for the mip inspector.
⚠ Slicing is a suggestion, not a result. What it returns is what the panel puts in front of an author to adjust, and the sidecar records the adjusted rects rather than the options that produced them. That is deliberate: an automatic slice depends on the pixels, so a sheet re-exported with one frame moved would silently renumber every sprite after it and break every reference — where a recorded rect stays where it was until somebody moves it.
Methods (4)
public static bool CanReadAlpha(TextureData? source)Whether the alpha of a decoded texture can be read at all.
public static IReadOnlyList<SpriteRect> Slice(TextureData source, SpriteSliceOptions options)Cuts a texture into sprites.
public static SpriteRect Whole(int width, int height, string name, Vector2? pivot = null, NineSlice border = default(NineSlice))The whole texture as one sprite.
public static Rectangle Trim(TextureData source, Rectangle region, byte threshold = 0)Shrinks a rect to what is actually drawn inside it.
Used by (2)
- SpriteSheetViewVixen.Editor.AssetEditors
- SpriteSlicerTestsVixen.Editor.Assets.Tests