Rubocop: Trailing Whitespace
This commit is contained in:
@@ -2,13 +2,13 @@ module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def background(color)
|
||||
use_cairo do |cc|
|
||||
cc.set_source_color(color)
|
||||
cc.paint
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
module Squib
|
||||
|
||||
# Cache all pngs we've already loaded
|
||||
#
|
||||
#
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def cache_load_image(file)
|
||||
@@ -13,7 +13,7 @@ module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def png(file, x, y, alpha, blend)
|
||||
return if file.nil? or file.eql? ''
|
||||
png = Squib.cache_load_image(file)
|
||||
@@ -25,7 +25,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def svg(file, id, x, y, width, height, alpha, blend)
|
||||
Squib.logger.debug {"Rendering: #{file}, #{id} #{x}, #{y}, #{width}, #{height}, #{alpha}, #{blend}"}
|
||||
return if file.nil? or file.eql? ''
|
||||
|
||||
@@ -9,7 +9,7 @@ module Squib
|
||||
# @option opts file [String] the name of the PDF file to save. See {file:README.md#Specifying_Files Specifying Files}
|
||||
# @option opts dir [String] (_output) the directory to save to. Created if it doesn't exist.
|
||||
# @option opts margin [Integer] (75) the margin around the outside of the page
|
||||
# @option opts gap [Integer] (0) the space in pixels between the cards
|
||||
# @option opts gap [Integer] (0) the space in pixels between the cards
|
||||
# @option opts trim [Integer] (0) the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play)
|
||||
# @return [nil]
|
||||
# @api public
|
||||
@@ -39,7 +39,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def trim(surface, trim, width, height)
|
||||
if trim > 0
|
||||
tmp = Cairo::ImageSurface.new(width-2*trim, height-2*trim)
|
||||
|
||||
@@ -2,7 +2,7 @@ module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def save_png(i, dir, prefix, do_rotate, angle)
|
||||
if [true, :clockwise, :counterclockwise].include?(do_rotate)
|
||||
surface = rotated_image(angle)
|
||||
@@ -24,7 +24,7 @@ module Squib
|
||||
rotated_cc.target
|
||||
end
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def write_png(surface, i, dir, prefix)
|
||||
surface.write_to_png("#{dir}/#{prefix}#{i}.png")
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
module Squib
|
||||
class Card
|
||||
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @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|
|
||||
@@ -17,7 +17,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def circle(x, y, radius, fill_color, stroke_color, stroke_width)
|
||||
use_cairo do |cc|
|
||||
cc.circle(x, y, radius)
|
||||
@@ -31,7 +31,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @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)
|
||||
@@ -45,7 +45,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def line(x1, y1, x2, y2, stroke_color, stroke_width)
|
||||
use_cairo do |cc|
|
||||
cc.move_to(x1, y1)
|
||||
@@ -55,6 +55,6 @@ module Squib
|
||||
cc.stroke
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
+13
-13
@@ -4,7 +4,7 @@ module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def draw_text_hint(cc,x,y,layout, color,angle)
|
||||
color = @deck.text_hint if color.to_s.eql? 'off' and not @deck.text_hint.to_s.eql? 'off'
|
||||
return if color.to_s.eql? 'off' or color.nil?
|
||||
@@ -22,7 +22,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def ellipsize(layout, ellipsize)
|
||||
unless ellipsize.nil?
|
||||
h = { :none => Pango::Layout::ELLIPSIZE_NONE,
|
||||
@@ -38,7 +38,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def wrap(layout, wrap)
|
||||
unless wrap.nil?
|
||||
h = { :word => Pango::Layout::WRAP_WORD,
|
||||
@@ -54,7 +54,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def align(layout, align)
|
||||
unless align.nil?
|
||||
h = { :left => Pango::ALIGN_LEFT,
|
||||
@@ -67,9 +67,9 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def valign(cc, layout, x, y, valign)
|
||||
if layout.height > 0
|
||||
if layout.height > 0
|
||||
ink_extents = layout.extents[1]
|
||||
case valign
|
||||
when :middle
|
||||
@@ -81,7 +81,7 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
# @api private
|
||||
def setwh(layout, width, height)
|
||||
layout.width = width * Pango::SCALE unless width.nil? || width == :native
|
||||
layout.height = height * Pango::SCALE unless height.nil? || height == :native
|
||||
@@ -89,17 +89,17 @@ module Squib
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def text(str, font, font_size, color,
|
||||
# @api private
|
||||
def text(str, font, font_size, color,
|
||||
x, y, width, height,
|
||||
markup, justify, wrap, ellipsize,
|
||||
markup, justify, wrap, ellipsize,
|
||||
spacing, align, valign, hint, angle)
|
||||
Squib.logger.debug {"Placing '#{str}'' with font '#{font}' @ #{x}, #{y}, color: #{color}, angle: #{angle} etc."}
|
||||
use_cairo do |cc|
|
||||
cc.set_source_color(color)
|
||||
cc.move_to(x,y)
|
||||
cc.rotate(angle)
|
||||
|
||||
|
||||
layout = cc.create_pango_layout
|
||||
font_desc = Pango::FontDescription.new(font)
|
||||
font_desc.size = font_size * Pango::SCALE unless font_size.nil?
|
||||
@@ -111,8 +111,8 @@ module Squib
|
||||
layout = ellipsize(layout, ellipsize)
|
||||
layout = align(layout, align)
|
||||
layout.justify = justify unless justify.nil?
|
||||
layout.spacing = spacing * Pango::SCALE unless spacing.nil?
|
||||
cc.update_pango_layout(layout)
|
||||
layout.spacing = spacing * Pango::SCALE unless spacing.nil?
|
||||
cc.update_pango_layout(layout)
|
||||
valign(cc, layout, x,y, valign)
|
||||
cc.update_pango_layout(layout) ; cc.show_pango_layout(layout)
|
||||
draw_text_hint(cc,x,y,layout,hint,angle)
|
||||
|
||||
Reference in New Issue
Block a user