Sha256: e1465e774869c7656715dcfb047b4591182af11dd856b6b0ff831bfc3957afd3

Contents?: true

Size: 605 Bytes

Versions: 6

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module Gruff
  # @private
  class Renderer::DashLine
    def initialize(renderer, color:, width:, dasharray: [10, 20])
      @renderer = renderer
      @color = color
      @width = width
      @dasharray = dasharray
    end

    def render(start_x, start_y, end_x, end_y)
      @renderer.draw.push
      @renderer.draw.stroke_color(@color)
      @renderer.draw.fill_opacity(0.0)
      @renderer.draw.stroke_dasharray(*@dasharray)
      @renderer.draw.stroke_width(@width)
      @renderer.draw.line(start_x, start_y, end_x, end_y)
      @renderer.draw.pop
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gruff-0.18.0-java lib/gruff/renderer/dash_line.rb
gruff-0.18.0 lib/gruff/renderer/dash_line.rb
gruff-0.17.0-java lib/gruff/renderer/dash_line.rb
gruff-0.17.0 lib/gruff/renderer/dash_line.rb
gruff-0.16.0 lib/gruff/renderer/dash_line.rb
gruff-0.16.0-java lib/gruff/renderer/dash_line.rb