Class: AppleHiResPic
Overview
generic class for a HI-RES picture
Constant Summary
collapse
- @@scanline_offsets =
per Apple // Reference Manual for //e chapter 2, pages 22-35 also TechNote - Apple IIe #3 Double High-Resolution Graphics - web.pdx.edu/~heiss/technotes/aiie/tn.aiie.03.html HGR screen consists of 3 bands of 8 rows of 8 scanlines for each absolute scanline, what is the offset into screen ram that the 40 bytes for this scanline is stored?
Array.new(Apple2::HGR_ROWS)
Instance Attribute Summary
#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data
Class Method Summary
collapse
Instance Method Summary
collapse
#<=>, #==, 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, native_file_types_possible_on_file_system, non_matching_score, #to_hex_dump, #to_info_dump, #type_description
extended
Constructor Details
This class inherits a constructor from NativeFileType
Class Method Details
.buffer_to_picture(buffer) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/native_file_types/apple2/AppleHiResPic.rb', line 49
def self.buffer_to_picture(buffer)
canvas = PNG::Canvas.new Apple2::HGR_COLS, Apple2::HGR_ROWS, PNG::Color::Black
Apple2::HGR_ROWS.times do |y|
last_bit_set=false
40.times do |x_byte|
offset=@@scanline_offsets[y]+x_byte
current_byte=buffer[offset]
current_byte=0 if current_byte.nil? 7.times do |x_bit|
x=x_byte*7+x_bit
bit_set=((current_byte & (2**x_bit))>0)
if (bit_set) then
if (last_bit_set) then
AppleHiResPic.set_pixel(canvas,x-1,y,Apple2::HGR_WHITE)
AppleHiResPic.set_pixel(canvas,x,y,Apple2::HGR_WHITE)
else
if current_byte>=0x80 then
pallete=[Apple2::HGR_BLUE,Apple2::HGR_ORANGE]
else
pallete=[Apple2::HGR_VIOLET,Apple2::HGR_GREEN]
end
this_pixel_colour=pallete[x%2]
AppleHiResPic.set_pixel(canvas,x,y,this_pixel_colour)
AppleHiResPic.set_pixel(canvas,x+1,y,this_pixel_colour) unless x>=Apple2::HGR_COLS-1
end
end
last_bit_set=bit_set
end
end
end
png = PNG.new canvas
result=png.raw_bytes
result
end
|
.file_system_file_types ⇒ Object
should be a subclass for each file system
12
13
14
|
# File 'lib/native_file_types/apple2/AppleHiResPic.rb', line 12
def self.file_system_file_types
{}
end
|
.scanline_offsets ⇒ Object
40
41
42
|
# File 'lib/native_file_types/apple2/AppleHiResPic.rb', line 40
def self.scanline_offsets
@@scanline_offsets
end
|
Instance Method Details
98
99
100
|
# File 'lib/native_file_types/apple2/AppleHiResPic.rb', line 98
def picture_format
:png
end
|
#picture_height ⇒ Object
94
95
96
|
# File 'lib/native_file_types/apple2/AppleHiResPic.rb', line 94
def picture_height
Apple2::HGR_ROWS
end
|
#picture_width ⇒ Object
91
92
93
|
# File 'lib/native_file_types/apple2/AppleHiResPic.rb', line 91
def picture_width
Apple2::HGR_COLS
end
|