Fixed ICO implementation having a top and left offset for bitmap images, icons are now fetched at start up instead of statically being included (More work needed to fetch them after logging), fixed importer incorrectly storing executable basename instead of dirname

This commit is contained in:
2022-02-07 10:17:55 -06:00
parent fd7c858bd8
commit a9f5c29a18
14 changed files with 66 additions and 5 deletions

View File

@@ -85,7 +85,7 @@ class W3DHub
def select_bmps
@images.select do |image|
image_bmp?(image)
image_bmp?(image) && image.palette_size == 0 && image.bit_depth == 32
end
end
@@ -103,9 +103,12 @@ class W3DHub
blob = "".force_encoding("ASCII-8BIT")
width = image.width
height = image.height - 1
image.height.times do |y|
image.width.times do |x|
buf.pos = ((image.height - y) * image.width + x) * 4
buf.pos = ((height - y) * width + x + 10) * 4
blue = buf.read(1)
green = buf.read(1)
@@ -121,5 +124,18 @@ class W3DHub
Gosu::Image.from_blob(image.width, image.height, blob)
end
def image_data(image)
@file.pos = image.image_offset
StringIO.new(@file.read(image.image_size)).string
end
def save(image, filename)
if image_bmp?(image)
to_rgba32_blob(image).save(filename)
else
File.write(filename, image_data(image))
end
end
end
end