| 赞 | 300 |
| VIP | |
| 好人卡 | |
| 积分 | 242 |
| 经验 | |
| 最后登录 | 2026-9-9 |
| 在线时间 | 9564 小时 |
- 梦石
- 1
- 星屑
- 23236
- 在线时间
- 9564 小时
- 注册时间
- 2012-6-19
- 回帖
- 7018
 
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
通过Cache读取的Bitmap应该是留在 @cache[path] 里面下次就直接使用的吧?那么这些Bitmap是否应该在用完后dispose呢?
以自带脚本为例,在Window_Base中这两个方法对于bitmap的处理就是不同的
[pre lang="ruby" line="1"] #--------------------------------------------------------------------------
# ● 绘制图标
# enabled : 有效的标志。false 的时候使用半透明效果绘制
#--------------------------------------------------------------------------
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
end
#--------------------------------------------------------------------------
# ● 绘制角色肖像图
# enabled : 有效的标志。false 的时候使用半透明效果绘制
#--------------------------------------------------------------------------
def draw_face(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end[/pre]
究竟何时应该dispose那些Bitmap呢? |
|