mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
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:
20
lib/ico.rb
20
lib/ico.rb
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user