设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3352|回复: 4
打印 上一主题 下一主题

[通用发布] 描绘字符扩张 - Expansion of Text Drawing

[复制链接]

Lv2.观梦者

虚構歪曲

梦石
0
星屑
309
在线时间
1194 小时
注册时间
2010-12-18
帖子
3928

贵宾

跳转到指定楼层
1
发表于 2011-6-19 14:07:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 忧雪の伤 于 2011-8-12 00:42 编辑

适用范围:VXP(VX & XP)。
使用说明:使用说明参见脚本中的注释部分。


  1. #==============================================================================
  2. #  Chinese name: 描绘字符扩张  
  3. #  English name: Expansion of Text Drawing
  4. #------------------------------------------------------------------------------
  5. #  Pact: Idiot Script Association(ISA)
  6. #  Website: http://rpg.blue/group-215-1.html
  7. #------------------------------------------------------------------------------
  8. #  Author: 忧雪の伤
  9. #  Version: 1.0.1.0
  10. #  Update: 2011.8.11
  11. #==============================================================================

  12. #==============================================================================
  13. # ** Take down this script's message.
  14. #------------------------------------------------------------------------------
  15. #    记录这个脚本的信息。
  16. #==============================================================================

  17. $imported = {} if $imported.nil?
  18. $imported['DrawingTextEx'] = '1.0.1.0'

  19. #==============================================================================
  20. # ** Bitmap
  21. #==============================================================================

  22. class Bitmap
  23.   #--------------------------------------------------------------------------
  24.   # * Draw text and blur outline.
  25.   #--------------------------------------------------------------------------
  26.   #   描绘具有模糊边缘的文字。
  27.   #--------------------------------------------------------------------------
  28.   #   blur_draw_text(x, y, width, height, str[, align, outline_color,
  29.   #                        outline_size, blur_strength, blur_opacity])
  30.   #
  31.   #   blur_draw_text(rect, str[, align, outline_color, outline_size,
  32.   #                        blur_strength, blur_opacity])
  33.   #
  34.   #     outline_color : 边缘的颜色(Color)。
  35.   #     outline_size : 边缘的大小(Integer)。
  36.   #     blur_strength : 模糊的强度(Integer)。
  37.   #     blur_opacity : 模糊的不透明度(Fixnum)。
  38.   #--------------------------------------------------------------------------
  39.   def blur_draw_text(*args)
  40.     if args[0].is_a?(Rect)
  41.       x = args[0].x
  42.       y = args[0].y
  43.       width = args[0].width
  44.       height = args[0].height
  45.       return blur_draw_text(x, y, width, height, *args[1, 5])
  46.     end
  47.     args[5] = 0 if args[5].nil?
  48.     args[6] = Color.new(255, 255, 255) if args[6].nil?
  49.     args[7] = 0 if args[7].nil?
  50.     args[8] = 2 if args[8].nil?
  51.     args[9] = 10 if args[9].nil?
  52.     color = font.color.clone
  53.     font.color = args[6]
  54.     (-args[7]).upto(args[7]) do |x|
  55.       (-args[7]).upto(args[7]) do |y|
  56.         draw_text(args[0] + x, args[1] + y, *args[2, 4])
  57.       end
  58.     end
  59.     rect = text_size(args[4])
  60.     x_plus, y_plus = [args[0], (args[2] - rect.width) / 2 + args[0],
  61.     args[2] - rect.width + args[0]], (args[3] - rect.height) / 2 + args[1]
  62.     (-args[8]).upto(args[8]) do |x|
  63.       (-args[8]).upto(args[8]) do |y|
  64.         next if x.zero? and y.zero?
  65.         src_rect = Rect.new(x_plus[args[5]], y_plus, rect.width, rect.height)
  66.         blt(x_plus[args[5]] + x, y_plus + y, self, src_rect, args[9])
  67.       end
  68.     end
  69.     font.color = color
  70.     draw_text(*args[0, 6])
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # * Draw text and outline.
  74.   #--------------------------------------------------------------------------
  75.   #   描绘具有边缘的文字。
  76.   #--------------------------------------------------------------------------
  77.   #   outline_draw_text(x, y, width, height, str[, align, outline_color,
  78.   #                     outline_size])
  79.   #
  80.   #   outline_draw_text(rect, str[, align, outline_color, outline_size])
  81.   #
  82.   #     outline_color : 边缘的颜色(Color)。
  83.   #     outline_size : 边缘的大小(Integer)。
  84.   #--------------------------------------------------------------------------
  85.   def outline_draw_text(*args)
  86.     if args[0].is_a?(Rect)
  87.       x = args[0].x
  88.       y = args[0].y
  89.       width = args[0].width
  90.       height = args[0].height
  91.       return fade_draw_text(x, y, width, height, *args[1, 3])
  92.     end
  93.     args[5] = 0 if args[5].nil?
  94.     args[6] = Color.new(0, 0, 0) if args[6].nil?
  95.     args[7] = 1 if args[7].nil?
  96.     color = font.color.clone
  97.     font.color = args[6]
  98.     (-args[7]).upto(args[7]) do |x|
  99.       (-args[7]).upto(args[7]) do |y|
  100.         next if x.zero? and y.zero?
  101.         draw_text(args[0] + x, args[1] + y, *args[2, 4])
  102.       end
  103.     end
  104.     font.color = color
  105.     draw_text(*args[0, 6])
  106.   end
  107. end
复制代码

Lv3.寻梦者

梦石
0
星屑
1040
在线时间
1564 小时
注册时间
2008-7-30
帖子
4418

贵宾

2
发表于 2011-6-19 14:21:22 | 只看该作者
http://rpg.blue/fsl/other/isa/DrawTextExpansion/index.html

由于FSL采用的是 主版本.次版本.日期 如:1.0.1001 这样的命名法,所以我擅自改动了一些注释。

协议和注释模板(标准)本来是有区别的,注释模板只是为了方便我们建立一些信息缩影罢了:http://rpg.blue/fsl/doc/license.html

点评

注释模板用着真的习惯不能……  发表于 2011-6-19 14:25

See FScript Here:https://github.com/DeathKing/fscript
潜心编写URG3中。
所有对URG3的疑问和勘误或者建议,请移步至发布页面。
欢迎萌妹纸催更
回复 支持 反对

使用道具 举报

Lv2.观梦者

虚構歪曲

梦石
0
星屑
309
在线时间
1194 小时
注册时间
2010-12-18
帖子
3928

贵宾

3
 楼主| 发表于 2011-6-19 14:24:11 | 只看该作者
DeathKing 发表于 2011-6-19 14:21
http://rpg.blue/fsl/other/isa/DrawTextExpansion/index.html

由于FSL采用的是 主版本.次版本.日期  ...

恩。618是怎么算出来的呢?还有,脚本更新了一下,不过版本号懒得改了,也在LIB更新一下吧。
(DK大人动作真快。

点评

注释模板【不是】必须的,可以每次拷贝下来慢慢改,如果有时间的话~~ 主要是信息完备一点登入Fibrary的时候也方便。  发表于 2011-6-19 14:28
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1040
在线时间
1564 小时
注册时间
2008-7-30
帖子
4418

贵宾

4
发表于 2011-6-19 14:25:52 | 只看该作者
忧雪の伤 发表于 2011-6-19 14:24
恩。618是怎么算出来的呢?还有,脚本更新了一下,不过版本号懒得改了,也在LIB更新一下吧。
(DK大人动 ...

6月18号呗~ 现在的Fibrary是静态的,比较费人力,有时间就慢慢往上添 = =b

如果可能的话,每次用txt保存一下历史脚本,或许有用。比如这个:http://rpg.blue/fsl/rgss2/JumpSkill/index.html#_FileView


DeathKing于2011-6-19 14:43补充以下内容:
更新好了,这次多了一个 Diff 文件:http://rpg.blue/fsl/other/isa/DrawTextExpansion/index.html

点评

又麻烦更新了……对不起。  发表于 2011-6-19 14:55
算了,既然是更新,我改下版本号- -  发表于 2011-6-19 14:32
历史文本?可以考虑,以后更新会保存历史文本。原来是年月日……  发表于 2011-6-19 14:27

See FScript Here:https://github.com/DeathKing/fscript
潜心编写URG3中。
所有对URG3的疑问和勘误或者建议,请移步至发布页面。
欢迎萌妹纸催更
回复 支持 反对

使用道具 举报

Lv2.观梦者

虚構歪曲

梦石
0
星屑
309
在线时间
1194 小时
注册时间
2010-12-18
帖子
3928

贵宾

5
 楼主| 发表于 2011-8-12 00:44:24 | 只看该作者
2011.8.12 :
- 更新注释。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 11:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表