Module: Skeptick::TornPaperImage

Included in:
Skeptick, DslContext
Defined in:
lib/skeptick/sugar/torn_paper_image.rb

Instance Method Summary collapse

Instance Method Details

#torn_paper_image(*args, &blk) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/skeptick/sugar/torn_paper_image.rb', line 5

def torn_paper_image(*args, &blk)
  opts = args.last.is_a?(Hash) ? args.pop : {}
  spread    = opts[:spread]    || 1
  blur      = opts[:blur]      || '0x.7'
  threshold = opts[:threshold] || 50

  compose(:copy_opacity, *args) do
    convert(&blk) if block_given?
    convert do
      set '+clone'
      set '-virtual-pixel', 'transparent'
      set :spread, spread
      set :channel, 'A'
      set :blur, blur
      set :threshold, "#{threshold}%"
    end

    set :blur, blur
  end
end