wformat 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,12 +11,17 @@ class WallMerger
11
11
  width_two = options['width_two'] || 1920
12
12
  height_one = options['height_one'] || 1200
13
13
  height_two = options['height_two'] || 1200
14
+ color = options['color'] || 'black'
14
15
  title = options['title'] || "#{File.basename(image_one, ".jpg")} and #{File.basename(image_two, ".jpg")}.jpg"
15
16
 
16
17
  # prepare image will retrieve the image and scale it
17
18
  im_one = prepare_image(image_one, width_one, height_one)
18
19
  im_two = prepare_image(image_two, width_two, height_two)
19
- result = prepare_backdrop(width_one, height_one, width_two, height_two)
20
+ result = prepare_backdrop({'width_one' => width_one,
21
+ 'width_two' => width_two,
22
+ 'height_one' => height_one,
23
+ 'height_two' => height_two,
24
+ 'color' => color})
20
25
 
21
26
  # place through will drop the image onto the target with shifting
22
27
  place_through(0, 0, width_one, height_one, im_one, result)
@@ -23,8 +23,13 @@ module WallOperations
23
23
  end
24
24
  end
25
25
 
26
- def prepare_backdrop(width_one, height_one, width_two = 0, height_two = 0)
27
- Image.new(width_one + width_two, [height_one, height_two].max) { self.background_color = 'black'}
26
+ def prepare_backdrop(options = {})
27
+ color = options['color'] || 'black'
28
+ width_one = options['width'] || options['width_one'] || 1920
29
+ height_one = options['height'] || options['height_one'] || 1200
30
+ width_two = options['width_two'] || 0
31
+ height_two = options['height_two'] || 0
32
+ Image.new(width_one + width_two, [height_one, height_two].max) { self.background_color = color}
28
33
  end
29
34
 
30
35
  # Places image on target, also applying rightward or downward shift to given coordinates based on bounds
@@ -9,11 +9,14 @@ class WallScaler
9
9
  def scale(image, options = {})
10
10
  width = options['width'] || 1920
11
11
  height = options['height'] || 1200
12
-
12
+ color = options['color'] || 'black'
13
13
  title = options['title'] || "#{File.basename(image, ".jpg")} scaled.jpg"
14
14
 
15
15
  im = prepare_image(image, width, height)
16
- result = prepare_backdrop(width, height)
16
+
17
+ result = prepare_backdrop({'width' => width,
18
+ 'height' => height,
19
+ 'color' => color})
17
20
 
18
21
  place_through(0, 0, width, height, im, result)
19
22
  save_image(result, title)
@@ -45,6 +45,10 @@ optparse = OptionParser.new do |opts|
45
45
  options['title'] = title
46
46
  end
47
47
 
48
+ opts.on('--color=COLOR', "Backdrop color") do |color|
49
+ options['color'] = color
50
+ end
51
+
48
52
  opts.on('--trace', "Provide stack trace when error occurs") do
49
53
  options['trace'] = true
50
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wformat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-28 00:00:00.000000000 Z
12
+ date: 2011-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
16
- requirement: &10502880 !ruby/object:Gem::Requirement
16
+ requirement: &11975440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2.13'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10502880
24
+ version_requirements: *11975440
25
25
  description: ! "wformat is a command line utility to organize collections of wallpapers\n\n
26
26
  \ For now, it can only reformat images into proper sizes(for dualmonitors too)\n\n
27
27
  \ \n\n Soon it will feature organization through renaming and the ability to