Method: Ruby2D::Canvas#draw_pixmap

Defined in:
lib/ruby2d/canvas.rb

#draw_pixmap(pixmap, x:, y:, width: nil, height: nil, crop: nil) ⇒ Object

Note:

This API will evolve to be able to draw a portion of the pixmap; coming soon.

Draw the pixmap at the specified location and size

Parameters:

  • pixmap (Pixmap)
  • x (Numeric)
  • y (Numeric)
  • width (Numeric) (defaults to: nil)

    Optional, specify to scale the size

  • height (Numeric) (defaults to: nil)

    Optional, specify to scale the size

  • crop (Hash) (defaults to: nil)

    Optional, specify a hash with ‘x:, y:, width:, height:` to crop from within the pixmap to draw.



275
276
277
278
# File 'lib/ruby2d/canvas.rb', line 275

def draw_pixmap(pixmap, x:, y:, width: nil, height: nil, crop: nil)
  src_rect = crop ? [crop[:x], crop[:y], crop[:width], crop[:height]] : nil
  ext_draw_pixmap pixmap, src_rect, x, y, width, height
end