Image.load(id, x=nil, y=nil, width=nil, height=nil)

概要

画像を読み込んで Imageオブジェクトを生成して返します。

x, y, width, heightを指定した場合、画像ファイルの
一部分のみを切り出して Imageオブジェクトを生成します。

引数

引数名内容備考デフォルト値
id画像ID画像ファイルをエディタ上に取り込んだ際の文字列
x切り出し範囲の左上X座標nil
y切り出し範囲の左上Y座標nil
width切り出し範囲の幅nil
height切り出し範囲の鷹さnil

戻値

Imageオブジェクト

サンプル

# 画像を読み込んでキャンバスに描画します
img = Image.load("logo.png")
Window.loop do
  Window.draw(320, 240, img)
end

関連メソッド

Image.load_tiles
Image#width
Image#height
Image#set_color_key
Window.draw
Window.draw_scale
Window.draw_rot
Window.draw_ex