Class: TankaRenderer::Renderer::Image
- Inherits:
-
Object
- Object
- TankaRenderer::Renderer::Image
- Includes:
- Base
- Defined in:
- lib/tanka_renderer/renderer/image.rb
Instance Attribute Summary
Attributes included from Base
#body_color, #font, #height, #text_color, #vertical, #width
Instance Method Summary collapse
Methods included from Base
#draw, #guess_font, #initialize
Instance Method Details
#render(text, output_path) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/tanka_renderer/renderer/image.rb', line 8 def render(text, output_path) super Cairo::ImageSurface.new(:argb32, @width, @height) do |surface| Cairo::Context.new(surface) do |context| draw(context, text) end surface.write_to_png(output_path) end end |