1 /**
2 Base class of anything 2D.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.canvasitem;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.node;
24 import godot.font;
25 import godot.texture;
26 import godot.mesh;
27 import godot.multimesh;
28 import godot.stylebox;
29 import godot.material;
30 import godot.world2d;
31 import godot.inputevent;
32 /**
33 Base class of anything 2D.
34 
35 Canvas items are laid out in a tree; children inherit and extend their parent's transform. $(D CanvasItem) is extended by $(D Control) for anything GUI-related, and by $(D Node2D) for anything related to the 2D engine.
36 Any $(D CanvasItem) can draw. For this, $(D update) must be called, then $(D constant NOTIFICATION_DRAW) will be received on idle time to request redraw. Because of this, canvas items don't need to be redrawn on every frame, improving the performance significantly. Several functions for drawing on the $(D CanvasItem) are provided (see `draw_*` functions). However, they can only be used inside the $(D GodotObject._notification), signal or $(D _draw) virtual functions.
37 Canvas items are drawn in tree order. By default, children are on top of their parents so a root $(D CanvasItem) will be drawn behind everything. This behavior can be changed on a per-item basis.
38 A $(D CanvasItem) can also be hidden, which will also hide its children. It provides many ways to change parameters such as modulation (for itself and its children) and self modulation (only for itself), as well as its blend mode.
39 Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed.
40 $(B Note:) Unless otherwise specified, all methods that have angle parameters must have angles specified as $(I radians). To convert degrees to radians, use $(D @GDScript.deg2rad).
41 */
42 @GodotBaseClass struct CanvasItem
43 {
44 	package(godot) enum string _GODOT_internal_name = "CanvasItem";
45 public:
46 @nogc nothrow:
47 	union { /** */ godot_object _godot_object; /** */ Node _GODOT_base; }
48 	alias _GODOT_base this;
49 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
50 	package(godot) __gshared bool _classBindingInitialized = false;
51 	package(godot) static struct GDNativeClassBinding
52 	{
53 		__gshared:
54 		@GodotName("_draw") GodotMethod!(void) _draw;
55 		@GodotName("_edit_get_pivot") GodotMethod!(Vector2) _editGetPivot;
56 		@GodotName("_edit_get_position") GodotMethod!(Vector2) _editGetPosition;
57 		@GodotName("_edit_get_rect") GodotMethod!(Rect2) _editGetRect;
58 		@GodotName("_edit_get_rotation") GodotMethod!(double) _editGetRotation;
59 		@GodotName("_edit_get_scale") GodotMethod!(Vector2) _editGetScale;
60 		@GodotName("_edit_get_state") GodotMethod!(Dictionary) _editGetState;
61 		@GodotName("_edit_get_transform") GodotMethod!(Transform2D) _editGetTransform;
62 		@GodotName("_edit_set_pivot") GodotMethod!(void, Vector2) _editSetPivot;
63 		@GodotName("_edit_set_position") GodotMethod!(void, Vector2) _editSetPosition;
64 		@GodotName("_edit_set_rect") GodotMethod!(void, Rect2) _editSetRect;
65 		@GodotName("_edit_set_rotation") GodotMethod!(void, double) _editSetRotation;
66 		@GodotName("_edit_set_scale") GodotMethod!(void, Vector2) _editSetScale;
67 		@GodotName("_edit_set_state") GodotMethod!(void, Dictionary) _editSetState;
68 		@GodotName("_edit_use_pivot") GodotMethod!(bool) _editUsePivot;
69 		@GodotName("_edit_use_rect") GodotMethod!(bool) _editUseRect;
70 		@GodotName("_edit_use_rotation") GodotMethod!(bool) _editUseRotation;
71 		@GodotName("_is_on_top") GodotMethod!(bool) _isOnTop;
72 		@GodotName("_set_on_top") GodotMethod!(void, bool) _setOnTop;
73 		@GodotName("_toplevel_raise_self") GodotMethod!(void) _toplevelRaiseSelf;
74 		@GodotName("_update_callback") GodotMethod!(void) _updateCallback;
75 		@GodotName("draw_arc") GodotMethod!(void, Vector2, double, double, double, long, Color, double, bool) drawArc;
76 		@GodotName("draw_char") GodotMethod!(double, Font, Vector2, String, String, Color) drawChar;
77 		@GodotName("draw_circle") GodotMethod!(void, Vector2, double, Color) drawCircle;
78 		@GodotName("draw_colored_polygon") GodotMethod!(void, PoolVector2Array, Color, PoolVector2Array, Texture, Texture, bool) drawColoredPolygon;
79 		@GodotName("draw_line") GodotMethod!(void, Vector2, Vector2, Color, double, bool) drawLine;
80 		@GodotName("draw_mesh") GodotMethod!(void, Mesh, Texture, Texture, Transform2D, Color) drawMesh;
81 		@GodotName("draw_multiline") GodotMethod!(void, PoolVector2Array, Color, double, bool) drawMultiline;
82 		@GodotName("draw_multiline_colors") GodotMethod!(void, PoolVector2Array, PoolColorArray, double, bool) drawMultilineColors;
83 		@GodotName("draw_multimesh") GodotMethod!(void, MultiMesh, Texture, Texture) drawMultimesh;
84 		@GodotName("draw_polygon") GodotMethod!(void, PoolVector2Array, PoolColorArray, PoolVector2Array, Texture, Texture, bool) drawPolygon;
85 		@GodotName("draw_polyline") GodotMethod!(void, PoolVector2Array, Color, double, bool) drawPolyline;
86 		@GodotName("draw_polyline_colors") GodotMethod!(void, PoolVector2Array, PoolColorArray, double, bool) drawPolylineColors;
87 		@GodotName("draw_primitive") GodotMethod!(void, PoolVector2Array, PoolColorArray, PoolVector2Array, Texture, double, Texture) drawPrimitive;
88 		@GodotName("draw_rect") GodotMethod!(void, Rect2, Color, bool, double, bool) drawRect;
89 		@GodotName("draw_set_transform") GodotMethod!(void, Vector2, double, Vector2) drawSetTransform;
90 		@GodotName("draw_set_transform_matrix") GodotMethod!(void, Transform2D) drawSetTransformMatrix;
91 		@GodotName("draw_string") GodotMethod!(void, Font, Vector2, String, Color, long) drawString;
92 		@GodotName("draw_style_box") GodotMethod!(void, StyleBox, Rect2) drawStyleBox;
93 		@GodotName("draw_texture") GodotMethod!(void, Texture, Vector2, Color, Texture) drawTexture;
94 		@GodotName("draw_texture_rect") GodotMethod!(void, Texture, Rect2, bool, Color, bool, Texture) drawTextureRect;
95 		@GodotName("draw_texture_rect_region") GodotMethod!(void, Texture, Rect2, Rect2, Color, bool, Texture, bool) drawTextureRectRegion;
96 		@GodotName("force_update_transform") GodotMethod!(void) forceUpdateTransform;
97 		@GodotName("get_canvas") GodotMethod!(RID) getCanvas;
98 		@GodotName("get_canvas_item") GodotMethod!(RID) getCanvasItem;
99 		@GodotName("get_canvas_transform") GodotMethod!(Transform2D) getCanvasTransform;
100 		@GodotName("get_global_mouse_position") GodotMethod!(Vector2) getGlobalMousePosition;
101 		@GodotName("get_global_transform") GodotMethod!(Transform2D) getGlobalTransform;
102 		@GodotName("get_global_transform_with_canvas") GodotMethod!(Transform2D) getGlobalTransformWithCanvas;
103 		@GodotName("get_light_mask") GodotMethod!(long) getLightMask;
104 		@GodotName("get_local_mouse_position") GodotMethod!(Vector2) getLocalMousePosition;
105 		@GodotName("get_material") GodotMethod!(Material) getMaterial;
106 		@GodotName("get_modulate") GodotMethod!(Color) getModulate;
107 		@GodotName("get_self_modulate") GodotMethod!(Color) getSelfModulate;
108 		@GodotName("get_transform") GodotMethod!(Transform2D) getTransform;
109 		@GodotName("get_use_parent_material") GodotMethod!(bool) getUseParentMaterial;
110 		@GodotName("get_viewport_rect") GodotMethod!(Rect2) getViewportRect;
111 		@GodotName("get_viewport_transform") GodotMethod!(Transform2D) getViewportTransform;
112 		@GodotName("get_world_2d") GodotMethod!(World2D) getWorld2d;
113 		@GodotName("hide") GodotMethod!(void) hide;
114 		@GodotName("is_draw_behind_parent_enabled") GodotMethod!(bool) isDrawBehindParentEnabled;
115 		@GodotName("is_local_transform_notification_enabled") GodotMethod!(bool) isLocalTransformNotificationEnabled;
116 		@GodotName("is_set_as_toplevel") GodotMethod!(bool) isSetAsToplevel;
117 		@GodotName("is_transform_notification_enabled") GodotMethod!(bool) isTransformNotificationEnabled;
118 		@GodotName("is_visible") GodotMethod!(bool) isVisible;
119 		@GodotName("is_visible_in_tree") GodotMethod!(bool) isVisibleInTree;
120 		@GodotName("make_canvas_position_local") GodotMethod!(Vector2, Vector2) makeCanvasPositionLocal;
121 		@GodotName("make_input_local") GodotMethod!(InputEvent, InputEvent) makeInputLocal;
122 		@GodotName("set_as_toplevel") GodotMethod!(void, bool) setAsToplevel;
123 		@GodotName("set_draw_behind_parent") GodotMethod!(void, bool) setDrawBehindParent;
124 		@GodotName("set_light_mask") GodotMethod!(void, long) setLightMask;
125 		@GodotName("set_material") GodotMethod!(void, Material) setMaterial;
126 		@GodotName("set_modulate") GodotMethod!(void, Color) setModulate;
127 		@GodotName("set_notify_local_transform") GodotMethod!(void, bool) setNotifyLocalTransform;
128 		@GodotName("set_notify_transform") GodotMethod!(void, bool) setNotifyTransform;
129 		@GodotName("set_self_modulate") GodotMethod!(void, Color) setSelfModulate;
130 		@GodotName("set_use_parent_material") GodotMethod!(void, bool) setUseParentMaterial;
131 		@GodotName("set_visible") GodotMethod!(void, bool) setVisible;
132 		@GodotName("show") GodotMethod!(void) show;
133 		@GodotName("update") GodotMethod!(void) update;
134 	}
135 	/// 
136 	pragma(inline, true) bool opEquals(in CanvasItem other) const
137 	{ return _godot_object.ptr is other._godot_object.ptr; }
138 	/// 
139 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
140 	{ _godot_object.ptr = n; return null; }
141 	/// 
142 	pragma(inline, true) bool opEquals(typeof(null) n) const
143 	{ return _godot_object.ptr is n; }
144 	/// 
145 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
146 	mixin baseCasts;
147 	/// Construct a new instance of CanvasItem.
148 	/// Note: use `memnew!CanvasItem` instead.
149 	static CanvasItem _new()
150 	{
151 		static godot_class_constructor constructor;
152 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CanvasItem");
153 		if(constructor is null) return typeof(this).init;
154 		return cast(CanvasItem)(constructor());
155 	}
156 	@disable new(size_t s);
157 	/// 
158 	enum BlendMode : int
159 	{
160 		/**
161 		Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value.
162 		*/
163 		blendModeMix = 0,
164 		/**
165 		Additive blending mode.
166 		*/
167 		blendModeAdd = 1,
168 		/**
169 		Subtractive blending mode.
170 		*/
171 		blendModeSub = 2,
172 		/**
173 		Multiplicative blending mode.
174 		*/
175 		blendModeMul = 3,
176 		/**
177 		Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
178 		*/
179 		blendModePremultAlpha = 4,
180 		/**
181 		Disables blending mode. Colors including alpha are written as-is. Only applicable for render targets with a transparent background. No lighting will be applied.
182 		*/
183 		blendModeDisabled = 5,
184 	}
185 	/// 
186 	enum Constants : int
187 	{
188 		blendModeMix = 0,
189 		blendModeAdd = 1,
190 		blendModeSub = 2,
191 		blendModeMul = 3,
192 		blendModePremultAlpha = 4,
193 		blendModeDisabled = 5,
194 		/**
195 		The $(D CanvasItem) is requested to draw.
196 		*/
197 		notificationDraw = 30,
198 		/**
199 		The $(D CanvasItem)'s visibility has changed.
200 		*/
201 		notificationVisibilityChanged = 31,
202 		/**
203 		The $(D CanvasItem) has entered the canvas.
204 		*/
205 		notificationEnterCanvas = 32,
206 		/**
207 		The $(D CanvasItem) has exited the canvas.
208 		*/
209 		notificationExitCanvas = 33,
210 		/**
211 		The $(D CanvasItem)'s transform has changed. This notification is only received if enabled by $(D setNotifyTransform) or $(D setNotifyLocalTransform).
212 		*/
213 		notificationTransformChanged = 2000,
214 	}
215 	/**
216 	Overridable function called by the engine (if defined) to draw the canvas item.
217 	*/
218 	void _draw()
219 	{
220 		Array _GODOT_args = Array.make();
221 		String _GODOT_method_name = String("_draw");
222 		this.callv(_GODOT_method_name, _GODOT_args);
223 	}
224 	/**
225 	
226 	*/
227 	Vector2 _editGetPivot() const
228 	{
229 		Array _GODOT_args = Array.make();
230 		String _GODOT_method_name = String("_edit_get_pivot");
231 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Vector2);
232 	}
233 	/**
234 	
235 	*/
236 	Vector2 _editGetPosition() const
237 	{
238 		Array _GODOT_args = Array.make();
239 		String _GODOT_method_name = String("_edit_get_position");
240 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Vector2);
241 	}
242 	/**
243 	
244 	*/
245 	Rect2 _editGetRect() const
246 	{
247 		Array _GODOT_args = Array.make();
248 		String _GODOT_method_name = String("_edit_get_rect");
249 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Rect2);
250 	}
251 	/**
252 	
253 	*/
254 	double _editGetRotation() const
255 	{
256 		Array _GODOT_args = Array.make();
257 		String _GODOT_method_name = String("_edit_get_rotation");
258 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!double);
259 	}
260 	/**
261 	
262 	*/
263 	Vector2 _editGetScale() const
264 	{
265 		Array _GODOT_args = Array.make();
266 		String _GODOT_method_name = String("_edit_get_scale");
267 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Vector2);
268 	}
269 	/**
270 	
271 	*/
272 	Dictionary _editGetState() const
273 	{
274 		Array _GODOT_args = Array.make();
275 		String _GODOT_method_name = String("_edit_get_state");
276 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Dictionary);
277 	}
278 	/**
279 	
280 	*/
281 	Transform2D _editGetTransform() const
282 	{
283 		Array _GODOT_args = Array.make();
284 		String _GODOT_method_name = String("_edit_get_transform");
285 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Transform2D);
286 	}
287 	/**
288 	
289 	*/
290 	void _editSetPivot(in Vector2 pivot)
291 	{
292 		Array _GODOT_args = Array.make();
293 		_GODOT_args.append(pivot);
294 		String _GODOT_method_name = String("_edit_set_pivot");
295 		this.callv(_GODOT_method_name, _GODOT_args);
296 	}
297 	/**
298 	
299 	*/
300 	void _editSetPosition(in Vector2 position)
301 	{
302 		Array _GODOT_args = Array.make();
303 		_GODOT_args.append(position);
304 		String _GODOT_method_name = String("_edit_set_position");
305 		this.callv(_GODOT_method_name, _GODOT_args);
306 	}
307 	/**
308 	
309 	*/
310 	void _editSetRect(in Rect2 rect)
311 	{
312 		Array _GODOT_args = Array.make();
313 		_GODOT_args.append(rect);
314 		String _GODOT_method_name = String("_edit_set_rect");
315 		this.callv(_GODOT_method_name, _GODOT_args);
316 	}
317 	/**
318 	
319 	*/
320 	void _editSetRotation(in double degrees)
321 	{
322 		Array _GODOT_args = Array.make();
323 		_GODOT_args.append(degrees);
324 		String _GODOT_method_name = String("_edit_set_rotation");
325 		this.callv(_GODOT_method_name, _GODOT_args);
326 	}
327 	/**
328 	
329 	*/
330 	void _editSetScale(in Vector2 scale)
331 	{
332 		Array _GODOT_args = Array.make();
333 		_GODOT_args.append(scale);
334 		String _GODOT_method_name = String("_edit_set_scale");
335 		this.callv(_GODOT_method_name, _GODOT_args);
336 	}
337 	/**
338 	
339 	*/
340 	void _editSetState(in Dictionary state)
341 	{
342 		Array _GODOT_args = Array.make();
343 		_GODOT_args.append(state);
344 		String _GODOT_method_name = String("_edit_set_state");
345 		this.callv(_GODOT_method_name, _GODOT_args);
346 	}
347 	/**
348 	
349 	*/
350 	bool _editUsePivot() const
351 	{
352 		Array _GODOT_args = Array.make();
353 		String _GODOT_method_name = String("_edit_use_pivot");
354 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool);
355 	}
356 	/**
357 	
358 	*/
359 	bool _editUseRect() const
360 	{
361 		Array _GODOT_args = Array.make();
362 		String _GODOT_method_name = String("_edit_use_rect");
363 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool);
364 	}
365 	/**
366 	
367 	*/
368 	bool _editUseRotation() const
369 	{
370 		Array _GODOT_args = Array.make();
371 		String _GODOT_method_name = String("_edit_use_rotation");
372 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool);
373 	}
374 	/**
375 	
376 	*/
377 	bool _isOnTop() const
378 	{
379 		Array _GODOT_args = Array.make();
380 		String _GODOT_method_name = String("_is_on_top");
381 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool);
382 	}
383 	/**
384 	
385 	*/
386 	void _setOnTop(in bool on_top)
387 	{
388 		Array _GODOT_args = Array.make();
389 		_GODOT_args.append(on_top);
390 		String _GODOT_method_name = String("_set_on_top");
391 		this.callv(_GODOT_method_name, _GODOT_args);
392 	}
393 	/**
394 	
395 	*/
396 	void _toplevelRaiseSelf()
397 	{
398 		Array _GODOT_args = Array.make();
399 		String _GODOT_method_name = String("_toplevel_raise_self");
400 		this.callv(_GODOT_method_name, _GODOT_args);
401 	}
402 	/**
403 	
404 	*/
405 	void _updateCallback()
406 	{
407 		Array _GODOT_args = Array.make();
408 		String _GODOT_method_name = String("_update_callback");
409 		this.callv(_GODOT_method_name, _GODOT_args);
410 	}
411 	/**
412 	Draws an arc between the given angles. The larger the value of `point_count`, the smoother the curve.
413 	*/
414 	void drawArc(in Vector2 center, in double radius, in double start_angle, in double end_angle, in long point_count, in Color color, in double width = 1, in bool antialiased = false)
415 	{
416 		checkClassBinding!(typeof(this))();
417 		ptrcall!(void)(GDNativeClassBinding.drawArc, _godot_object, center, radius, start_angle, end_angle, point_count, color, width, antialiased);
418 	}
419 	/**
420 	Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character.
421 	*/
422 	double drawChar(Font font, in Vector2 position, in String _char, in String next, in Color modulate = Color(1,1,1,1))
423 	{
424 		checkClassBinding!(typeof(this))();
425 		return ptrcall!(double)(GDNativeClassBinding.drawChar, _godot_object, font, position, _char, next, modulate);
426 	}
427 	/**
428 	Draws a colored circle.
429 	*/
430 	void drawCircle(in Vector2 position, in double radius, in Color color)
431 	{
432 		checkClassBinding!(typeof(this))();
433 		ptrcall!(void)(GDNativeClassBinding.drawCircle, _godot_object, position, radius, color);
434 	}
435 	/**
436 	Draws a colored polygon of any amount of points, convex or concave.
437 	*/
438 	void drawColoredPolygon(in PoolVector2Array points, in Color color, in PoolVector2Array uvs = PoolVector2Array.init, Texture texture = Texture.init, Texture normal_map = Texture.init, in bool antialiased = false)
439 	{
440 		checkClassBinding!(typeof(this))();
441 		ptrcall!(void)(GDNativeClassBinding.drawColoredPolygon, _godot_object, points, color, uvs, texture, normal_map, antialiased);
442 	}
443 	/**
444 	Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased.
445 	*/
446 	void drawLine(in Vector2 from, in Vector2 to, in Color color, in double width = 1, in bool antialiased = false)
447 	{
448 		checkClassBinding!(typeof(this))();
449 		ptrcall!(void)(GDNativeClassBinding.drawLine, _godot_object, from, to, color, width, antialiased);
450 	}
451 	/**
452 	Draws a $(D Mesh) in 2D, using the provided texture. See $(D MeshInstance2D) for related documentation.
453 	*/
454 	void drawMesh(Mesh mesh, Texture texture, Texture normal_map = Texture.init, in Transform2D transform = Transform2D.init, in Color modulate = Color(1,1,1,1))
455 	{
456 		checkClassBinding!(typeof(this))();
457 		ptrcall!(void)(GDNativeClassBinding.drawMesh, _godot_object, mesh, texture, normal_map, transform, modulate);
458 	}
459 	/**
460 	Draws multiple, parallel lines with a uniform `color`.
461 	$(B Note:) `width` and `antialiased` are currently not implemented and have no effect.
462 	*/
463 	void drawMultiline(in PoolVector2Array points, in Color color, in double width = 1, in bool antialiased = false)
464 	{
465 		checkClassBinding!(typeof(this))();
466 		ptrcall!(void)(GDNativeClassBinding.drawMultiline, _godot_object, points, color, width, antialiased);
467 	}
468 	/**
469 	Draws multiple, parallel lines with a uniform `width` and segment-by-segment coloring. Colors assigned to line segments match by index between `points` and `colors`.
470 	$(B Note:) `width` and `antialiased` are currently not implemented and have no effect.
471 	*/
472 	void drawMultilineColors(in PoolVector2Array points, in PoolColorArray colors, in double width = 1, in bool antialiased = false)
473 	{
474 		checkClassBinding!(typeof(this))();
475 		ptrcall!(void)(GDNativeClassBinding.drawMultilineColors, _godot_object, points, colors, width, antialiased);
476 	}
477 	/**
478 	Draws a $(D MultiMesh) in 2D with the provided texture. See $(D MultiMeshInstance2D) for related documentation.
479 	*/
480 	void drawMultimesh(MultiMesh multimesh, Texture texture, Texture normal_map = Texture.init)
481 	{
482 		checkClassBinding!(typeof(this))();
483 		ptrcall!(void)(GDNativeClassBinding.drawMultimesh, _godot_object, multimesh, texture, normal_map);
484 	}
485 	/**
486 	Draws a polygon of any amount of points, convex or concave.
487 	*/
488 	void drawPolygon(in PoolVector2Array points, in PoolColorArray colors, in PoolVector2Array uvs = PoolVector2Array.init, Texture texture = Texture.init, Texture normal_map = Texture.init, in bool antialiased = false)
489 	{
490 		checkClassBinding!(typeof(this))();
491 		ptrcall!(void)(GDNativeClassBinding.drawPolygon, _godot_object, points, colors, uvs, texture, normal_map, antialiased);
492 	}
493 	/**
494 	Draws interconnected line segments with a uniform `color` and `width` and optional antialiasing.
495 	*/
496 	void drawPolyline(in PoolVector2Array points, in Color color, in double width = 1, in bool antialiased = false)
497 	{
498 		checkClassBinding!(typeof(this))();
499 		ptrcall!(void)(GDNativeClassBinding.drawPolyline, _godot_object, points, color, width, antialiased);
500 	}
501 	/**
502 	Draws interconnected line segments with a uniform `width`, segment-by-segment coloring, and optional antialiasing. Colors assigned to line segments match by index between `points` and `colors`.
503 	*/
504 	void drawPolylineColors(in PoolVector2Array points, in PoolColorArray colors, in double width = 1, in bool antialiased = false)
505 	{
506 		checkClassBinding!(typeof(this))();
507 		ptrcall!(void)(GDNativeClassBinding.drawPolylineColors, _godot_object, points, colors, width, antialiased);
508 	}
509 	/**
510 	Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad.
511 	*/
512 	void drawPrimitive(in PoolVector2Array points, in PoolColorArray colors, in PoolVector2Array uvs, Texture texture = Texture.init, in double width = 1, Texture normal_map = Texture.init)
513 	{
514 		checkClassBinding!(typeof(this))();
515 		ptrcall!(void)(GDNativeClassBinding.drawPrimitive, _godot_object, points, colors, uvs, texture, width, normal_map);
516 	}
517 	/**
518 	Draws a rectangle. If `filled` is `true`, the rectangle will be filled with the `color` specified. If `filled` is `false`, the rectangle will be drawn as a stroke with the `color` and `width` specified. If `antialiased` is `true`, the lines will be antialiased.
519 	$(B Note:) `width` and `antialiased` are only effective if `filled` is `false`.
520 	*/
521 	void drawRect(in Rect2 rect, in Color color, in bool filled = true, in double width = 1, in bool antialiased = false)
522 	{
523 		checkClassBinding!(typeof(this))();
524 		ptrcall!(void)(GDNativeClassBinding.drawRect, _godot_object, rect, color, filled, width, antialiased);
525 	}
526 	/**
527 	Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this.
528 	*/
529 	void drawSetTransform(in Vector2 position, in double rotation, in Vector2 scale)
530 	{
531 		checkClassBinding!(typeof(this))();
532 		ptrcall!(void)(GDNativeClassBinding.drawSetTransform, _godot_object, position, rotation, scale);
533 	}
534 	/**
535 	Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.
536 	*/
537 	void drawSetTransformMatrix(in Transform2D xform)
538 	{
539 		checkClassBinding!(typeof(this))();
540 		ptrcall!(void)(GDNativeClassBinding.drawSetTransformMatrix, _godot_object, xform);
541 	}
542 	/**
543 	Draws `text` using the specified `font` at the `position` (bottom-left corner using the baseline of the font). The text will have its color multiplied by `modulate`. If `clip_w` is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
544 	$(B Example using the default project font:)
545 	
546 	
547 	# If using this method in a script that redraws constantly, move the
548 	# `default_font` declaration to a member variable assigned in `_ready()`
549 	# so the Control is only created once.
550 	var default_font = Control.new().get_font("font")
551 	draw_string(default_font, Vector2(64, 64), "Hello world")
552 	
553 	
554 	See also $(D Font.draw).
555 	*/
556 	void drawString(Font font, in Vector2 position, in String text, in Color modulate = Color(1,1,1,1), in long clip_w = -1)
557 	{
558 		checkClassBinding!(typeof(this))();
559 		ptrcall!(void)(GDNativeClassBinding.drawString, _godot_object, font, position, text, modulate, clip_w);
560 	}
561 	/**
562 	Draws a styled rectangle.
563 	*/
564 	void drawStyleBox(StyleBox style_box, in Rect2 rect)
565 	{
566 		checkClassBinding!(typeof(this))();
567 		ptrcall!(void)(GDNativeClassBinding.drawStyleBox, _godot_object, style_box, rect);
568 	}
569 	/**
570 	Draws a texture at a given position.
571 	*/
572 	void drawTexture(Texture texture, in Vector2 position, in Color modulate = Color(1,1,1,1), Texture normal_map = Texture.init)
573 	{
574 		checkClassBinding!(typeof(this))();
575 		ptrcall!(void)(GDNativeClassBinding.drawTexture, _godot_object, texture, position, modulate, normal_map);
576 	}
577 	/**
578 	Draws a textured rectangle at a given position, optionally modulated by a color. If `transpose` is `true`, the texture will have its X and Y coordinates swapped.
579 	*/
580 	void drawTextureRect(Texture texture, in Rect2 rect, in bool tile, in Color modulate = Color(1,1,1,1), in bool transpose = false, Texture normal_map = Texture.init)
581 	{
582 		checkClassBinding!(typeof(this))();
583 		ptrcall!(void)(GDNativeClassBinding.drawTextureRect, _godot_object, texture, rect, tile, modulate, transpose, normal_map);
584 	}
585 	/**
586 	Draws a textured rectangle region at a given position, optionally modulated by a color. If `transpose` is `true`, the texture will have its X and Y coordinates swapped.
587 	*/
588 	void drawTextureRectRegion(Texture texture, in Rect2 rect, in Rect2 src_rect, in Color modulate = Color(1,1,1,1), in bool transpose = false, Texture normal_map = Texture.init, in bool clip_uv = true)
589 	{
590 		checkClassBinding!(typeof(this))();
591 		ptrcall!(void)(GDNativeClassBinding.drawTextureRectRegion, _godot_object, texture, rect, src_rect, modulate, transpose, normal_map, clip_uv);
592 	}
593 	/**
594 	Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
595 	*/
596 	void forceUpdateTransform()
597 	{
598 		checkClassBinding!(typeof(this))();
599 		ptrcall!(void)(GDNativeClassBinding.forceUpdateTransform, _godot_object);
600 	}
601 	/**
602 	Returns the $(D RID) of the $(D World2D) canvas where this item is in.
603 	*/
604 	RID getCanvas() const
605 	{
606 		checkClassBinding!(typeof(this))();
607 		return ptrcall!(RID)(GDNativeClassBinding.getCanvas, _godot_object);
608 	}
609 	/**
610 	Returns the canvas item RID used by $(D VisualServer) for this item.
611 	*/
612 	RID getCanvasItem() const
613 	{
614 		checkClassBinding!(typeof(this))();
615 		return ptrcall!(RID)(GDNativeClassBinding.getCanvasItem, _godot_object);
616 	}
617 	/**
618 	Returns the transform matrix of this item's canvas.
619 	*/
620 	Transform2D getCanvasTransform() const
621 	{
622 		checkClassBinding!(typeof(this))();
623 		return ptrcall!(Transform2D)(GDNativeClassBinding.getCanvasTransform, _godot_object);
624 	}
625 	/**
626 	Returns the global position of the mouse.
627 	*/
628 	Vector2 getGlobalMousePosition() const
629 	{
630 		checkClassBinding!(typeof(this))();
631 		return ptrcall!(Vector2)(GDNativeClassBinding.getGlobalMousePosition, _godot_object);
632 	}
633 	/**
634 	Returns the global transform matrix of this item.
635 	*/
636 	Transform2D getGlobalTransform() const
637 	{
638 		checkClassBinding!(typeof(this))();
639 		return ptrcall!(Transform2D)(GDNativeClassBinding.getGlobalTransform, _godot_object);
640 	}
641 	/**
642 	Returns the global transform matrix of this item in relation to the canvas.
643 	*/
644 	Transform2D getGlobalTransformWithCanvas() const
645 	{
646 		checkClassBinding!(typeof(this))();
647 		return ptrcall!(Transform2D)(GDNativeClassBinding.getGlobalTransformWithCanvas, _godot_object);
648 	}
649 	/**
650 	
651 	*/
652 	long getLightMask() const
653 	{
654 		checkClassBinding!(typeof(this))();
655 		return ptrcall!(long)(GDNativeClassBinding.getLightMask, _godot_object);
656 	}
657 	/**
658 	Returns the mouse position relative to this item's position.
659 	*/
660 	Vector2 getLocalMousePosition() const
661 	{
662 		checkClassBinding!(typeof(this))();
663 		return ptrcall!(Vector2)(GDNativeClassBinding.getLocalMousePosition, _godot_object);
664 	}
665 	/**
666 	
667 	*/
668 	Ref!Material getMaterial() const
669 	{
670 		checkClassBinding!(typeof(this))();
671 		return ptrcall!(Material)(GDNativeClassBinding.getMaterial, _godot_object);
672 	}
673 	/**
674 	
675 	*/
676 	Color getModulate() const
677 	{
678 		checkClassBinding!(typeof(this))();
679 		return ptrcall!(Color)(GDNativeClassBinding.getModulate, _godot_object);
680 	}
681 	/**
682 	
683 	*/
684 	Color getSelfModulate() const
685 	{
686 		checkClassBinding!(typeof(this))();
687 		return ptrcall!(Color)(GDNativeClassBinding.getSelfModulate, _godot_object);
688 	}
689 	/**
690 	Returns the transform matrix of this item.
691 	*/
692 	Transform2D getTransform() const
693 	{
694 		checkClassBinding!(typeof(this))();
695 		return ptrcall!(Transform2D)(GDNativeClassBinding.getTransform, _godot_object);
696 	}
697 	/**
698 	
699 	*/
700 	bool getUseParentMaterial() const
701 	{
702 		checkClassBinding!(typeof(this))();
703 		return ptrcall!(bool)(GDNativeClassBinding.getUseParentMaterial, _godot_object);
704 	}
705 	/**
706 	Returns the viewport's boundaries as a $(D Rect2).
707 	*/
708 	Rect2 getViewportRect() const
709 	{
710 		checkClassBinding!(typeof(this))();
711 		return ptrcall!(Rect2)(GDNativeClassBinding.getViewportRect, _godot_object);
712 	}
713 	/**
714 	Returns this item's transform in relation to the viewport.
715 	*/
716 	Transform2D getViewportTransform() const
717 	{
718 		checkClassBinding!(typeof(this))();
719 		return ptrcall!(Transform2D)(GDNativeClassBinding.getViewportTransform, _godot_object);
720 	}
721 	/**
722 	Returns the $(D World2D) where this item is in.
723 	*/
724 	Ref!World2D getWorld2d() const
725 	{
726 		checkClassBinding!(typeof(this))();
727 		return ptrcall!(World2D)(GDNativeClassBinding.getWorld2d, _godot_object);
728 	}
729 	/**
730 	Hide the $(D CanvasItem) if it's currently visible.
731 	*/
732 	void hide()
733 	{
734 		checkClassBinding!(typeof(this))();
735 		ptrcall!(void)(GDNativeClassBinding.hide, _godot_object);
736 	}
737 	/**
738 	
739 	*/
740 	bool isDrawBehindParentEnabled() const
741 	{
742 		checkClassBinding!(typeof(this))();
743 		return ptrcall!(bool)(GDNativeClassBinding.isDrawBehindParentEnabled, _godot_object);
744 	}
745 	/**
746 	Returns `true` if local transform notifications are communicated to children.
747 	*/
748 	bool isLocalTransformNotificationEnabled() const
749 	{
750 		checkClassBinding!(typeof(this))();
751 		return ptrcall!(bool)(GDNativeClassBinding.isLocalTransformNotificationEnabled, _godot_object);
752 	}
753 	/**
754 	Returns `true` if the node is set as top-level. See $(D setAsToplevel).
755 	*/
756 	bool isSetAsToplevel() const
757 	{
758 		checkClassBinding!(typeof(this))();
759 		return ptrcall!(bool)(GDNativeClassBinding.isSetAsToplevel, _godot_object);
760 	}
761 	/**
762 	Returns `true` if global transform notifications are communicated to children.
763 	*/
764 	bool isTransformNotificationEnabled() const
765 	{
766 		checkClassBinding!(typeof(this))();
767 		return ptrcall!(bool)(GDNativeClassBinding.isTransformNotificationEnabled, _godot_object);
768 	}
769 	/**
770 	
771 	*/
772 	bool isVisible() const
773 	{
774 		checkClassBinding!(typeof(this))();
775 		return ptrcall!(bool)(GDNativeClassBinding.isVisible, _godot_object);
776 	}
777 	/**
778 	Returns `true` if the node is present in the $(D SceneTree), its $(D visible) property is `true` and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree.
779 	*/
780 	bool isVisibleInTree() const
781 	{
782 		checkClassBinding!(typeof(this))();
783 		return ptrcall!(bool)(GDNativeClassBinding.isVisibleInTree, _godot_object);
784 	}
785 	/**
786 	Assigns `screen_point` as this node's new local transform.
787 	*/
788 	Vector2 makeCanvasPositionLocal(in Vector2 screen_point) const
789 	{
790 		checkClassBinding!(typeof(this))();
791 		return ptrcall!(Vector2)(GDNativeClassBinding.makeCanvasPositionLocal, _godot_object, screen_point);
792 	}
793 	/**
794 	Transformations issued by `event`'s inputs are applied in local space instead of global space.
795 	*/
796 	Ref!InputEvent makeInputLocal(InputEvent event) const
797 	{
798 		checkClassBinding!(typeof(this))();
799 		return ptrcall!(InputEvent)(GDNativeClassBinding.makeInputLocal, _godot_object, event);
800 	}
801 	/**
802 	If `enable` is `true`, the node won't inherit its transform from parent canvas items.
803 	*/
804 	void setAsToplevel(in bool enable)
805 	{
806 		checkClassBinding!(typeof(this))();
807 		ptrcall!(void)(GDNativeClassBinding.setAsToplevel, _godot_object, enable);
808 	}
809 	/**
810 	
811 	*/
812 	void setDrawBehindParent(in bool enable)
813 	{
814 		checkClassBinding!(typeof(this))();
815 		ptrcall!(void)(GDNativeClassBinding.setDrawBehindParent, _godot_object, enable);
816 	}
817 	/**
818 	
819 	*/
820 	void setLightMask(in long light_mask)
821 	{
822 		checkClassBinding!(typeof(this))();
823 		ptrcall!(void)(GDNativeClassBinding.setLightMask, _godot_object, light_mask);
824 	}
825 	/**
826 	
827 	*/
828 	void setMaterial(Material material)
829 	{
830 		checkClassBinding!(typeof(this))();
831 		ptrcall!(void)(GDNativeClassBinding.setMaterial, _godot_object, material);
832 	}
833 	/**
834 	
835 	*/
836 	void setModulate(in Color modulate)
837 	{
838 		checkClassBinding!(typeof(this))();
839 		ptrcall!(void)(GDNativeClassBinding.setModulate, _godot_object, modulate);
840 	}
841 	/**
842 	If `enable` is `true`, children will be updated with local transform data.
843 	*/
844 	void setNotifyLocalTransform(in bool enable)
845 	{
846 		checkClassBinding!(typeof(this))();
847 		ptrcall!(void)(GDNativeClassBinding.setNotifyLocalTransform, _godot_object, enable);
848 	}
849 	/**
850 	If `enable` is `true`, children will be updated with global transform data.
851 	*/
852 	void setNotifyTransform(in bool enable)
853 	{
854 		checkClassBinding!(typeof(this))();
855 		ptrcall!(void)(GDNativeClassBinding.setNotifyTransform, _godot_object, enable);
856 	}
857 	/**
858 	
859 	*/
860 	void setSelfModulate(in Color self_modulate)
861 	{
862 		checkClassBinding!(typeof(this))();
863 		ptrcall!(void)(GDNativeClassBinding.setSelfModulate, _godot_object, self_modulate);
864 	}
865 	/**
866 	
867 	*/
868 	void setUseParentMaterial(in bool enable)
869 	{
870 		checkClassBinding!(typeof(this))();
871 		ptrcall!(void)(GDNativeClassBinding.setUseParentMaterial, _godot_object, enable);
872 	}
873 	/**
874 	
875 	*/
876 	void setVisible(in bool visible)
877 	{
878 		checkClassBinding!(typeof(this))();
879 		ptrcall!(void)(GDNativeClassBinding.setVisible, _godot_object, visible);
880 	}
881 	/**
882 	Show the $(D CanvasItem) if it's currently hidden. For controls that inherit $(D Popup), the correct way to make them visible is to call one of the multiple `popup*()` functions instead.
883 	*/
884 	void show()
885 	{
886 		checkClassBinding!(typeof(this))();
887 		ptrcall!(void)(GDNativeClassBinding.show, _godot_object);
888 	}
889 	/**
890 	Queue the $(D CanvasItem) for update. $(D constant NOTIFICATION_DRAW) will be called on idle time to request redraw.
891 	*/
892 	void update()
893 	{
894 		checkClassBinding!(typeof(this))();
895 		ptrcall!(void)(GDNativeClassBinding.update, _godot_object);
896 	}
897 	/**
898 	The rendering layers in which this $(D CanvasItem) responds to $(D Light2D) nodes.
899 	*/
900 	@property long lightMask()
901 	{
902 		return getLightMask();
903 	}
904 	/// ditto
905 	@property void lightMask(long v)
906 	{
907 		setLightMask(v);
908 	}
909 	/**
910 	The color applied to textures on this $(D CanvasItem).
911 	*/
912 	@property Color modulate()
913 	{
914 		return getModulate();
915 	}
916 	/// ditto
917 	@property void modulate(Color v)
918 	{
919 		setModulate(v);
920 	}
921 	/**
922 	The color applied to textures on this $(D CanvasItem). This is not inherited by children $(D CanvasItem)s.
923 	*/
924 	@property Color selfModulate()
925 	{
926 		return getSelfModulate();
927 	}
928 	/// ditto
929 	@property void selfModulate(Color v)
930 	{
931 		setSelfModulate(v);
932 	}
933 	/**
934 	If `true`, the object draws behind its parent.
935 	*/
936 	@property bool showBehindParent()
937 	{
938 		return isDrawBehindParentEnabled();
939 	}
940 	/// ditto
941 	@property void showBehindParent(bool v)
942 	{
943 		setDrawBehindParent(v);
944 	}
945 	/**
946 	If `true`, the object draws on top of its parent.
947 	*/
948 	@property bool showOnTop()
949 	{
950 		return _isOnTop();
951 	}
952 	/// ditto
953 	@property void showOnTop(bool v)
954 	{
955 		_setOnTop(v);
956 	}
957 	/**
958 	If `true`, the parent $(D CanvasItem)'s $(D material) property is used as this one's material.
959 	*/
960 	@property bool useParentMaterial()
961 	{
962 		return getUseParentMaterial();
963 	}
964 	/// ditto
965 	@property void useParentMaterial(bool v)
966 	{
967 		setUseParentMaterial(v);
968 	}
969 	/**
970 	If `true`, this $(D CanvasItem) is drawn. The node is only visible if all of its antecedents are visible as well (in other words, $(D isVisibleInTree) must return `true`).
971 	$(B Note:) For controls that inherit $(D Popup), the correct way to make them visible is to call one of the multiple `popup*()` functions instead.
972 	*/
973 	@property bool visible()
974 	{
975 		return isVisible();
976 	}
977 	/// ditto
978 	@property void visible(bool v)
979 	{
980 		setVisible(v);
981 	}
982 }