class_bitmap.rst 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the BitMap.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_BitMap:
  5. BitMap
  6. ======
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Boolean matrix.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`create<class_BitMap_create>` **(** :ref:`Vector2<class_vector2>` size **)** |
  16. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`create_from_image_alpha<class_BitMap_create_from_image_alpha>` **(** :ref:`Image<class_image>` image, :ref:`float<class_float>` threshold=0.1 **)** |
  18. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`get_bit<class_BitMap_get_bit>` **(** :ref:`Vector2<class_vector2>` position **)** const |
  20. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Vector2<class_vector2>` | :ref:`get_size<class_BitMap_get_size>` **(** **)** const |
  22. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_true_bit_count<class_BitMap_get_true_bit_count>` **(** **)** const |
  24. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`set_bit<class_BitMap_set_bit>` **(** :ref:`Vector2<class_vector2>` position, :ref:`bool<class_bool>` bit **)** |
  26. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_bit_rect<class_BitMap_set_bit_rect>` **(** :ref:`Rect2<class_rect2>` p_rect, :ref:`bool<class_bool>` bit **)** |
  28. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. Description
  30. -----------
  31. 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.
  32. Member Function Description
  33. ---------------------------
  34. .. _class_BitMap_create:
  35. - void **create** **(** :ref:`Vector2<class_vector2>` size **)**
  36. Creates a bitmap with the specified size, filled with false.
  37. .. _class_BitMap_create_from_image_alpha:
  38. - void **create_from_image_alpha** **(** :ref:`Image<class_image>` image, :ref:`float<class_float>` threshold=0.1 **)**
  39. Creates a bitmap that matches the given image dimensions, every element of the bitmap is set to false if the alpha value of the image at that position is equal to ``threshold`` or less, and true in other case.
  40. .. _class_BitMap_get_bit:
  41. - :ref:`bool<class_bool>` **get_bit** **(** :ref:`Vector2<class_vector2>` position **)** const
  42. Returns bitmap's value at the specified position.
  43. .. _class_BitMap_get_size:
  44. - :ref:`Vector2<class_vector2>` **get_size** **(** **)** const
  45. Returns bitmap's dimensions.
  46. .. _class_BitMap_get_true_bit_count:
  47. - :ref:`int<class_int>` **get_true_bit_count** **(** **)** const
  48. Returns the amount of bitmap elements that are set to true.
  49. .. _class_BitMap_set_bit:
  50. - void **set_bit** **(** :ref:`Vector2<class_vector2>` position, :ref:`bool<class_bool>` bit **)**
  51. Sets the bitmap's element at the specified position, to the specified value.
  52. .. _class_BitMap_set_bit_rect:
  53. - void **set_bit_rect** **(** :ref:`Rect2<class_rect2>` p_rect, :ref:`bool<class_bool>` bit **)**
  54. Sets a rectangular portion of the bitmap to the specified value.