设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 106|回复: 0

[转载发布] Additional Blend Types

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 20:47:01 | 显示全部楼层 |阅读模式
    Additional Blend Types
    written by me​


    This is a fun hack I've found many years back. It should work with every RGSS version so disregard that we're in the RGSS3 subforum. The used graphics library not only implements the 3 blend types (normal, add, sub) we all know and love but also 4 additional ones: multiply, screen, lighten, darken. Descriptions with examples can be found hereand on many other websites. Maybe somebody out there has a use case for them.
    Feel free to use the script in commercial projects or adapt the underlying concept to font sizes without having to credit me (I'd still appreciate it though).

    This script (written by me) circumvents the bad value check by temporarily pretending to be a “good” value. This is possible because the argument to #blend_type= is unnecessarily converted to a long (or int) two times: for the check and for the internal blend type assignment; and because the conversion function sends to_int to “unknown” objects.

    Spoiler: Script
                    Ruby:       
    1. # ★ Additional Blend Types
    2. # ★★★★★★★★★★★★★★★★★
    3. #
    4. # Author/s : cremno
    5. # RGSS ver : 1 to 3
    6. # old: 0 = normal, 1 = addition, 2 = subtract
    7. # new: 3 = multiply, 4 = screen, 5 = lighten, 6 = darken
    8. class Blend_Type
    9.   def initialize(blend_type)
    10.     @blend_type = blend_type.to_i
    11.     @checked = false
    12.   end
    13.   def to_int
    14.     if @checked
    15.       @checked = false
    16.       @blend_type
    17.     else
    18.       @checked = true
    19.       @blend_type.between?(0, 6) ? 0 : @blend_type
    20.     end
    21.   end
    22. end
    23. [Plane, Sprite].each do |e|
    24.   e.class_eval do
    25.     alias cremno_blend_type= blend_type= unless $@
    26.     def blend_type=(blend_type)
    27.       self.cremno_blend_type = Blend_Type.new(blend_type)
    28.     rescue => e
    29.       raise e.class, e.message, e.backtrace[2..-1]
    30.     end
    31.   end
    32. end
    复制代码


    There isn't a demo but here's an example for XP:
                    Ruby:       
    1. $game_screen.pictures[id].show(filename, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
    2. # Show Picture: 1, 'lightmap', Upper Left (0,0), (100%,100%), 192, Lighten
    3. $game_screen.pictures[1].show('lightmap', 0, 0, 0, 100, 100, 192, 5)
    复制代码


    For VX Ace use
    1. screen
    复制代码
    instead of
    1. $game_screen
    复制代码
    . Check out this thread to get more information about how to use the equivalent of a specific event command in the Script... command.


    本贴来自国际rpgmaker官方论坛作者:cremnophobia处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/additional-blend-types.122566/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 08:30 , Processed in 0.115305 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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