Sha256: 67ccaf87deef0f6a962d619caac36a860f24d8343c719eed0a878f1174b46a98

Contents?: true

Size: 714 Bytes

Versions: 3

Compression:

Stored size: 714 Bytes

Contents

module Squib
  module Sprues
    class CropLine
      attr_reader :x1, :y1, :x2, :y2

      def initialize(type, position, sheet_width, sheet_height, dpi)
        method = "parse_#{type}"
        send method, position, sheet_width, sheet_height, dpi
      end

      def parse_horizontal(position, sheet_width, _, dpi)
        position = Args::UnitConversion.parse(position, dpi)
        @x1 = 0
        @y1 = position
        @x2 = sheet_width
        @y2 = position
      end

      def parse_vertical(position, _, sheet_height, dpi)
        position = Args::UnitConversion.parse(position, dpi)
        @x1 = position
        @y1 = 0
        @x2 = position
        @y2 = sheet_height
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.15.2 lib/squib/sprues/crop_line.rb
squib-0.15.1 lib/squib/sprues/crop_line.rb
squib-0.14.2 lib/squib/sprues/crop_line.rb