Class: PackedProDosPic

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

Overview

picture packed in format first seen (by jonno) on an EAMON graphics disk

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 ProDosBinPic

file_system_file_types, #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



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/native_file_types/apple2/PackedHiResPicFormats.rb', line 119

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