class_bitmap.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. Methods
  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:`grow_mask<class_BitMap_grow_mask>` **(** :ref:`int<class_int>` pixels, :ref:`Rect2<class_Rect2>` rect **)** |
  26. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Array<class_Array>` | :ref:`opaque_to_polygons<class_BitMap_opaque_to_polygons>` **(** :ref:`Rect2<class_Rect2>` rect, :ref:`float<class_float>` epsilon=2.0 **)** const |
  28. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`set_bit<class_BitMap_set_bit>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` bit **)** |
  30. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_bit_rect<class_BitMap_set_bit_rect>` **(** :ref:`Rect2<class_Rect2>` p_rect, :ref:`bool<class_bool>` bit **)** |
  32. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. Description
  34. -----------
  35. 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.
  36. Method Descriptions
  37. -------------------
  38. .. _class_BitMap_create:
  39. - void **create** **(** :ref:`Vector2<class_Vector2>` size **)**
  40. Creates a bitmap with the specified size, filled with false.
  41. .. _class_BitMap_create_from_image_alpha:
  42. - void **create_from_image_alpha** **(** :ref:`Image<class_Image>` image, :ref:`float<class_float>` threshold=0.1 **)**
  43. 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.
  44. .. _class_BitMap_get_bit:
  45. - :ref:`bool<class_bool>` **get_bit** **(** :ref:`Vector2<class_Vector2>` position **)** const
  46. Returns bitmap's value at the specified position.
  47. .. _class_BitMap_get_size:
  48. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)** const
  49. Returns bitmap's dimensions.
  50. .. _class_BitMap_get_true_bit_count:
  51. - :ref:`int<class_int>` **get_true_bit_count** **(** **)** const
  52. Returns the amount of bitmap elements that are set to true.
  53. .. _class_BitMap_grow_mask:
  54. - void **grow_mask** **(** :ref:`int<class_int>` pixels, :ref:`Rect2<class_Rect2>` rect **)**
  55. .. _class_BitMap_opaque_to_polygons:
  56. - :ref:`Array<class_Array>` **opaque_to_polygons** **(** :ref:`Rect2<class_Rect2>` rect, :ref:`float<class_float>` epsilon=2.0 **)** const
  57. .. _class_BitMap_set_bit:
  58. - void **set_bit** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` bit **)**
  59. Sets the bitmap's element at the specified position, to the specified value.
  60. .. _class_BitMap_set_bit_rect:
  61. - void **set_bit_rect** **(** :ref:`Rect2<class_Rect2>` p_rect, :ref:`bool<class_bool>` bit **)**
  62. Sets a rectangular portion of the bitmap to the specified value.