Class: ZIMG::JPEG::SOS

Inherits:
Chunk show all
Defined in:
lib/zimg/jpeg/chunks.rb

Instance Attribute Summary collapse

Attributes inherited from Chunk

#data, #marker, #size

Instance Method Summary collapse

Methods inherited from Chunk

#crc, #export, #type

Methods inherited from Chunk

#cli_color

Constructor Details

#initialize(marker, io) ⇒ SOS

Returns a new instance of SOS.



250
251
252
253
254
255
256
257
258
259
# File 'lib/zimg/jpeg/chunks.rb', line 250

def initialize(marker, io)
  super
  sio = StringIO.new(@data)
  @ncomp = sio.read(1).ord
  @components = []
  @ncomp.times do
    @components << [sio.read(1).ord, sio.read(1).ord]
  end
  @spectral_start, @spectral_end, @successive_approx = sio.read(3).unpack("C3")
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



248
249
250
# File 'lib/zimg/jpeg/chunks.rb', line 248

def components
  @components
end

#ecsObject

Returns the value of attribute ecs.



248
249
250
# File 'lib/zimg/jpeg/chunks.rb', line 248

def ecs
  @ecs
end

#ncompObject

Returns the value of attribute ncomp.



248
249
250
# File 'lib/zimg/jpeg/chunks.rb', line 248

def ncomp
  @ncomp
end

#spectral_endObject

Returns the value of attribute spectral_end.



248
249
250
# File 'lib/zimg/jpeg/chunks.rb', line 248

def spectral_end
  @spectral_end
end

#spectral_startObject

Returns the value of attribute spectral_start.



248
249
250
# File 'lib/zimg/jpeg/chunks.rb', line 248

def spectral_start
  @spectral_start
end

#successive_approxObject

Returns the value of attribute successive_approx.



248
249
250
# File 'lib/zimg/jpeg/chunks.rb', line 248

def successive_approx
  @successive_approx
end

Instance Method Details

#inspect(*args) ⇒ Object



261
262
263
264
# File 'lib/zimg/jpeg/chunks.rb', line 261

def inspect *args
  super.chop + format("ncomp=%d components=%s spectral=%d..%d successive_approx=%d>", ncomp, components.inspect,
    spectral_start, spectral_end, successive_approx)
end