lib/ruby_marks/recognizer.rb
def add_mark(file, position, mark = nil)
      dr = Magick::Draw.new
      if @config.scan_mode == :grid
        x = position[:x] - 9
        y = position[:y] + 5
        intensity = mark.intensity ? mark.intensity.ceil.to_s : '+'

        dr.annotate(file, 0, 0, x, y, intensity) do
          self.pointsize = 15
          self.fill = COLORS[2]
        end

        dr = Magick::Draw.new
        dr.stroke_width = 2
        dr.stroke(COLORS[1])

        dr.line(*mark.coordinates.values_at(:x1, :y1, :x2, :y1))
        dr.line(*mark.coordinates.values_at(:x2, :y1, :x2, :y2))
        dr.line(*mark.coordinates.values_at(:x2, :y2, :x1, :y2))
        dr.line(*mark.coordinates.values_at(:x1, :y2, :x1, :y1))
      else
        dr.annotate(file, 0, 0, position[:x] - 9, position[:y] + 11, '+') do
          self.pointsize = 30
          self.fill = '#900000'
        end

        dr = Magick::Draw.new
        dr.fill = '#FF0000'
        dr.point(position[:x], position[:y])
        dr.point(position[:x], position[:y] + 1)
        dr.point(position[:x] + 1, position[:y])
        dr.point(position[:x] + 1, position[:y] + 1)
      end

      dr.draw(file)
    end
def add_mark(file, position, mark = nil)
      dr = Magick::Draw.new
      if @config.scan_mode == :grid
        x = position[:x] - 9
        y = position[:y] + 5
        intensity = mark.intensity ? mark.intensity.ceil.to_s : '+'

        dr.annotate(file, 0, 0, x, y, intensity) do
          self.pointsize = 15
          self.fill = COLORS[2]
        end

        dr = Magick::Draw.new
        dr.stroke_width = 2
        dr.stroke(COLORS[1])

        dr.line(*mark.coordinates.values_at(:x1, :y1, :x2, :y1))
        dr.line(*mark.coordinates.values_at(:x2, :y1, :x2, :y2))
        dr.line(*mark.coordinates.values_at(:x2, :y2, :x1, :y2))
        dr.line(*mark.coordinates.values_at(:x1, :y2, :x1, :y1))
      else
        dr.annotate(file, 0, 0, position[:x] - 9, position[:y] + 11, '+') do
          self.pointsize = 30
          self.fill = '#900000'
        end

        dr = Magick::Draw.new
        dr.fill = '#FF0000'
        dr.point(position[:x], position[:y])
        dr.point(position[:x], position[:y] + 1)
        dr.point(position[:x] + 1, position[:y])
        dr.point(position[:x] + 1, position[:y] + 1)
      end

      dr.draw(file)
    end
rubocop:disable Metrics/MethodLength