View Source Chisel.Renderer (chisel v0.2.1)

The renderer is capable of draw the text on any target using for that a function that receives the x, y coordinates of the pixel to be painted.

Summary

Types

Use size_x and size_y options to scale up the font.

The function used to paint the canvas.

The function used to paint the canvas.

Functions

Draws a character using the codepoint

Gets the size of the rendered string using the font and options provided

Draws a character using the codepoint calling a reducer function.

Types

@type acc() :: any()
@type draw_options() :: [size_x: integer(), size_y: integer()]

Use size_x and size_y options to scale up the font.

@type pixel_fun() :: (x :: integer(), y :: integer() -> term())

The function used to paint the canvas.

Chisel will use this function to draw the text.

@type reduce_pixel_fun() :: (x :: integer(), y :: integer(), acc :: acc() -> acc())

The function used to paint the canvas.

Chisel will use this function to draw the text.

Functions

Link to this function

draw_char(codepoint, clx, cly, font, put_pixel, opts \\ [])

View Source
@spec draw_char(
  codepoint :: integer(),
  clx :: integer(),
  cly :: integer(),
  font :: Chisel.Font.t(),
  put_pixel :: pixel_fun(),
  opts :: draw_options()
) :: {x :: integer(), y :: integer()}

Draws a character using the codepoint

The coordinates (tlx, tly) are for the top left corner.

Link to this function

draw_text(text, tlx, tly, font, put_pixel, opts \\ [])

View Source
@spec draw_text(
  text :: String.t(),
  tlx :: integer(),
  tly :: integer(),
  font :: Chisel.Font.t(),
  put_pixel :: pixel_fun(),
  opts :: draw_options()
) :: {x :: integer(), y :: integer()}

Draws an string

The coordinates (tlx, tly) are for the top left corner.

Link to this function

get_text_width(text, font, opts \\ [])

View Source
@spec get_text_width(
  text :: String.t(),
  font :: Chisel.Font.t(),
  opts :: draw_options()
) :: integer()

Gets the size of the rendered string using the font and options provided

Link to this function

reduce_draw_char(codepoint, clx, cly, font, acc, reduce_pixel, opts \\ [])

View Source
@spec reduce_draw_char(
  codepoint :: integer(),
  clx :: integer(),
  cly :: integer(),
  font :: Chisel.Font.t(),
  acc :: acc(),
  reduce_pixel :: reduce_pixel_fun(),
  opts :: draw_options()
) :: {acc :: acc(), x :: integer(), y :: integer()}

Draws a character using the codepoint calling a reducer function.

The coordinates (tlx, tly) are for the top left corner.

Link to this function

reduce_draw_text(text, tlx, tly, font, acc, reduce_pixel, opts \\ [])

View Source
@spec reduce_draw_text(
  text :: String.t(),
  tlx :: integer(),
  tly :: integer(),
  font :: Chisel.Font.t(),
  acc :: acc(),
  reduce_pixel :: reduce_pixel_fun(),
  opts :: draw_options()
) :: {acc :: acc(), x :: integer(), y :: integer()}

Draws an string calling a reducer function

The coordinates (tlx, tly) are for the top left corner.