BitMap.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="BitMap" inherits="Resource" version="3.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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="convert_to_image" qualifiers="const">
  13. <return type="Image" />
  14. <description>
  15. Returns an image of the same size as the bitmap and with a [enum Image.Format] of type [code]FORMAT_L8[/code]. [code]true[/code] bits of the bitmap are being converted into white pixels, and [code]false[/code] bits into black.
  16. </description>
  17. </method>
  18. <method name="create">
  19. <return type="void" />
  20. <argument index="0" name="size" type="Vector2" />
  21. <description>
  22. Creates a bitmap with the specified size, filled with [code]false[/code].
  23. </description>
  24. </method>
  25. <method name="create_from_image_alpha">
  26. <return type="void" />
  27. <argument index="0" name="image" type="Image" />
  28. <argument index="1" name="threshold" type="float" default="0.1" />
  29. <description>
  30. 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.
  31. </description>
  32. </method>
  33. <method name="get_bit" qualifiers="const">
  34. <return type="bool" />
  35. <argument index="0" name="position" type="Vector2" />
  36. <description>
  37. Returns bitmap's value at the specified position.
  38. </description>
  39. </method>
  40. <method name="get_size" qualifiers="const">
  41. <return type="Vector2" />
  42. <description>
  43. Returns bitmap's dimensions.
  44. </description>
  45. </method>
  46. <method name="get_true_bit_count" qualifiers="const">
  47. <return type="int" />
  48. <description>
  49. Returns the amount of bitmap elements that are set to [code]true[/code].
  50. </description>
  51. </method>
  52. <method name="grow_mask">
  53. <return type="void" />
  54. <argument index="0" name="pixels" type="int" />
  55. <argument index="1" name="rect" type="Rect2" />
  56. <description>
  57. 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].
  58. </description>
  59. </method>
  60. <method name="opaque_to_polygons" qualifiers="const">
  61. <return type="Array" />
  62. <argument index="0" name="rect" type="Rect2" />
  63. <argument index="1" name="epsilon" type="float" default="2.0" />
  64. <description>
  65. </description>
  66. </method>
  67. <method name="resize">
  68. <return type="void" />
  69. <argument index="0" name="new_size" type="Vector2" />
  70. <description>
  71. Resizes the image to [code]new_size[/code].
  72. </description>
  73. </method>
  74. <method name="set_bit">
  75. <return type="void" />
  76. <argument index="0" name="position" type="Vector2" />
  77. <argument index="1" name="bit" type="bool" />
  78. <description>
  79. Sets the bitmap's element at the specified position, to the specified value.
  80. </description>
  81. </method>
  82. <method name="set_bit_rect">
  83. <return type="void" />
  84. <argument index="0" name="rect" type="Rect2" />
  85. <argument index="1" name="bit" type="bool" />
  86. <description>
  87. Sets a rectangular portion of the bitmap to the specified value.
  88. </description>
  89. </method>
  90. </methods>
  91. <constants>
  92. </constants>
  93. </class>