FrenchCurve.Backend.Iterm2 (FrenchCurve v0.1.3)

Copy Markdown View Source

Renders a raster with iTerm2's inline-image protocol, as a base64 PNG in an OSC 1337 sequence.

True RGBA, so transparency is kept. The protocol has no stored images: every draw sends the whole picture, which is why FrenchCurve.Sprite.upload/3 does nothing here.

IO.write(FrenchCurve.Backend.Iterm2.render(raster, fit: {20, 10}))

Summary

Functions

Returns the escape sequence that draws raster at the cursor.

Functions

render(raster, opts \\ [])

@spec render(
  FrenchCurve.Raster.t(),
  keyword()
) :: binary()

Returns the escape sequence that draws raster at the cursor.

The raster is encoded as a PNG by FrenchCurve.Png.encode/3 and base64-wrapped.

Options

  • :fit{cols, rows}, the cell box to scale the image into. Sizing is in cells natively, so no cell-pixel size is needed. Aspect ratio is not preserved: the image is stretched to fill the box. Omitted by default, which leaves iTerm2 to size the image from its pixel dimensions.