BitMap

Inherits: Resource < Reference < Object Boolean matrix.

Description

A two-dimensional array of boolean values, can be used to efficiently store a binary matrix (every matrix element takes only one bit) and query the values using natural cartesian coordinates.

Methods

Method Descriptions

  • create ( Vector2 size ) false.

  • create_from_image_alpha ( Image image, float threshold=0.1 ) false if the alpha value of the image at that position is equal to threshold or less, and true in other case.

  • bool get_bit ( Vector2 position ) const Returns bitmap’s value at the specified position.

  • Vector2 get_size ( ) const Returns bitmap’s dimensions.

  • int get_true_bit_count ( ) const true.

  • grow_mask ( int pixels, Rect2 rect ) pixels is positive, dilation is applied to the bitmap. If pixels is negative, erosion is applied to the bitmap. rect defines the area where the morphological operation is applied. Pixels located outside the rect are unaffected by grow_mask.

- Array opaque_to_polygons ( Rect2 rect, float epsilon=2.0 ) const

  • set_bit ( Vector2 position, bool bit ) Sets the bitmap’s element at the specified position, to the specified value.

  • set_bit_rect ( Rect2 rect, bool bit ) Sets a rectangular portion of the bitmap to the specified value.