Documentation ¶
Overview ¶
Package BitMap provides methods for working with BitMap object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) AsBitMap() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) ConvertToImage() [1]gdclass.Image
- func (self Instance) Create(size Vector2i.XY)
- func (self Instance) CreateFromImageAlpha(image [1]gdclass.Image)
- func (self Instance) GetBit(x int, y int) bool
- func (self Instance) GetBitv(position Vector2i.XY) bool
- func (self Instance) GetSize() Vector2i.XY
- func (self Instance) GetTrueBitCount() int
- func (self Instance) GrowMask(pixels int, rect Rect2i.PositionSize)
- func (self Instance) OpaqueToPolygons(rect Rect2i.PositionSize) [][]Vector2.XY
- func (self Instance) Resize(new_size Vector2i.XY)
- func (self Instance) SetBit(x int, y int, bit bool)
- func (self Instance) SetBitRect(rect Rect2i.PositionSize, bit bool)
- func (self Instance) SetBitv(position Vector2i.XY, bit bool)
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Instance ¶
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.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) ConvertToImage ¶
Returns an image of the same size as the bitmap and with a [enum Image.Format] of type [constant Image.FORMAT_L8]. [code]true[/code] bits of the bitmap are being converted into white pixels, and [code]false[/code] bits into black.
func (Instance) CreateFromImageAlpha ¶
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 [param threshold] or less, and [code]true[/code] in other case.
func (Instance) GetTrueBitCount ¶
Returns the number of bitmap elements that are set to [code]true[/code].
func (Instance) GrowMask ¶
func (self Instance) GrowMask(pixels int, rect Rect2i.PositionSize)
Applies morphological dilation or erosion to the bitmap. If [param pixels] is positive, dilation is applied to the bitmap. If [param pixels] is negative, erosion is applied to the bitmap. [param rect] defines the area where the morphological operation is applied. Pixels located outside the [param rect] are unaffected by [method grow_mask].
func (Instance) OpaqueToPolygons ¶
func (self Instance) OpaqueToPolygons(rect Rect2i.PositionSize) [][]Vector2.XY
Creates an [Array] of polygons covering a rectangular portion of the bitmap. It uses a marching squares algorithm, followed by Ramer-Douglas-Peucker (RDP) reduction of the number of vertices. Each polygon is described as a [PackedVector2Array] of its vertices. To get polygons covering the whole bitmap, pass: [codeblock] Rect2(Vector2(), get_size()) [/codeblock] [param epsilon] is passed to RDP to control how accurately the polygons cover the bitmap: a lower [param epsilon] corresponds to more points in the polygons.
func (Instance) SetBit ¶
Sets the bitmap's element at the specified position, to the specified value.
func (Instance) SetBitRect ¶
func (self Instance) SetBitRect(rect Rect2i.PositionSize, bit bool)
Sets a rectangular portion of the bitmap to the specified value.
func (Instance) SetBitv ¶
Sets the bitmap's element at the specified position, to the specified value.