Marking lots of stuff as :nodoc:
parent
98c4152a21
commit
7f309869f2
|
|
@ -9,6 +9,8 @@ require 'squib/card'
|
|||
|
||||
module Squib
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def logger
|
||||
@logger ||= Logger.new(STDOUT)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,11 +2,20 @@ require 'cairo'
|
|||
require 'squib/input_helpers'
|
||||
|
||||
module Squib
|
||||
# Back end graphics. Private.
|
||||
class Card
|
||||
include Squib::InputHelpers
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
attr_reader :width, :height
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
attr_accessor :cairo_surface, :cairo_context
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def initialize(deck, width, height)
|
||||
@deck=deck; @width=width; @height=height
|
||||
@cairo_surface = Cairo::ImageSurface.new(width,height)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,17 @@ module Squib
|
|||
class Deck
|
||||
include Enumerable
|
||||
include Squib::InputHelpers
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
attr_reader :width, :height
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
attr_reader :cards
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
attr_reader :text_hint
|
||||
|
||||
# Squib's constructor that sets the immutable properties.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def background(color)
|
||||
cc = cairo_context
|
||||
cc.set_source_color(color)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def png(file, x, y, alpha)
|
||||
cc = cairo_context
|
||||
png = Cairo::ImageSurface.from_png(file)
|
||||
|
|
@ -8,6 +10,8 @@ module Squib
|
|||
cc.paint(alpha)
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def svg(file, id, x, y, width, height)
|
||||
svg = RSVG::Handle.new_from_file(file)
|
||||
width = svg.width if width == :native
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ module Squib
|
|||
end
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def trim(surface, trim, width, height)
|
||||
if trim > 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def save_png(i, dir, prefix)
|
||||
cairo_context.target.write_to_png("#{dir}/#{prefix}#{i}.png")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def rect(x, y, width, height, x_radius, y_radius, fill_color, stroke_color, stroke_width)
|
||||
cc = cairo_context
|
||||
cc.rounded_rectangle(x, y, width, height, x_radius, y_radius)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ require 'pango'
|
|||
module Squib
|
||||
class Card
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def draw_text_hint(x,y,layout, color)
|
||||
return if color.nil? && @deck.text_hint.nil?
|
||||
color ||= @deck.text_hint
|
||||
|
|
@ -14,6 +16,8 @@ module Squib
|
|||
rect(x,y,w,h,0,0,'#0000',color, 2.0)
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def ellipsize(layout, options)
|
||||
unless options[:ellipsize].nil?
|
||||
h = { :none => Pango::Layout::ELLIPSIZE_NONE,
|
||||
|
|
@ -28,6 +32,8 @@ module Squib
|
|||
layout
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def wrap(layout, options)
|
||||
unless options[:wrap].nil?
|
||||
h = { :word => Pango::Layout::WRAP_WORD,
|
||||
|
|
@ -42,6 +48,8 @@ module Squib
|
|||
layout
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def align(layout, options)
|
||||
unless options[:align].nil?
|
||||
h = { :left => Pango::ALIGN_LEFT,
|
||||
|
|
@ -53,6 +61,8 @@ module Squib
|
|||
layout
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def valign(cc, layout, extents, x, y, valign)
|
||||
if layout.height > 0
|
||||
case valign
|
||||
|
|
@ -64,12 +74,16 @@ module Squib
|
|||
end
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def setwh(layout, options)
|
||||
layout.width = options[:width] * Pango::SCALE unless options[:width].nil? || options[:width] == :native
|
||||
layout.height = options[:height] * Pango::SCALE unless options[:height].nil? || options[:height] == :native
|
||||
layout
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def text(str, font, x, y, color, options)
|
||||
cc = cairo_context
|
||||
cc.set_source_color(color)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require 'squib/constants'
|
||||
|
||||
module Squib
|
||||
# :nodoc:
|
||||
# @api private
|
||||
module InputHelpers
|
||||
|
||||
# @api private
|
||||
|
|
|
|||
Loading…
Reference in New Issue