Sha256: 4099992ec5b705c435ba8e2bec096c3b74e3df96d25290ee983e98e2e38a35e1

Contents?: true

Size: 668 Bytes

Versions: 18

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

module Gruff
  # @private
  class Renderer::Rectangle
    def initialize(renderer, color: nil, width: 1.0, opacity: 1.0)
      @renderer = renderer
      @color = color
      @width = width
      @opacity = opacity
    end

    def render(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
      @renderer.draw.push
      @renderer.draw.stroke_width(@width)
      @renderer.draw.stroke(@color) if @width > 1.0
      @renderer.draw.fill_opacity(@opacity)
      @renderer.draw.fill(@color) if @color
      @renderer.draw.rectangle(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
      @renderer.draw.pop
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gruff-0.24.0-java lib/gruff/renderer/rectangle.rb
gruff-0.24.0 lib/gruff/renderer/rectangle.rb
gruff-0.23.0 lib/gruff/renderer/rectangle.rb
gruff-0.23.0-java lib/gruff/renderer/rectangle.rb
gruff-0.22.0 lib/gruff/renderer/rectangle.rb
gruff-0.22.0-java lib/gruff/renderer/rectangle.rb
gruff-0.21.0-java lib/gruff/renderer/rectangle.rb
gruff-0.21.0 lib/gruff/renderer/rectangle.rb
gruff-0.20.0-java lib/gruff/renderer/rectangle.rb
gruff-0.20.0 lib/gruff/renderer/rectangle.rb
gruff-0.19.0 lib/gruff/renderer/rectangle.rb
gruff-0.19.0-java lib/gruff/renderer/rectangle.rb
gruff-0.18.0-java lib/gruff/renderer/rectangle.rb
gruff-0.18.0 lib/gruff/renderer/rectangle.rb
gruff-0.17.0-java lib/gruff/renderer/rectangle.rb
gruff-0.17.0 lib/gruff/renderer/rectangle.rb
gruff-0.16.0 lib/gruff/renderer/rectangle.rb
gruff-0.16.0-java lib/gruff/renderer/rectangle.rb