Class: SsTextureRegistry
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:62
cellmap.name_hash → the SkPaint its batches draw with.
The hash is what DrawBatch.texture_hash carries, so this is the whole of texture resolution. Hashes come from the Brain via SsRuntime.hashString; never re-implement FNV-1a here, because a second implementation that disagrees shows up as a texture that silently never resolves.
A paint rather than an image, because a paint is what drawInto needs and building one per frame would allocate on the hot path.
Ownership
The registry owns the paints and shaders it builds, not the SkImages handed to it: those usually come from a React hook that manages their lifetime, and disposing one out from under a picture that has been recorded but not yet rasterised would draw from freed memory. dispose() therefore drops the paints and leaves the images alone.
Constructors
Constructor
new SsTextureRegistry():
SsTextureRegistry
Returns
SsTextureRegistry
Accessors
size
Get Signature
get size():
number
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:177
Returns
number
Methods
bindings()
bindings():
SsTextureBinding[]
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:189
The texture table for SsContext.drawInto, cached until the registry changes.
Order does not matter: drawInto resolves each batch against this by hash, so the Brain's batch order — which is the whole of the depth sorting — survives regardless.
Returns
dispose()
dispose():
void
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:219
Drops every paint. The images stay alive — see the class comment.
Returns
void
has()
has(
textureHash):boolean
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:98
Whether something is already registered.
Parameters
textureHash
number
Returns
boolean
hasBase()
hasBase(
textureHash):boolean
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:107
Whether the texture restore would bring back is in, so a loader can skip a re-decode. An override alone does not count: the pack's own atlas still has to go underneath it.
Parameters
textureHash
number
Returns
boolean
isOverridden()
isOverridden(
textureHash):boolean
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:158
Whether textureHash currently carries a runtime override.
Parameters
textureHash
number
Returns
boolean
override()
override(
textureHash,image,options?):void
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:142
Replaces the paint for textureHash with a runtime image, remembering the paint it displaced so restore can bring it back.
This is the runtime texture-replacement seam — a costume change or a dynamic expression driven from code rather than the authoring data. It is keyed by the same hash DrawBatch.texture_hash carries, so the swap takes effect on the next drawInto with nothing else to do.
Distinct from registerByHash only in that it captures the base: a plain re-register (what a loader does) is not an override and leaves nothing to restore to.
Parameters
textureHash
number
image
options?
Returns
void
register()
register(
cellmapName,image,options?):void
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:79
Registers image under the cellmap called cellmapName — the name as the .ssab carries it, with no .ssce extension.
Parameters
cellmapName
string
image
options?
Returns
void
registerBase()
registerBase(
textureHash,image,options?):void
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:117
As registerByHash, for what a pack loads. Under an override it goes where restore looks, and the override keeps drawing.
Parameters
textureHash
number
image
options?
Returns
void
registerByHash()
registerByHash(
textureHash,image,options?):void
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:88
As register, for a hash already obtained from the Brain.
Parameters
textureHash
number
image
options?
Returns
void
restore()
restore(
textureHash):boolean
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:167
Undoes an override, putting back the paint the pack had loaded — or dropping the entry when the override went on before any paint was there. Returns whether an override was actually in effect.
Parameters
textureHash
number
Returns
boolean
unregister()
unregister(
textureHash):boolean
Defined in: packages/react-native-spritestudio/src/core/SsTextureRegistry.ts:207
Drops one paint, if it is registered. Returns whether it was.
For an owner replacing what it put in rather than emptying the registry: a player reloading a different pack has to take its own entries out, and a registry it shares with the caller may hold entries that are not its to drop.
Parameters
textureHash
number
Returns
boolean