Module: TUITD::CairoRenderer

Defined in:
lib/tui_td/cairo_renderer.rb

Constant Summary collapse

CELL_W =
8
CELL_H =
16
DEFAULT_FONT =
"Arial Unicode MS"
FONT_SIZE =
12.0
RENDER_SCALE =
3

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/tui_td/cairo_renderer.rb', line 22

def available?
  @available
end

.render_glyph_onto(cpn_image, px, py, char, fg_rgb, bold:, italic:) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/tui_td/cairo_renderer.rb', line 26

def render_glyph_onto(cpn_image, px, py, char, fg_rgb, bold:, italic:)
  return unless available?

  alpha = glyph_alpha(char, bold: bold, italic: italic)
  composite(alpha, cpn_image, px, py, fg_rgb)
rescue StandardError => e
  warn "CairoRenderer: #{e.message}" if $DEBUG
end