Sha256: 6008e74545028eba7614bb63bcbc5df9c3ecdf486bdb7f3aca62789b0350e579
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Gruff class Renderer::Line EPSILON = 0.001 def initialize(args = {}) @color = args[:color] @shadow_color = args[:shadow_color] @width = args[:width] end def render(start_x, start_y, end_x, end_y) render_line(start_x, start_y, end_x, end_y, @color) render_line(start_x, start_y + 1, end_x, end_y + 1, @shadow_color) if @shadow_color end private def render_line(start_x, start_y, end_x, end_y, color) # FIXME(uwe): Workaround for Issue #66 # https://github.com/topfunky/gruff/issues/66 # https://github.com/rmagick/rmagick/issues/82 # Remove if the issue gets fixed. unless defined?(JRUBY_VERSION) start_x += EPSILON end_x += EPSILON start_y += EPSILON end_y += EPSILON end draw = Renderer.instance.draw draw.push draw.stroke(color) draw.fill(color) draw.stroke_width(@width) if @width draw.line(start_x, start_y, end_x, end_y) draw.pop end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gruff-0.11.0 | lib/gruff/renderer/line.rb |
gruff-0.11.0-java | lib/gruff/renderer/line.rb |