class Mork::GridOMR
@private
Public Class Methods
new(options=nil)
click to toggle source
Calls superclass method
Mork::Grid::new
# File lib/mork/grid_omr.rb, line 8 def initialize(options=nil) super options end
Public Instance Methods
barcode_areas(bits)
click to toggle source
# File lib/mork/grid_omr.rb, line 18 def barcode_areas(bits) [].tap do |areas| bits.each_with_index do |b, i| areas << barcode_bit_area(i+1) if b end end end
barcode_bit_area(bit)
click to toggle source
# File lib/mork/grid_omr.rb, line 49 def barcode_bit_area(bit) coord barcode_bit_x(bit), barcode_y, barcode_width, barcode_height end
calibration_cell_areas()
click to toggle source
# File lib/mork/grid_omr.rb, line 43 def calibration_cell_areas rows.times.map do |q| coord cal_cell_x, cell_y(q), cell_width, cell_height end end
choice_cell_area(q, c)
click to toggle source
# File lib/mork/grid_omr.rb, line 39 def choice_cell_area(q, c) choice_cell_areas[q][c] end
choice_cell_areas()
click to toggle source
ink_black_area()
click to toggle source
# File lib/mork/grid_omr.rb, line 58 def ink_black_area() barcode_bit_area( 0) end
paper_white_area()
click to toggle source
# File lib/mork/grid_omr.rb, line 57 def paper_white_area() barcode_bit_area(-1) end
rm_crop_area(corner)
click to toggle source
# File lib/mork/grid_omr.rb, line 53 def rm_crop_area(corner) coord rx(corner), ry(corner), reg_crop, reg_crop, ppu_x, ppu_y end
set_page_size(width, height)
click to toggle source
# File lib/mork/grid_omr.rb, line 12 def set_page_size(width, height) @px = width.to_f @py = height.to_f self end
Private Instance Methods
coord(x, y, w, h, cX=cx, cY=cy)
click to toggle source
# File lib/mork/grid_omr.rb, line 67 def coord(x, y, w, h, cX=cx, cY=cy) Coord.new w, h: h, x: x, y: y, cx: cX, cy: cY end
cx()
click to toggle source
# File lib/mork/grid_omr.rb, line 62 def cx() @px / reg_frame_width end
cy()
click to toggle source
# File lib/mork/grid_omr.rb, line 63 def cy() @py / reg_frame_height end
ppu_x()
click to toggle source
# File lib/mork/grid_omr.rb, line 64 def ppu_x() @px / page_width end
ppu_y()
click to toggle source
# File lib/mork/grid_omr.rb, line 65 def ppu_y() @py / page_height end
rx(corner)
click to toggle source
iterationless x registration
# File lib/mork/grid_omr.rb, line 72 def rx(corner) case corner when :tl; reg_off when :tr; page_width - reg_crop - reg_off when :br; page_width - reg_crop - reg_off when :bl; reg_off end end
ry(corner)
click to toggle source
# File lib/mork/grid_omr.rb, line 81 def ry(corner) case corner when :tl; reg_off when :tr; reg_off when :br; page_height - reg_crop - reg_off when :bl; page_height - reg_crop - reg_off end end