Release 0.0.1.8.8.7

This commit is contained in:
WorldBosse committed 2026-10-29 21:59:06 +04:00
1 parent 3c8a17aa78
commit c7beab414c
16283 files changed
+768761 -2

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#Made by Teravisor
#Allows 2_LonaBitmapChanger.rb to read palettes exported from GIMP Palette->right click->"Export as"->"Text file..."
module BitmapChanger
class << self
alias_method :read_palette_gimptxt, :read_palette #first name must be unique among all mods
def read_palette(file_path, file_extension)
return read_gimptxt(file_path) if file_extension == ".txt"
return read_palette_gimptxt(file_path, file_extension) #change this to same name used above in alias_method
end
def read_gimptxt(file_path)
#magic to convert file into [R,G,B,R,G,B,...] array and return it
#Input: file with lines #RRGGBB\n in hex
result = []
IO.read(file_path).lines.each{|line|
r = line[1..2].to_i(16)
g = line[3..4].to_i(16)
b = line[5..6].to_i(16)
result << r << g << b
}
return result
end
end
end