# Bitmap

Sprites ([Sprite](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/sprite)) and other objects must be used to display bitmaps on the screen.

## Superclass

* [Object](https://enls.gitbook.io/rgss-reference-manual/standard-library/built-in-classes/object)

## Class Methods

### Bitmap.new(filename)

Loads the graphic file specified in filename and creates a bitmap object.

Also automatically searches files included in RGSS-RTP and encrypted archives. File extensions may be omitted.

### Bitmap.new(width, height)

Creates a bitmap object with the specified size.

## Methods

### dispose

Frees the bitmap. If the bitmap has already been freed, does nothing.

### disposed?

Returns TRUE if the bitmap has been freed.

### width

Gets the bitmap width.

### height

Gets the bitmap height.

### rect

Gets the bitmap rectangle ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)).

### blt(x, y, src\_bitmap, src\_rect\[, opacity])

Performs a block transfer from the src\_bitmap box src\_rect ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)) to the specified bitmap coordinates (x, y).

opacity can be set from 0 to 255.

### stretch\_blt(dest\_rect, src\_bitmap, src\_rect\[, opacity])

Performs a block transfer from the src\_bitmap box src\_rect ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)) to the specified bitmap box dest\_rect ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)).

opacity can be set from 0 to 255.

### fill\_rect(x, y, width, height, color)fill\_rect(rect, color)

Fills the bitmap box (x, y, width, height) or rect ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)) with color ([Color](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/color)).

### clear

Clears the entire bitmap.

### get\_pixel(x, y)

Gets the color ([Color](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/color)) at the specified pixel (x, y).

### set\_pixel(x, y, color)

Sets the specified pixel (x, y) to color ([Color](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/color)).

### hue\_change(hue)

Changes the bitmap's hue within 360 degrees of displacement.

This process is time-consuming. Furthermore, due to conversion errors, repeated hue changes may result in color loss.

### draw\_text(x, y, width, height, str\[, align])draw\_text(rect, str\[, align])

Draws a string str in the bitmap box (x, y, width, height) or rect ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)).

If the text length exceeds the box's width, the text width will automatically be reduced by up to 60 percent.

Horizontal text is left-aligned by default; set align to 1 to center the text and to 2 to right-align it. Vertical text is always centered.

As this process is time-consuming, redrawing the text with every frame is not recommended.

### text\_size(str)

Gets the box ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/rect)) used when drawing a string str with the draw\_text method. Does not include the angled portions of italicized text.

## Property

### font

The font ([Font](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/font)) used to draw a string with the draw\_text method.
