Class: LiteRGSS::Bitmap

Inherits:
Object
  • Object
show all
Defined in:
LiteRGSS.rb

Overview

Class that stores an image loaded from file or memory

Instance Method Summary collapse

Constructor Details

#initialize(filename_or_memory, from_memory = false) ⇒ Bitmap

Create a new bitmap

Parameters:

  • filename_or_memory (String)
  • from_memory (Boolean) (defaults to: false)

Instance Method Details

#blt(x, y, source_bitmap, source_rect)

Blit an other bitmap to this bitmap (replace pixels!)

Parameters:

  • x (Integer)

    dest x coordinate

  • y (Integer)

    dest y coordinate

  • source_bitmap (Bitmap)

    bitmap containing the copied pixels

  • source_rect (Rect)

    surface of the source_bitmap containing the copied pixels

#clear_rect(x, y, width, height)

Clear a portion of the bitmap

Parameters:

  • x (Integer)

    left corner coordinate

  • y (Integer)

    top corner coordinate

  • width (Integer)

    width of the cleared surface

  • height (Integer)

    height of the cleared surface

#disposeself

Free the bitmap

Returns:

  • (self)

#disposed?Boolean

Indicate if the bitmap is freed or not

Returns:

  • (Boolean)

#fill_rect(x, y, width, height, color)

Fill a portion of the bitmap with a color

Parameters:

  • x (Integer)

    left corner coordinate

  • y (Integer)

    top corner coordinate

  • width (Integer)

    width of the filled surface

  • height (Integer)

    height of the filled surface

  • color (Color)

    color to fill

#heightInteger

Returns the heigth of the Bitmap

Returns:

  • (Integer)

#rectRect

Returns the surface of the Bitmap

Returns:

#to_pngString?

Convert bitmap to PNG

Returns:

  • (String, nil)

    contents of the PNG, nil if couldn't be converted to PNG

#to_png_file(filename) ⇒ Boolean

Save the bitmap to a PNG file

Parameters:

  • filename (String)

    Name of the PNG file

Returns:

  • (Boolean)

    success of the operation

#update

Update the content of the bitmap (when operations where done on the bitmap)

#widthInteger

Returns the width of the Bitmap

Returns:

  • (Integer)