Rendro.AssetRegistry (Rendro v0.2.0)

Copy Markdown View Source

State container for registered assets and their metadata.

Summary

Functions

Fetches a registered asset.

Registers an image into the registry. Source can be {:binary, binary()} or {:path, Path.t()}.

Types

t()

@type t() :: %Rendro.AssetRegistry{
  assets: %{
    optional(atom()) => %{
      binary: binary(),
      width: pos_integer(),
      height: pos_integer(),
      mime: String.t()
    }
  }
}

Functions

fetch(registry, logical_name)

@spec fetch(t(), atom()) :: {:ok, map()} | :error

Fetches a registered asset.

new()

@spec new() :: t()

register_image(registry, logical_name, source)

@spec register_image(t(), atom(), {:binary, binary()} | {:path, Path.t()}) :: t()

Registers an image into the registry. Source can be {:binary, binary()} or {:path, Path.t()}.