lib/parsers/dpx_parser.rb
def call(io)
    io = FormatParser::IOConstraint.new(io)
    magic = io.read(4)

    return unless [BE_MAGIC, LE_MAGIC].include?(magic)

    unpack_pattern = DPX_INFO
    unpack_pattern = DPX_INFO_LE if magic == LE_MAGIC
    _num_elements, pixels_per_line, num_lines, *_ = safe_read(io, HEADER_SIZE).unpack(unpack_pattern)
    FormatParser::Image.new(
      format: :dpx,
      width_px: pixels_per_line,
      height_px: num_lines
    )
  end
# Does not include the initial 4 bytes
Does not include the initial 4 bytes
Does not include the initial 4 bytes
def call(io)
    io = FormatParser::IOConstraint.new(io)
    magic = io.read(4)
    return unless [BE_MAGIC, LE_MAGIC].include?(magic)
    unpack_pattern = DPX_INFO
    unpack_pattern = DPX_INFO_LE if magic == LE_MAGIC
    _num_elements, pixels_per_line, num_lines, *_ = safe_read(io, HEADER_SIZE).unpack(unpack_pattern)
    FormatParser::Image.new(
      format: :dpx,
      width_px: pixels_per_line,
      height_px: num_lines
    )
  end
def call ( io ) io = FormatParser :: IOConstraint . new ( io ) magic = io . read ( 4 ) return unless [ BE_MAGIC , LE_MAGIC ] . include? ( magic ) unpack_pattern = DPX_INFO unpack_pattern = DPX_INFO_LE if magic == LE_MAGIC _num_elements , pixels_per_line , num_lines , * _ = safe_read ( io , HEADER_SIZE ) . unpack ( unpack_pattern ) FormatParser :: Image . new ( format : :dpx , width_px : pixels_per_line , height_px : num_lines ) end
Does not include the initial 4 bytes
Does not include the initial 4 bytes
io