Provides functionality for drawing rectangular images.

Attributes

NameRead/write?
height R
width R

Public Class Methods


from_text (window, text, font_name, font_height, line_spacing, max_width, align)

Creates an Image that is filled with the text given to the function.

The text may contain line breaks.

The text is always rendered in white. If you want to draw it in a different color, just modulate it by the target color.

font_name:Name of a system font, or a filename to a TTF file (must contain ’/’, does not work on Linux).
font_height:Height of the font in pixels.
line_spacing:Spacing between two lines of text in pixels.
max_width:Width of the bitmap that will be returned. Text will be split into multiple lines to avoid drawing over the right border. When a single word is too long, it will be truncated.
align:One of :left, :right, :center or :justify.
# File reference/gosu.rb, line 244
    def self.from_text(window, text, font_name, font_height, line_spacing, max_width, align); end

from_text (window, text, font_name, font_height)

Creates an Image containing a line of text.

The text is always rendered in white. If you want to draw it in a different color, just modulate it by the target color.

font_name:Name of a system font, or a filename to a TTF file (must contain ’/’, does not work on Linux).
font_height:Height of the font in pixels.
# File reference/gosu.rb, line 231
    def self.from_text(window, text, font_name, font_height); end

load_tiles (window, filename_or_rmagick_image, tile_width, tile_height, tileable)

Convenience function that splits a BMP or PNG file into an array of small rectangles and creates images from them. Returns the Array containing Image instances.

tile_width:If positive, specifies the width of one tile in pixels. If negative, the bitmap is divided into -tile_width rows.
tile_height:See tile_width.
# File reference/gosu.rb, line 251
    def self.load_tiles(window, filename_or_rmagick_image, tile_width, tile_height, tileable); end

new (window, filename_or_rmagick_image, tileable, src_x, src_y, src_width, src_height)

Loads an image from a given filename that can be drawn onto the given window.

This constructor can handle PNG and BMP images. A color key of ff00ff is automatically applied to BMP type images. For more flexibility, use PNG files.

This constructor only loads a sub-rectangle of the given file. Because every call of this constructor will open the image again, it is preferable to use Image#load_tiles.

# File reference/gosu.rb, line 212
    def initialize(window, filename_or_rmagick_image, tileable, src_x, src_y, src_width, src_height); end

new (window, filename_or_rmagick_image, tileable)

Loads an image from a given filename that can be drawn onto the given window.

This constructor can handle PNG and BMP images. A color key of ff00ff is automatically applied to BMP type images. For more flexibility, use PNG files.

# File reference/gosu.rb, line 200
    def initialize(window, filename_or_rmagick_image, tileable); end

Public Instance Methods


draw (x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default)

Draws the image so its upper left corner is at (x; y).

# File reference/gosu.rb, line 215
    def draw(x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end

draw_as_quad (x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode=:default)

Like Window#draw_quad, but with this texture instead of colors. Can be used to implement advanced, non-rectangular drawing techniques and takes four points and the modulation color at each of them. The points can be in clockwise order, or in a Z shape, starting at the top left.

# File reference/gosu.rb, line 223
    def draw_as_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode=:default); end

draw_rot (x, y, z, angle, center_x=0.5, center_y=0.5, factor_x=1, factor_y=1, color=0xffffffff, mode=:default)

center_x:Relative horizontal position of the rotation center on the image. 0 is the left border, 1 is the right border, 0.5 is the center (and default)
center_y:See center_x.
# File reference/gosu.rb, line 219
    def draw_rot(x, y, z, angle, center_x=0.5, center_y=0.5, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end

gl_tex_info ()

See examples/OpenGLIntegration.rb.

# File reference/gosu.rb, line 254
    def gl_tex_info; end