s = Sprite.new
s.bitmap = Graphics.snap_to_bitmap
s.zoom_x = 0.5
s.zoom_y = 0.5
以下引用沉影不器于2009-5-19 22:06:48的发言:
既然返回的是ruby的bitmap对象,mashal就没问题
File.open("Data/bitmap.rxdata", "wb") {
|fout|
rgbs = Marshal.dump(Graphics.bitmap_data,
fout)
}
#--------------------------------------------------------------------------
# ● snap_to_bitmap
# 将位图位数据转换为 Bitmap 对象
#--------------------------------------------------------------------------
def bitdata_to_bitmap
hb = Bitmap.new(640,480)
#rgbs = self.bitmap_data
rgbs = nil
File.open("Data/bitmap.rxdata", "rb") { |fin|
rgbs = Marshal.load(fin)
}
x=y=0
indexs = [0]
for i in indexs
break if rgbs.nil?
break if rgbs[i+1].nil?
break if rgbs[i+2].nil?
break if rgbs[i+3].nil?
color = Color.new(rgbs[i+2],rgbs[i+1],rgbs,rgbs[i+3])
hb.set_pixel(x,y,color)
x += 1
if x == 640
x = 0
y += 1
end
indexs << i + 4
end
return hb
end
以下引用沉影不器于2009-5-24 19:55:46的发言:
楼主指的修改dll截图存档是想去掉dll么?改法跟我的vx脚本完全无二的,用了柳之一提供的marshal脚本后,bitmap跟普通对象一样存和读的...楼上上提供的逐点法,哎...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |