class Font def marshal_dump end def marshal_load(obj) end end class Bitmap def _dump(limit) data = "\0" * width * height * 4 process_pixel { |pixels| pixels.save_data(data) } [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") end def self._load(str) w, h, zdata = str.unpack("LLa*") data = Zlib::Inflate.inflate(zdata) bmp = self.new(w, h) bmp.process_pixel { |pixels| pixels.load_data(data) } return bmp end end
class Font
def marshal_dump
end
def marshal_load(obj)
end
end
class Bitmap
def _dump(limit)
data = "\0" * width * height * 4
process_pixel { |pixels| pixels.save_data(data) }
[width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
end
def self._load(str)
w, h, zdata = str.unpack("LLa*")
data = Zlib::Inflate.inflate(zdata)
bmp = self.new(w, h)
bmp.process_pixel { |pixels| pixels.load_data(data) }
return bmp
end
end
可直接替换截图存档的核心 |