| 
 
| 赞 | 1 |  
| VIP | 0 |  
| 好人卡 | 85 |  
| 积分 | 1 |  
| 经验 | 41098 |  
| 最后登录 | 2015-3-17 |  
| 在线时间 | 1071 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间1071 小时注册时间2011-5-12帖子2317 
 | 
| 本帖最后由 月夜神音 于 2011-9-22 18:22 编辑 
 各种压力的猫君 发表于 2011-9-22 17:45 ![]() ^ ^ ! 虽然能改改简单的脚本但是很遗憾不能完全看懂……
 描边字的实现代码在3L了,可以的话麻烦帮我填进 ...
 看了一看,沉影大神的描边语句是对应他的对话脚本而设的,直接搬运当然会出问题……
 由于时间问题,小生直接搬出自己工程里的字体描边脚本= =
 复制代码class Bitmap  
  alias org_draw_text draw_text unless $!
  def draw_text(*n)
    if n[0].is_a?(Rect)
      draw_text_a(*n)
    else
      draw_text_b(*n)
    end
    org_draw_text(*n)
  end
  #--------------------------------------------------------------------------  
  # ○ 描边字  A
  #--------------------------------------------------------------------------  
  def draw_text_a(rect, text, align = 0, color = nil)  
    rect.x = rect.x + 1 if rect.x == 0
    temp = Bitmap.new(rect.width, rect.height)
    temp.font = font.dup
    maxi = [font.color.red, font.color.green, font.color.blue].max
    mini = [font.color.red, font.color.green, font.color.blue].min
    if maxi == mini 
      if maxi > 127
        temp.font.color = Color.new(0, 0, 0)
      else
        temp.font.color = Color.new(255, 255, 255)
      end
    else
      m = maxi > 127 ? 48 : 255
      l = maxi > 127 ?  0 : 128
      c = maxi > 127 ? 24 : 192
      temp.font.color.red = font.color.red == maxi ? m : font.color.red == mini ? l : c
      temp.font.color.green = font.color.green == maxi ? m : font.color.green == mini ? l : c
      temp.font.color.blue = font.color.blue == maxi ? m : font.color.blue == mini ? l : c
    end
    temp.org_draw_text(0, 0, rect.width, rect.height, text, align)
    temp.blur
    blt(rect.x, rect.y - 1, temp, temp.rect, font.color.alpha)
    blt(rect.x - 1, rect.y, temp, temp.rect, font.color.alpha)
    blt(rect.x + 1, rect.y, temp, temp.rect, font.color.alpha)
    blt(rect.x, rect.y + 1, temp, temp.rect, font.color.alpha)
    temp.dispose
  end
  #--------------------------------------------------------------------------  
  # ○ 描边字 B 
  #--------------------------------------------------------------------------  
  def draw_text_b(x, y, width, height, text, align = 0, color = nil)  
    x = x + 1 if x == 0
    width = 32 if width <= 0
    temp = Bitmap.new(width, height)
    temp.font = font.dup
    maxi = [font.color.red, font.color.green, font.color.blue].max
    mini = [font.color.red, font.color.green, font.color.blue].min
    if maxi == mini 
      if maxi > 127
        temp.font.color = Color.new(0, 0, 0)
      else
        temp.font.color = Color.new(255, 255, 255)
      end
    else
      m = maxi > 127 ? 48 : 255
      l = maxi > 127 ?  0 : 128
      c = maxi > 127 ? 24 : 192
      temp.font.color.red = font.color.red == maxi ? m : font.color.red == mini ? l : c
      temp.font.color.green = font.color.green == maxi ? m : font.color.green == mini ? l : c
      temp.font.color.blue = font.color.blue == maxi ? m : font.color.blue == mini ? l : c
    end
    temp.org_draw_text(0, 0, width, height, text, align)
    temp.blur
    blt(x, y - 1, temp, temp.rect, font.color.alpha)
    blt(x - 1, y, temp, temp.rect, font.color.alpha)
    blt(x + 1, y, temp, temp.rect, font.color.alpha)
    blt(x, y + 1, temp, temp.rect, font.color.alpha)
    temp.dispose 
  end  
end
 | 
 |