Skip to content

Commit ce16841

Browse files
author
alishdipani
committed
Added reading QuantumRange
1 parent b2b55f5 commit ce16841

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

lib/rubyplot.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module Rubyplot
3030
:double_dot,
3131
:triple_dot,
3232
].freeze
33-
33+
3434
MARKER_TYPES = [
3535
:dot,
3636
:plus,
@@ -162,6 +162,12 @@ def stop_inline
162162
@iruby_inline = false
163163
end
164164

165+
def QuantumRange
166+
# Setting Backend to Magick as Image is only implemented for Magick backend
167+
@backend = Rubyplot::Backend::MagickWrapper.new
168+
Rubyplot.backend.QuantumRange
169+
end
170+
165171
def set_backend b
166172
case b
167173
when :magick
@@ -172,4 +178,3 @@ def set_backend b
172178
end
173179
end
174180
end # module Rubyplot
175-

lib/rubyplot/artist/image.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ module Artist
33
class Image
44

55
attr_accessor :rows, :columns, :pixel_array
6+
attr_reader :QuantumRange
67

78
def initialize(columns,rows)
89
@rows = rows
910
@columns = columns
1011
@pixel_array = []
1112
@image = Rubyplot.backend.init_image(columns,rows)
13+
@QuantumRange = Rubyplot.backend.QuantumRange
1214
end
1315

1416
def imread(path)

lib/rubyplot/backend/image_backend/image_magick_wrapper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def imwrite(img, file_name)
2727
img.write(file_name)
2828
end
2929

30+
def QuantumRange
31+
Magick::QuantumRange
32+
end
33+
3034
def export_pixels(img, x, y, columns, rows, map)
3135
img.export_pixels(x, y, columns, rows, map)
3236
end

lib/rubyplot/image.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def columns=(ncols)
4242
@columns = ncols
4343
end
4444

45+
def QuantumRange
46+
@image.QuantumRange
47+
end
48+
4549
def pixel_array
4650
@image.pixel_array
4751
end

0 commit comments

Comments
 (0)