image_paradise 0.1.12

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of image_paradise might be problematic. Click here for more details.

Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +38 -0
  3. data/README.md +179 -0
  4. data/USAGE.md +10 -0
  5. data/bin/black_white +10 -0
  6. data/bin/display_text_from_this_image +7 -0
  7. data/bin/image_paradise +7 -0
  8. data/bin/image_paradise_shell +7 -0
  9. data/bin/image_to_ascii +54 -0
  10. data/bin/image_to_pdf +7 -0
  11. data/bin/make_this_image_transparent +7 -0
  12. data/bin/rotate_left +7 -0
  13. data/bin/rotate_right +7 -0
  14. data/doc/README.gen +162 -0
  15. data/doc/TODO_FOR_THE_GTK_GUI.md +1 -0
  16. data/image_paradise.gemspec +50 -0
  17. data/lib/image_paradise.rb +5 -0
  18. data/lib/image_paradise/base/base.rb +91 -0
  19. data/lib/image_paradise/black_white.rb +89 -0
  20. data/lib/image_paradise/confree_generator/class.rb +614 -0
  21. data/lib/image_paradise/confree_generator/constants.rb +61 -0
  22. data/lib/image_paradise/confree_generator/gui/gtk_confree_generator.rb +752 -0
  23. data/lib/image_paradise/confree_generator/gui/insert_button.rb +78 -0
  24. data/lib/image_paradise/confree_generator/reset.rb +61 -0
  25. data/lib/image_paradise/confree_generator/shared/shared.rb +100 -0
  26. data/lib/image_paradise/constants.rb +43 -0
  27. data/lib/image_paradise/constants/image_file_types.rb +21 -0
  28. data/lib/image_paradise/create_animated_gif.rb +47 -0
  29. data/lib/image_paradise/crop/crop.rb +302 -0
  30. data/lib/image_paradise/gm_support.rb +34 -0
  31. data/lib/image_paradise/graphs.rb +36 -0
  32. data/lib/image_paradise/graphs/accumulator_bar.rb +29 -0
  33. data/lib/image_paradise/graphs/area.rb +64 -0
  34. data/lib/image_paradise/graphs/bar.rb +117 -0
  35. data/lib/image_paradise/graphs/bar_conversion.rb +53 -0
  36. data/lib/image_paradise/graphs/base.rb +1392 -0
  37. data/lib/image_paradise/graphs/bezier.rb +45 -0
  38. data/lib/image_paradise/graphs/bullet.rb +115 -0
  39. data/lib/image_paradise/graphs/deprecated.rb +42 -0
  40. data/lib/image_paradise/graphs/dot.rb +129 -0
  41. data/lib/image_paradise/graphs/line.rb +328 -0
  42. data/lib/image_paradise/graphs/mini/bar.rb +42 -0
  43. data/lib/image_paradise/graphs/mini/legend.rb +109 -0
  44. data/lib/image_paradise/graphs/mini/pie.rb +42 -0
  45. data/lib/image_paradise/graphs/mini/side_bar.rb +41 -0
  46. data/lib/image_paradise/graphs/net.rb +133 -0
  47. data/lib/image_paradise/graphs/photo_bar.rb +106 -0
  48. data/lib/image_paradise/graphs/pie.rb +139 -0
  49. data/lib/image_paradise/graphs/scatter.rb +264 -0
  50. data/lib/image_paradise/graphs/scene.rb +216 -0
  51. data/lib/image_paradise/graphs/side_bar.rb +144 -0
  52. data/lib/image_paradise/graphs/side_stacked_bar.rb +116 -0
  53. data/lib/image_paradise/graphs/spider.rb +163 -0
  54. data/lib/image_paradise/graphs/stacked_area.rb +73 -0
  55. data/lib/image_paradise/graphs/stacked_bar.rb +68 -0
  56. data/lib/image_paradise/graphs/stacked_mixin.rb +30 -0
  57. data/lib/image_paradise/graphs/themes.rb +117 -0
  58. data/lib/image_paradise/graphviz/README.md +2 -0
  59. data/lib/image_paradise/graphviz/generate_graphviz_image.rb +274 -0
  60. data/lib/image_paradise/gui/gtk/control_panel.rb +126 -0
  61. data/lib/image_paradise/identify.rb +145 -0
  62. data/lib/image_paradise/image_border.rb +231 -0
  63. data/lib/image_paradise/image_manipulations.rb +320 -0
  64. data/lib/image_paradise/image_paradise.rb +150 -0
  65. data/lib/image_paradise/image_to_ascii/image_to_ascii.rb +187 -0
  66. data/lib/image_paradise/image_to_pdf/image_to_pdf.rb +99 -0
  67. data/lib/image_paradise/label/README.md +2 -0
  68. data/lib/image_paradise/label/simple_label.rb +206 -0
  69. data/lib/image_paradise/optimizer.rb +483 -0
  70. data/lib/image_paradise/project/project.rb +29 -0
  71. data/lib/image_paradise/random_text_to_image.rb +363 -0
  72. data/lib/image_paradise/requires/common_base_requires.rb +17 -0
  73. data/lib/image_paradise/requires/require_colours.rb +9 -0
  74. data/lib/image_paradise/requires/require_gtk_components.rb +8 -0
  75. data/lib/image_paradise/requires/require_image_to_ascii.rb +7 -0
  76. data/lib/image_paradise/requires/require_the_image_paradise_project.rb +24 -0
  77. data/lib/image_paradise/requires/require_toplevel_methods.rb +21 -0
  78. data/lib/image_paradise/rotate/README.md +2 -0
  79. data/lib/image_paradise/rotate/rotate.rb +98 -0
  80. data/lib/image_paradise/shell/interactive.rb +156 -0
  81. data/lib/image_paradise/svg/README.md +5 -0
  82. data/lib/image_paradise/svg/circle.rb +106 -0
  83. data/lib/image_paradise/svg/feature.rb +48 -0
  84. data/lib/image_paradise/svg/rectangle.rb +154 -0
  85. data/lib/image_paradise/svg/svg.rb +102 -0
  86. data/lib/image_paradise/to_gif.rb +91 -0
  87. data/lib/image_paradise/to_jpg.rb +90 -0
  88. data/lib/image_paradise/toplevel_methods/add_black_border_to_this_image.rb +56 -0
  89. data/lib/image_paradise/toplevel_methods/crop.rb +28 -0
  90. data/lib/image_paradise/toplevel_methods/e.rb +16 -0
  91. data/lib/image_paradise/toplevel_methods/esystem.rb +19 -0
  92. data/lib/image_paradise/toplevel_methods/extract_text_from_this_image.rb +56 -0
  93. data/lib/image_paradise/toplevel_methods/file_related_code.rb +25 -0
  94. data/lib/image_paradise/toplevel_methods/flip_image_left_right.rb +32 -0
  95. data/lib/image_paradise/toplevel_methods/greyscale_this_image.rb +59 -0
  96. data/lib/image_paradise/toplevel_methods/help.rb +30 -0
  97. data/lib/image_paradise/toplevel_methods/make_this_image_transparent.rb +30 -0
  98. data/lib/image_paradise/toplevel_methods/menu.rb +92 -0
  99. data/lib/image_paradise/toplevel_methods/merge_these_images.rb +49 -0
  100. data/lib/image_paradise/toplevel_methods/mirror_image.rb +28 -0
  101. data/lib/image_paradise/toplevel_methods/misc.rb +31 -0
  102. data/lib/image_paradise/toplevel_methods/png_to_svg.rb +34 -0
  103. data/lib/image_paradise/toplevel_methods/roebe.rb +17 -0
  104. data/lib/image_paradise/toplevel_methods/to_png.rb +105 -0
  105. data/lib/image_paradise/toplevel_methods/wallpaper.rb +37 -0
  106. data/lib/image_paradise/toplevel_methods/write_this_text.rb +76 -0
  107. data/lib/image_paradise/version/version.rb +19 -0
  108. data/test/16x16_red_square_image_for_testing.png +0 -0
  109. data/test/testing_confree_generator.rb +8 -0
  110. data/test/testing_crop.rb +19 -0
  111. data/test/testing_image_magick_commands.rb +39 -0
  112. data/test/testing_image_paradise.rb +49 -0
  113. data/test/testing_the_svg_component.html +261 -0
  114. data/test/testing_the_svg_component.rb +106 -0
  115. metadata +217 -0
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ ##
6
+ #
7
+ # Makes a small bar graph suitable for display at 200px or even smaller.
8
+
9
+ module ImageParadise
10
+
11
+ module Gruff
12
+ module Mini
13
+
14
+ class Bar < Gruff::Bar
15
+
16
+ include Gruff::Mini::Legend
17
+
18
+ def initialize_ivars
19
+ super
20
+ @hide_legend = true
21
+ @hide_title = true
22
+ @hide_line_numbers = true
23
+
24
+ @marker_font_size = 50.0
25
+ @minimum_value = 0.0
26
+ @maximum_value = 0.0
27
+ @legend_font_size = 60.0
28
+ end
29
+
30
+ def draw
31
+ expand_canvas_for_vertical_legend
32
+
33
+ super
34
+
35
+ draw_vertical_legend
36
+ @d.draw(@base_image)
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+ end; end
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ module ImageParadise
6
+
7
+ module Gruff
8
+
9
+ module Mini
10
+ module Legend
11
+ attr_accessor :hide_mini_legend, :legend_position
12
+
13
+ ##
14
+ # The canvas needs to be bigger so we can put the legend beneath it.
15
+ def expand_canvas_for_vertical_legend
16
+ return if @hide_mini_legend
17
+ @legend_labels = @data.collect {|item| item[Gruff::Base::DATA_LABEL_INDEX] }
18
+ legend_height = scale_fontsize(
19
+ @data.length * calculate_line_height +
20
+ @top_margin + @bottom_margin)
21
+ @original_rows = @raw_rows
22
+ @original_columns = @raw_columns
23
+
24
+ case @legend_position
25
+ when :right then
26
+ @rows = [@rows, legend_height].max
27
+ @columns += calculate_legend_width + @left_margin
28
+ else
29
+ @rows += @data.length * calculate_caps_height(scale_fontsize(@legend_font_size)) * 1.7
30
+ end
31
+ render_background
32
+ end
33
+
34
+ def calculate_line_height
35
+ calculate_caps_height(@legend_font_size) * 1.7
36
+ end
37
+
38
+ def calculate_legend_width
39
+ width = @legend_labels.map { |label| calculate_width(@legend_font_size, label) }.max
40
+ scale_fontsize(width + 40*1.7)
41
+ end
42
+
43
+ # === draw_vertical_legend
44
+ #
45
+ # Draw the legend beneath the existing graph.
46
+ def draw_vertical_legend
47
+ return if @hide_mini_legend
48
+
49
+ legend_square_width = 40.0 # small square with color of this item
50
+ # legend_square_margin = 10.0 # This variable is not in use.
51
+ @legend_left_margin = 100.0
52
+ legend_top_margin = 40.0
53
+
54
+ # May fix legend drawing problem at small sizes
55
+ @d.font = @font if @font
56
+ @d.pointsize = @legend_font_size
57
+
58
+ case @legend_position
59
+ when :right
60
+ current_x_offset = @original_columns + @left_margin
61
+ current_y_offset = @top_margin + legend_top_margin
62
+ else
63
+ current_x_offset = @legend_left_margin
64
+ current_y_offset = @original_rows + legend_top_margin
65
+ end
66
+
67
+ debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }
68
+
69
+ @legend_labels.each_with_index do |legend_label, index|
70
+
71
+ # Draw label
72
+ @d.fill = @font_color
73
+ @d.font = @font if @font
74
+ @d.pointsize = scale_fontsize(@legend_font_size)
75
+ @d.stroke = 'transparent'
76
+ @d.font_weight = Magick::NormalWeight
77
+ @d.gravity = Magick::WestGravity
78
+ @d = @d.annotate_scaled( @base_image,
79
+ @raw_columns, 1.0,
80
+ current_x_offset + (legend_square_width * 1.7), current_y_offset,
81
+ truncate_legend_label(legend_label), @scale)
82
+
83
+ # Now draw box with color of this dataset
84
+ @d = @d.stroke 'transparent'
85
+ @d = @d.fill @data[index][Gruff::Base::DATA_COLOR_INDEX]
86
+ @d = @d.rectangle(current_x_offset,
87
+ current_y_offset - legend_square_width / 2.0,
88
+ current_x_offset + legend_square_width,
89
+ current_y_offset + legend_square_width / 2.0)
90
+
91
+ current_y_offset += calculate_line_height
92
+ end
93
+ @color_index = 0
94
+ end
95
+
96
+ ##
97
+ # Shorten long labels so they will fit on the canvas.
98
+ #
99
+ # Department of Hu...
100
+ def truncate_legend_label(label)
101
+ truncated_label = label.to_s
102
+ while calculate_width(scale_fontsize(@legend_font_size), truncated_label) > (@columns - @legend_left_margin - @right_margin) && (truncated_label.length > 1)
103
+ truncated_label = truncated_label[0..truncated_label.length-2]
104
+ end
105
+ truncated_label + (truncated_label.length < label.to_s.length ? "..." : '')
106
+ end
107
+ end
108
+
109
+ end; end; end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ ##
6
+ #
7
+ # Makes a small pie graph suitable for display at 200px or even smaller.
8
+ #
9
+ module ImageParadise
10
+
11
+ module Gruff
12
+ module Mini
13
+
14
+ class Pie < Gruff::Pie
15
+
16
+ include Gruff::Mini::Legend
17
+
18
+ def initialize_ivars
19
+ super
20
+
21
+ @hide_legend = true
22
+ @hide_title = true
23
+ @hide_line_numbers = true
24
+
25
+ @marker_font_size = 60.0
26
+ @legend_font_size = 60.0
27
+ end
28
+
29
+ def draw
30
+ expand_canvas_for_vertical_legend
31
+
32
+ super
33
+
34
+ draw_vertical_legend
35
+
36
+ @d.draw(@base_image)
37
+ end # def draw
38
+
39
+ end # class Pie
40
+
41
+ end
42
+ end; end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ ##
6
+ #
7
+ # Makes a small pie graph suitable for display at 200px or even smaller.
8
+ #
9
+ module ImageParadise
10
+
11
+ module Gruff
12
+ module Mini
13
+
14
+ class SideBar < Gruff::SideBar
15
+
16
+ include Gruff::Mini::Legend
17
+
18
+ def initialize_ivars
19
+ super
20
+ @hide_legend = true
21
+ @hide_title = true
22
+ @hide_line_numbers = true
23
+
24
+ @marker_font_size = 50.0
25
+ @legend_font_size = 50.0
26
+ end
27
+
28
+ def draw
29
+ expand_canvas_for_vertical_legend
30
+
31
+ super
32
+
33
+ draw_vertical_legend
34
+
35
+ @d.draw(@base_image)
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end; end
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/graphs/base.rb'
6
+
7
+ module ImageParadise
8
+
9
+ # Experimental!!! See also the Spider graph.
10
+ class Gruff::Net < Gruff::Base
11
+
12
+ # Hide parts of the graph to fit more datapoints, or for a different appearance.
13
+ attr_accessor :hide_dots
14
+
15
+ # Dimensions of lines and dots; calculated based on dataset size if left unspecified
16
+ attr_accessor :line_width
17
+ attr_accessor :dot_radius
18
+
19
+ # === initialize
20
+ def initialize(*args)
21
+ super
22
+ @hide_dots = false
23
+ @hide_line_numbers = true
24
+ @sorted_drawing = true
25
+ end
26
+ # === draw
27
+ def draw
28
+ super
29
+ return unless @has_data
30
+
31
+ @radius = @graph_height / 2.0
32
+ @center_x = @graph_left + (@graph_width / 2.0)
33
+ @center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit
34
+
35
+ @x_increment = @graph_width / (@column_count - 1).to_f
36
+ circle_radius = dot_radius ||
37
+ clip_value_if_greater_than(@columns / (@norm_data.first[DATA_VALUES_INDEX].size * 2.5), 5.0)
38
+
39
+ @d = @d.stroke_opacity 1.0
40
+ @d = @d.stroke_width line_width ||
41
+ clip_value_if_greater_than(@columns / (@norm_data.first[DATA_VALUES_INDEX].size * 4), 5.0)
42
+
43
+ if defined?(@norm_baseline)
44
+ level = @graph_top + (@graph_height - @norm_baseline * @graph_height)
45
+ @d = @d.push
46
+ @d.stroke_color @baseline_color
47
+ @d.fill_opacity 0.0
48
+ @d.stroke_dasharray(10, 20)
49
+ @d.stroke_width 5
50
+ @d.line(@graph_left, level, @graph_left + @graph_width, level)
51
+ @d = @d.pop
52
+ end
53
+
54
+ @norm_data.each do |data_row|
55
+ @d = @d.stroke data_row[DATA_COLOR_INDEX]
56
+ @d = @d.fill data_row[DATA_COLOR_INDEX]
57
+
58
+ data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index|
59
+ next if data_point.nil?
60
+
61
+ rad_pos = index * Math::PI * 2 / @column_count
62
+ point_distance = data_point * @radius
63
+ start_x = @center_x + Math::sin(rad_pos) * point_distance
64
+ start_y = @center_y - Math::cos(rad_pos) * point_distance
65
+
66
+ next_index = index + 1 < data_row[DATA_VALUES_INDEX].length ? index + 1 : 0
67
+
68
+ next_rad_pos = next_index * Math::PI * 2 / @column_count
69
+ next_point_distance = data_row[DATA_VALUES_INDEX][next_index] * @radius
70
+ end_x = @center_x + Math::sin(next_rad_pos) * next_point_distance
71
+ end_y = @center_y - Math::cos(next_rad_pos) * next_point_distance
72
+
73
+ @d = @d.line(start_x, start_y, end_x, end_y)
74
+
75
+ @d = @d.circle(start_x, start_y, start_x - circle_radius, start_y) unless @hide_dots
76
+ end
77
+
78
+ end
79
+
80
+ @d.draw(@base_image)
81
+ end
82
+
83
+ # === draw_line_markers
84
+ #
85
+ # the lines connecting in the center, with the first line vertical
86
+ def draw_line_markers
87
+ return if @hide_line_markers
88
+
89
+
90
+ # have to do this here (AGAIN)... see draw() in this class
91
+ # because this funtion is called before the @radius, @center_x and @center_y are set
92
+ @radius = @graph_height / 2.0
93
+ @center_x = @graph_left + (@graph_width / 2.0)
94
+ @center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit
95
+
96
+
97
+ # Draw horizontal line markers and annotate with numbers
98
+ @d = @d.stroke(@marker_color)
99
+ @d = @d.stroke_width 1
100
+
101
+
102
+ (0..@column_count-1).each do |index|
103
+ rad_pos = index * Math::PI * 2 / @column_count
104
+
105
+ @d = @d.line(@center_x, @center_y, @center_x + Math::sin(rad_pos) * @radius, @center_y - Math::cos(rad_pos) * @radius)
106
+
107
+
108
+ marker_label = labels[index] ? labels[index].to_s : '000'
109
+
110
+ draw_label(@center_x, @center_y, rad_pos * 360 / (2 * Math::PI), @radius, marker_label)
111
+ end
112
+ end
113
+
114
+ private
115
+ # === draw_label
116
+ def draw_label(center_x, center_y, angle, radius, amount)
117
+ r_offset = 1.1
118
+ x_offset = center_x # + 15 # The label points need to be tweaked slightly
119
+ y_offset = center_y # + 0 # This one doesn't though
120
+ x = x_offset + (radius * r_offset * Math.sin(deg2rad(angle)))
121
+ y = y_offset - (radius * r_offset * Math.cos(deg2rad(angle)))
122
+
123
+ # Draw label
124
+ @d.fill = @marker_color
125
+ @d.font = @font if @font
126
+ @d.pointsize = scale_fontsize(20)
127
+ @d.stroke = 'transparent'
128
+ @d.font_weight = BoldWeight
129
+ @d.gravity = CenterGravity
130
+ @d.annotate_scaled(@base_image, 0, 0, x, y, amount, @scale)
131
+ end
132
+
133
+ end; end
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/graphs/base.rb'
6
+
7
+ module ImageParadise
8
+
9
+ # EXPERIMENTAL!
10
+ #
11
+ # Doesn't work yet.
12
+ #
13
+ class Gruff::PhotoBar < Gruff::Base
14
+
15
+ # TODO
16
+ #
17
+ # define base and cap in yml
18
+ # allow for image directory to be located elsewhere
19
+ # more exact measurements for bar heights (go all the way to the bottom of the graph)
20
+ # option to tile images instead of use a single image
21
+ # drop base label a few px lower so photo bar graphs can have a base dropping over the lower marker line
22
+ #
23
+
24
+ # The name of a pre-packaged photo-based theme.
25
+ attr_reader :theme
26
+
27
+ # def initialize(target_width=800)
28
+ # super
29
+ # init_photo_bar_graphics()
30
+ # end
31
+ # === draw
32
+ def draw
33
+ super
34
+ return unless @has_data
35
+
36
+ return # TODO Remove for further development
37
+
38
+ init_photo_bar_graphics()
39
+
40
+ #Draw#define_clip_path()
41
+ #Draw#clip_path(pathname)
42
+ #Draw#composite....with bar graph image OverCompositeOp
43
+ #
44
+ # See also
45
+ #
46
+ # Draw.pattern # define an image to tile as the filling of a draw object
47
+ #
48
+
49
+ # Setup spacing.
50
+ #
51
+ # Columns sit side-by-side.
52
+ spacing_factor = 0.9
53
+ @bar_width = @norm_data[0][DATA_COLOR_INDEX].columns
54
+
55
+ @norm_data.each_with_index do |data_row, row_index|
56
+
57
+ data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index|
58
+ data_point = 0 if data_point.nil?
59
+ # Use incremented x and scaled y
60
+ left_x = @graph_left + (@bar_width * (row_index + point_index + ((@data.length - 1) * point_index)))
61
+ left_y = @graph_top + (@graph_height - data_point * @graph_height) + 1
62
+ right_x = left_x + @bar_width * spacing_factor
63
+ right_y = @graph_top + @graph_height - 1
64
+
65
+ bar_image_width = data_row[DATA_COLOR_INDEX].columns
66
+ bar_image_height = right_y.to_f - left_y.to_f
67
+
68
+ # Crop to scale for data
69
+ bar_image = data_row[DATA_COLOR_INDEX].crop(0, 0, bar_image_width, bar_image_height)
70
+
71
+ @d.gravity = NorthWestGravity
72
+ @d = @d.composite(left_x, left_y, bar_image_width, bar_image_height, bar_image)
73
+
74
+ # Calculate center based on bar_width and current row
75
+ label_center = @graph_left + (@data.length * @bar_width * point_index) + (@data.length * @bar_width / 2.0)
76
+ draw_label(label_center, point_index)
77
+ end
78
+
79
+ end
80
+
81
+ @d.draw(@base_image)
82
+ end
83
+
84
+ # === theme
85
+ #
86
+ # Return the chosen theme or the default
87
+ def theme
88
+ @theme || 'plastik'
89
+ end
90
+
91
+ protected
92
+
93
+ # Sets up colors with a list of images that will be used.
94
+ # Images should be 340px tall
95
+ def init_photo_bar_graphics
96
+ color_list = Array.new
97
+ theme_dir = File.dirname(__FILE__) + '/../../assets/' + theme
98
+
99
+ Dir.open(theme_dir).each do |file|
100
+ next unless /\.png$/.match(file)
101
+ color_list << Image.read("#{theme_dir}/#{file}").first
102
+ end
103
+ @colors = color_list
104
+ end
105
+
106
+ end; end