Class: Squib::DSL::PNG
- Inherits:
-
Object
- Object
- Squib::DSL::PNG
- Includes:
- WarnUnexpectedParams
- Defined in:
- lib/squib/dsl/png.rb
Instance Attribute Summary collapse
- #deck ⇒ Object readonly
- #dsl_method ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(deck, dsl_method) ⇒ PNG
constructor
A new instance of PNG.
- #run(opts) ⇒ Object
Methods included from WarnUnexpectedParams
Constructor Details
#initialize(deck, dsl_method) ⇒ PNG
Returns a new instance of PNG.
20 21 22 23 |
# File 'lib/squib/dsl/png.rb', line 20 def initialize(deck, dsl_method) @deck = deck @dsl_method = dsl_method end |
Instance Attribute Details
#deck ⇒ Object (readonly)
18 19 20 |
# File 'lib/squib/dsl/png.rb', line 18 def deck @deck end |
#dsl_method ⇒ Object (readonly)
18 19 20 |
# File 'lib/squib/dsl/png.rb', line 18 def dsl_method @dsl_method end |
Class Method Details
.accepted_params ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/squib/dsl/png.rb', line 25 def self.accepted_params %i( file x y width height alpha blend mask angle crop_x crop_y crop_width crop_height crop_corner_radius crop_corner_x_radius crop_corner_y_radius flip_horizontal flip_vertical range layout placeholder ) end |
Instance Method Details
#run(opts) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/squib/dsl/png.rb', line 38 def run(opts) warn_if_unexpected opts Dir.chdir(deck.img_dir) do range = Args.extract_range opts, deck paint = Args.extract_paint opts, deck box = Args.extract_scale_box opts, deck trans = Args.extract_transform opts, deck ifile = Args.extract_input_file opts, deck deck..start('Loading PNG(s)', range.size) do || range.each do |i| deck.cards[i].png(ifile[i].file, box[i], paint[i], trans[i]) .increment end end end end |