Browse Source

Marking lots of stuff as :nodoc:

dev
Andy Meneely 12 years ago
parent
commit
7f309869f2
  1. 2
      lib/squib.rb
  2. 11
      lib/squib/card.rb
  3. 9
      lib/squib/deck.rb
  4. 2
      lib/squib/graphics/background.rb
  5. 4
      lib/squib/graphics/image.rb
  6. 1
      lib/squib/graphics/save_doc.rb
  7. 2
      lib/squib/graphics/save_images.rb
  8. 2
      lib/squib/graphics/shapes.rb
  9. 14
      lib/squib/graphics/text.rb
  10. 2
      lib/squib/input_helpers.rb

2
lib/squib.rb

@ -9,6 +9,8 @@ require 'squib/card'
module Squib
# :nodoc:
# @api private
def logger
@logger ||= Logger.new(STDOUT)
end

11
lib/squib/card.rb

@ -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)
@ -24,4 +33,4 @@ module Squib
require 'squib/graphics/text'
end
end
end

9
lib/squib/deck.rb

@ -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.

2
lib/squib/graphics/background.rb

@ -1,6 +1,8 @@
module Squib
class Card
# :nodoc:
# @api private
def background(color)
cc = cairo_context
cc.set_source_color(color)

4
lib/squib/graphics/image.rb

@ -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

1
lib/squib/graphics/save_doc.rb

@ -34,6 +34,7 @@ module Squib
end
end
# :nodoc:
# @api private
def trim(surface, trim, width, height)
if trim > 0

2
lib/squib/graphics/save_images.rb

@ -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

2
lib/squib/graphics/shapes.rb

@ -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)

14
lib/squib/graphics/text.rb

@ -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)

2
lib/squib/input_helpers.rb

@ -1,6 +1,8 @@
require 'squib/constants'
module Squib
# :nodoc:
# @api private
module InputHelpers
# @api private

Loading…
Cancel
Save