lib/squib/graphics/cairo_context_wrapper.rb in squib-0.9.0 vs lib/squib/graphics/cairo_context_wrapper.rb in squib-0.10.0
- old
+ new
@@ -1,7 +1,7 @@
require 'forwardable'
-require 'squib/graphics/gradient_regex'
+require_relative 'gradient_regex'
module Squib
module Graphics
# Wrapper class for the Cairo context. Private.
# @api private
@@ -38,11 +38,11 @@
linear.add_color_stop(offset.to_f, color)
end
linear.matrix = matrix # match the coordinate systems - see bug 127
@cairo_cxt.set_source(linear)
elsif match = arg.match(RADIAL_GRADIENT)
- x1, y1, r1, x2, y2, r2 = match.captures
+ x1, y1, r1, x2, y2, r2 = match.captures
radial = Cairo::RadialPattern.new(x1.to_f, y1.to_f, r1.to_f,
x2.to_f, y2.to_f, r2.to_f)
radial.matrix = matrix # match the coordinate systems - see bug 127
arg.scan(STOPS).each do |color, offset|
radial.add_color_stop(offset.to_f, color)
@@ -103,10 +103,10 @@
# fx/fy = 1 means 'no flip', fx/fy = -1 are used for horizontal/vertical flip
def flip(vertical, horizontal, x, y)
v = vertical ? -1.0 : 1.0
h = horizontal ? -1.0 : 1.0
transform Cairo::Matrix.new(v, 0.0, 0.0,
- h, x*(1-v), y*(1-h))
+ h, x * (1 - v), y * (1 - h))
end
end
end
end