Skip to content
bggd edited this page Jan 23, 2016 · 10 revisions
# Class Attributes

# default false(not premultiplied alpha on loading)
Image.multiply_alpha_on_load=
Image.multiply_alpha_on_load?

# Class Methods

Image.new(width, height, color = Color.rgb(255, 255, 255))

Image.load(filepath)

Image.hold_drawing(bool)

Image.hold_drawing?

# Instance Attributes

img = Image.load("hero.png")

img.w
img.h

# Instance Methods

# set texture filtering :nearest or :linear (default :nearest)
img.set_filter(min, mag)
img.get_filter() #=> [min, mag]

# angle - 0..360
img.draw(x, y, :angle => 0,
               :color => Color.rgb(255, 255, 255),
               :region => [0, 0, img.w, img.h],
               :scale => [1.0, 1.0],
               :anchor => [0.0, 0.0],
               :pivot => [0.5, 0.5],
               :flip => [false, false])

img.subimage(x, y, width, height) #=> Image

img.clear(color = Color.rgb(255, 255, 255))

# Convert the given mask color to an alpha channel in the image
img.convert_mask_to_alpha(mask_color)
Clone this wiki locally