Class: Shellfie::RasterPainter

Inherits:
Object
  • Object
show all
Includes:
Shellfie::Rendering::TextPainter, Shellfie::Rendering::WindowChrome
Defined in:
lib/shellfie/raster_painter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shellfie::Rendering::WindowChrome

#button_group_width, #circle_button_centers, #draw_border, #draw_buttons, #draw_shadow, #draw_title, #draw_title_bar, #draw_title_separator, #draw_window, #draw_windows_buttons, #title_x

Methods included from Shellfie::Rendering::ShapeHelpers

#draw_roundrect, #draw_windows_icon

Methods included from Shellfie::Rendering::TextPainter

#color_with_opacity, #content_origin_y, #draw_content, #draw_line_segments, #draw_positioned_segments, #draw_segment_backgrounds, #draw_selected_backgrounds, #draw_text, #draw_text_decoration, #escape_text, #fit_text, #position_segments, #segment_colors

Constructor Details

#initialize(config:, theme:, font_resolver:, chrome_cache: nil) ⇒ RasterPainter

Returns a new instance of RasterPainter.



15
16
17
18
19
20
# File 'lib/shellfie/raster_painter.rb', line 15

def initialize(config:, theme:, font_resolver:, chrome_cache: nil)
  @config = config
  @theme = theme
  @font_resolver = font_resolver
  @chrome_cache = chrome_cache
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



13
14
15
# File 'lib/shellfie/raster_painter.rb', line 13

def config
  @config
end

#font_resolverObject (readonly)

Returns the value of attribute font_resolver.



13
14
15
# File 'lib/shellfie/raster_painter.rb', line 13

def font_resolver
  @font_resolver
end

#themeObject (readonly)

Returns the value of attribute theme.



13
14
15
# File 'lib/shellfie/raster_painter.rb', line 13

def theme
  @theme
end

Instance Method Details

#paint(geometry, output_path, transparent:) ⇒ Object



22
23
24
25
26
# File 'lib/shellfie/raster_painter.rb', line 22

def paint(geometry, output_path, transparent:)
  return create_cached_image(geometry, output_path, transparent: transparent) if @chrome_cache

  create_full_image(geometry, output_path, transparent: transparent)
end