Sha256: 3b1770465d91ecce65d8b39b6097d02ac8127b5f4ee0160ad1d21806322a9403

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

module Squib
  class Card

    # :nodoc:
    # @api private
    def rect(x, y, width, height, x_radius, y_radius, fill_color, stroke_color, stroke_width)
      width  = @width   if width == :native
      height = @height  if height == :native
      use_cairo do |cc|
        cc.rounded_rectangle(x, y, width, height, x_radius, y_radius)
        cc.set_source_squibcolor(stroke_color)
        cc.set_line_width(stroke_width)
        cc.stroke
        cc.rounded_rectangle(x, y, width, height, x_radius, y_radius)
        cc.set_source_squibcolor(fill_color)
        cc.fill
      end
    end

    # :nodoc:
    # @api private
    def circle(x, y, radius, fill_color, stroke_color, stroke_width)
      use_cairo do |cc|
        cc.move_to(x + radius, y)
        cc.circle(x, y, radius)
        cc.set_source_squibcolor(stroke_color)
        cc.set_line_width(stroke_width)
        cc.stroke
        cc.circle(x, y, radius)
        cc.set_source_squibcolor(fill_color)
        cc.fill
      end
    end

    # :nodoc:
    # @api private
    def triangle(x1, y1, x2, y2, x3, y3, fill_color, stroke_color, stroke_width)
      use_cairo do |cc|
        cc.triangle(x1, y1, x2, y2, x3, y3)
        cc.set_source_squibcolor(stroke_color)
        cc.set_line_width(stroke_width)
        cc.stroke
        cc.triangle(x1, y1, x2, y2, x3, y3)
        cc.set_source_squibcolor(fill_color)
        cc.fill
      end
    end

    # :nodoc:
    # @api private
    def line(x1, y1, x2, y2, stroke_color, stroke_width)
      use_cairo do |cc|
        cc.move_to(x1, y1)
        cc.line_to(x2, y2)
        cc.set_source_squibcolor(stroke_color)
        cc.set_line_width(stroke_width)
        cc.stroke
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
squib-0.4.0 lib/squib/graphics/shapes.rb