BitMap.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="BitMap" inherits="Resource" version="3.3">
  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. </return>
  15. <argument index="0" name="size" type="Vector2">
  16. </argument>
  17. <description>
  18. Creates a bitmap with the specified size, filled with [code]false[/code].
  19. </description>
  20. </method>
  21. <method name="create_from_image_alpha">
  22. <return type="void">
  23. </return>
  24. <argument index="0" name="image" type="Image">
  25. </argument>
  26. <argument index="1" name="threshold" type="float" default="0.1">
  27. </argument>
  28. <description>
  29. 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.
  30. </description>
  31. </method>
  32. <method name="get_bit" qualifiers="const">
  33. <return type="bool">
  34. </return>
  35. <argument index="0" name="position" type="Vector2">
  36. </argument>
  37. <description>
  38. Returns bitmap's value at the specified position.
  39. </description>
  40. </method>
  41. <method name="get_size" qualifiers="const">
  42. <return type="Vector2">
  43. </return>
  44. <description>
  45. Returns bitmap's dimensions.
  46. </description>
  47. </method>
  48. <method name="get_true_bit_count" qualifiers="const">
  49. <return type="int">
  50. </return>
  51. <description>
  52. Returns the amount of bitmap elements that are set to [code]true[/code].
  53. </description>
  54. </method>
  55. <method name="grow_mask">
  56. <return type="void">
  57. </return>
  58. <argument index="0" name="pixels" type="int">
  59. </argument>
  60. <argument index="1" name="rect" type="Rect2">
  61. </argument>
  62. <description>
  63. Applies morphological dilation to the bitmap. The first argument is the dilation amount, Rect2 is the area where the dilation will be applied.
  64. </description>
  65. </method>
  66. <method name="opaque_to_polygons" qualifiers="const">
  67. <return type="Array">
  68. </return>
  69. <argument index="0" name="rect" type="Rect2">
  70. </argument>
  71. <argument index="1" name="epsilon" type="float" default="2.0">
  72. </argument>
  73. <description>
  74. </description>
  75. </method>
  76. <method name="set_bit">
  77. <return type="void">
  78. </return>
  79. <argument index="0" name="position" type="Vector2">
  80. </argument>
  81. <argument index="1" name="bit" type="bool">
  82. </argument>
  83. <description>
  84. Sets the bitmap's element at the specified position, to the specified value.
  85. </description>
  86. </method>
  87. <method name="set_bit_rect">
  88. <return type="void">
  89. </return>
  90. <argument index="0" name="rect" type="Rect2">
  91. </argument>
  92. <argument index="1" name="bit" type="bool">
  93. </argument>
  94. <description>
  95. Sets a rectangular portion of the bitmap to the specified value.
  96. </description>
  97. </method>
  98. </methods>
  99. <constants>
  100. </constants>
  101. </class>