Scenic.Primitive.Style.Paint.Image (Scenic v0.11.0-beta.0) View Source

Fill a primitive with an image from Scenic.Assets.Static

Data Format

{:image, id}

Fill with the static image indicated by id

The id can be either the name of the file when the static assets library was built or an alias that you set up in your conig. The following example has the alias :parrot pointing to the "images/parrot.png" file, so both fills are identical.

Graph.build()
  |> rect({100, 50}, fill: {:image, "images/parrot.jpg"})
  |> rect({100, 50}, fill: {:image, :parrot})

Note that this is a fill, and the images will repeat automatically if the primitive being filled is larger than the source image.

If you want more control, such as no repeats, a subsection of the image, or scaling the image up or down when you draw it, use the Sprites primitive.