Project1
标题:
显示图片周围有空白
[打印本页]
作者:
15348784877
时间:
2016-8-4 16:04
标题:
显示图片周围有空白
显示头像的时候图片上的留白处也被一起显示了,怎么才能把这些空白忽略掉?
所用脚本如下
#——头像设置
if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
@face_file = $1 + ".png"
@x = @face_indent = 128
if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
end
@now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
end
#——左半身像设置
if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
@face
= $1
if $加密 == true
if @left_picture != nil
@left_picture.dispose
end
@left_picture = Sprite.new
@left_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
@left_picture.y =
480-@left_picture.bitmap.height
@left_picture.x = 0
@left_picture.mirror = true
@x = @face_indent = @left_picture.bitmap.width
@left_keep = true
@now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
else
if FileTest.exist?("Graphics/Faces/#{@face}")
if @left_picture != nil
@left_picture.dispose
end
@left_picture = Sprite.new
@left_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
@left_picture.y =
480-@left_picture.bitmap.height
@left_picture.x = 0
@left_picture.mirror = true
@now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
end
end
end
#——右半身像设置
if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
@face = $1
if $加密 == true
if @right_picture != nil
@right_picture.dispose
end
@right_picture = Sprite.new
@right_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
@right_picture.y =
480-@right_picture.bitmap.height
@right_picture.x =
640-@right_picture.bitmap.width
@right_keep = true
@now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
else
if FileTest.exist?("Graphics/Faces/#{@face}")
if @right_picture != nil
@right_picture.dispose
end
@right_picture = Sprite.new
@right_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
@right_picture.y =
480-@right_picture.bitmap.height
@right_picture.x =
640-@right_picture.bitmap.width
@now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
end
end
end
if (/\\[Rr]k/.match(@now_text)) != nil
@right_keep = true
@now_text.sub!(/\\[Rr]k/) { "" }
end
if (/\\[Ll]k/.match(@now_text)) != nil
@left_keep = true
@now_text.sub!(/\\[Ll]k/) { "" }
end
# 显示人物姓名
name_window_set = false
if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
name_window_set = true
name_text = $1
@now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
end
# 文字位置的判定
if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
@popchar = $1.to_i
if @popchar == -1
@x = @indent = 48
@y = 4
end
@now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
end
拜托各位大神了!
未命名.PNG
(89.75 KB, 下载次数: 10)
下载附件
保存到相册
2016-8-4 16:03 上传
作者:
御曹司
时间:
2016-8-4 19:22
用ps把空白处调成透明不可以吗?
作者:
2357691704
时间:
2016-8-5 09:55
这不是脚本的问题,是图片的问题。扣图 、 ps 或者 剪裁 把图片变成透明背景就可以了。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1