# File lib/native_file_types/apple2/ApplePrintShopMiniPix.rb, line 17 def to_picture canvas = PNG::Canvas.new picture_width, picture_height, PNG::Color::Green buffer=data_without_header 52.times do |y| row_data=buffer[y*11,11] x=0 row_data.each_byte do |byte| 8.times do |bit_offset| bitmask=0b10000000>>bit_offset # puts "y #{y} x #{x} byte #{"%08b" % byte} bit #{bit_offset} #{"%08b" % bitmask}" if ((byte & bitmask)==bitmask) then canvas[x, y]= APS_MINIPIX_FOREGROUND else canvas[x, y]= APS_MINIPIX_BACKGROUND end x+=1 end end end png = PNG.new canvas result=png.raw_bytes result end