BitMap.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="BitMap" inherits="Resource" version="3.4">
  3. <brief_description>
  4. Boolean matrix.
  5. </brief_description>
  6. <description>
  7. 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.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="create">
  13. <return type="void" />
  14. <argument index="0" name="size" type="Vector2" />
  15. <description>
  16. Creates a bitmap with the specified size, filled with [code]false[/code].
  17. </description>
  18. </method>
  19. <method name="create_from_image_alpha">
  20. <return type="void" />
  21. <argument index="0" name="image" type="Image" />
  22. <argument index="1" name="threshold" type="float" default="0.1" />
  23. <description>
  24. Creates a bitmap that matches the given image dimensions, every element of the bitmap is set to [code]false[/code] if the alpha value of the image at that position is equal to [code]threshold[/code] or less, and [code]true[/code] in other case.
  25. </description>
  26. </method>
  27. <method name="get_bit" qualifiers="const">
  28. <return type="bool" />
  29. <argument index="0" name="position" type="Vector2" />
  30. <description>
  31. Returns bitmap's value at the specified position.
  32. </description>
  33. </method>
  34. <method name="get_size" qualifiers="const">
  35. <return type="Vector2" />
  36. <description>
  37. Returns bitmap's dimensions.
  38. </description>
  39. </method>
  40. <method name="get_true_bit_count" qualifiers="const">
  41. <return type="int" />
  42. <description>
  43. Returns the amount of bitmap elements that are set to [code]true[/code].
  44. </description>
  45. </method>
  46. <method name="grow_mask">
  47. <return type="void" />
  48. <argument index="0" name="pixels" type="int" />
  49. <argument index="1" name="rect" type="Rect2" />
  50. <description>
  51. Applies morphological dilation or erosion to the bitmap. If [code]pixels[/code] is positive, dilation is applied to the bitmap. If [code]pixels[/code] is negative, erosion is applied to the bitmap. [code]rect[/code] defines the area where the morphological operation is applied. Pixels located outside the [code]rect[/code] are unaffected by [method grow_mask].
  52. </description>
  53. </method>
  54. <method name="opaque_to_polygons" qualifiers="const">
  55. <return type="Array" />
  56. <argument index="0" name="rect" type="Rect2" />
  57. <argument index="1" name="epsilon" type="float" default="2.0" />
  58. <description>
  59. </description>
  60. </method>
  61. <method name="set_bit">
  62. <return type="void" />
  63. <argument index="0" name="position" type="Vector2" />
  64. <argument index="1" name="bit" type="bool" />
  65. <description>
  66. Sets the bitmap's element at the specified position, to the specified value.
  67. </description>
  68. </method>
  69. <method name="set_bit_rect">
  70. <return type="void" />
  71. <argument index="0" name="rect" type="Rect2" />
  72. <argument index="1" name="bit" type="bool" />
  73. <description>
  74. Sets a rectangular portion of the bitmap to the specified value.
  75. </description>
  76. </method>
  77. </methods>
  78. <constants>
  79. </constants>
  80. </class>