Class: ScrunchedAppleDosPic

Inherits:
AppleDosPic show all
Defined in:
lib/native_file_types/apple2/PackedHiResPicFormats.rb

Instance Attribute Summary

Attributes inherited from NativeFileType

#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data

Instance Method Summary collapse

Methods inherited from AppleDosPic

file_system_file_types, #header_length, load_address

Methods inherited from AppleHiResPic

buffer_to_picture, file_system_file_types, matching_score, #picture_format, #picture_height, #picture_width, scanline_offsets, #to_picture

Methods inherited from NativeFileType

#<=>, #==, all_native_file_types, best_fit, code_for_tests, compatability_score, #data_without_header, file_type_matches?, #full_filename, #header_length, #initialize, is_valid_file_if, #load_address, load_address, matching_score, native_file_types_possible_on_file_system, non_matching_score, #to_hex_dump, #to_info_dump, #type_description

Methods included from SubclassTracking

extended

Constructor Details

This class inherits a constructor from NativeFileType

Instance Method Details

#unpacked_picture_bytesObject



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/native_file_types/apple2/PackedHiResPicFormats.rb', line 158

def unpacked_picture_bytes    
  packed_buffer=data_without_header
  unpacked_buffer="\000"*8192
  in_p=0
  out_p=0
  while out_p<8192 && in_p<packed_buffer.length do
    colour_byte=packed_buffer[in_p]
    if (colour_byte==0x80) || (colour_byte==0xFF) then
      in_p+=1
      run_length=packed_buffer[in_p]
      colour_byte&=0x7F
    else
      run_length=1
    end
    in_p+=1
    run_length.times do
      unpacked_buffer[out_p]=colour_byte unless out_p>=8192
      out_p+=1
    end
  end
  unpacked_buffer
end