canvas_item.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. /**************************************************************************/
  2. /* canvas_item.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef CANVAS_ITEM_H
  31. #define CANVAS_ITEM_H
  32. #include "scene/main/node.h"
  33. #include "scene/resources/canvas_item_material.h"
  34. #include "scene/resources/font.h"
  35. class CanvasLayer;
  36. class MultiMesh;
  37. class StyleBox;
  38. class Window;
  39. class World2D;
  40. class CanvasItem : public Node {
  41. GDCLASS(CanvasItem, Node);
  42. friend class CanvasLayer;
  43. public:
  44. enum TextureFilter {
  45. TEXTURE_FILTER_PARENT_NODE,
  46. TEXTURE_FILTER_NEAREST,
  47. TEXTURE_FILTER_LINEAR,
  48. TEXTURE_FILTER_NEAREST_WITH_MIPMAPS,
  49. TEXTURE_FILTER_LINEAR_WITH_MIPMAPS,
  50. TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC,
  51. TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC,
  52. TEXTURE_FILTER_MAX
  53. };
  54. enum TextureRepeat {
  55. TEXTURE_REPEAT_PARENT_NODE,
  56. TEXTURE_REPEAT_DISABLED,
  57. TEXTURE_REPEAT_ENABLED,
  58. TEXTURE_REPEAT_MIRROR,
  59. TEXTURE_REPEAT_MAX,
  60. };
  61. enum ClipChildrenMode {
  62. CLIP_CHILDREN_DISABLED,
  63. CLIP_CHILDREN_ONLY,
  64. CLIP_CHILDREN_AND_DRAW,
  65. CLIP_CHILDREN_MAX,
  66. };
  67. private:
  68. mutable SelfList<Node>
  69. xform_change;
  70. RID canvas_item;
  71. StringName canvas_group;
  72. CanvasLayer *canvas_layer = nullptr;
  73. Color modulate = Color(1, 1, 1, 1);
  74. Color self_modulate = Color(1, 1, 1, 1);
  75. List<CanvasItem *> children_items;
  76. List<CanvasItem *>::Element *C = nullptr;
  77. int light_mask = 1;
  78. uint32_t visibility_layer = 1;
  79. int z_index = 0;
  80. bool z_relative = true;
  81. bool y_sort_enabled = false;
  82. Window *window = nullptr;
  83. bool visible = true;
  84. bool parent_visible_in_tree = false;
  85. bool pending_update = false;
  86. bool top_level = false;
  87. bool drawing = false;
  88. bool block_transform_notify = false;
  89. bool behind = false;
  90. bool use_parent_material = false;
  91. bool notify_local_transform = false;
  92. bool notify_transform = false;
  93. bool hide_clip_children = false;
  94. ClipChildrenMode clip_children_mode = CLIP_CHILDREN_DISABLED;
  95. mutable RS::CanvasItemTextureFilter texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
  96. mutable RS::CanvasItemTextureRepeat texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
  97. TextureFilter texture_filter = TEXTURE_FILTER_PARENT_NODE;
  98. TextureRepeat texture_repeat = TEXTURE_REPEAT_PARENT_NODE;
  99. Ref<Material> material;
  100. mutable Transform2D global_transform;
  101. mutable MTFlag global_invalid;
  102. _FORCE_INLINE_ bool _is_global_invalid() const { return is_group_processing() ? global_invalid.mt.is_set() : global_invalid.st; }
  103. void _set_global_invalid(bool p_invalid) const;
  104. void _top_level_raise_self();
  105. void _propagate_visibility_changed(bool p_parent_visible_in_tree);
  106. void _handle_visibility_change(bool p_visible);
  107. virtual void _top_level_changed();
  108. virtual void _top_level_changed_on_parent();
  109. void _redraw_callback();
  110. void _enter_canvas();
  111. void _exit_canvas();
  112. void _window_visibility_changed();
  113. void _notify_transform(CanvasItem *p_node);
  114. virtual void _physics_interpolated_changed() override;
  115. static CanvasItem *current_item_drawn;
  116. friend class Viewport;
  117. void _refresh_texture_repeat_cache() const;
  118. void _update_texture_repeat_changed(bool p_propagate);
  119. void _refresh_texture_filter_cache() const;
  120. void _update_texture_filter_changed(bool p_propagate);
  121. void _notify_transform_deferred();
  122. protected:
  123. virtual void _update_self_texture_repeat(RS::CanvasItemTextureRepeat p_texture_repeat);
  124. virtual void _update_self_texture_filter(RS::CanvasItemTextureFilter p_texture_filter);
  125. _FORCE_INLINE_ void _notify_transform() {
  126. _notify_transform(this);
  127. if (is_inside_tree() && !block_transform_notify && notify_local_transform) {
  128. notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
  129. }
  130. }
  131. void item_rect_changed(bool p_size_changed = true);
  132. void _notification(int p_what);
  133. static void _bind_methods();
  134. #ifndef DISABLE_DEPRECATED
  135. void _draw_circle_bind_compat_84472(const Point2 &p_pos, real_t p_radius, const Color &p_color);
  136. void _draw_rect_bind_compat_84523(const Rect2 &p_rect, const Color &p_color, bool p_filled, real_t p_width);
  137. void _draw_dashed_line_bind_compat_84523(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width, real_t p_dash, bool p_aligned);
  138. void _draw_multiline_bind_compat_84523(const Vector<Point2> &p_points, const Color &p_color, real_t p_width);
  139. void _draw_multiline_colors_bind_compat_84523(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width);
  140. static void _bind_compatibility_methods();
  141. #endif // DISABLE_DEPRECATED
  142. void _validate_property(PropertyInfo &p_property) const;
  143. _FORCE_INLINE_ void set_hide_clip_children(bool p_value) { hide_clip_children = p_value; }
  144. GDVIRTUAL0(_draw)
  145. public:
  146. enum {
  147. NOTIFICATION_TRANSFORM_CHANGED = SceneTree::NOTIFICATION_TRANSFORM_CHANGED, //unique
  148. NOTIFICATION_DRAW = 30,
  149. NOTIFICATION_VISIBILITY_CHANGED = 31,
  150. NOTIFICATION_ENTER_CANVAS = 32,
  151. NOTIFICATION_EXIT_CANVAS = 33,
  152. NOTIFICATION_LOCAL_TRANSFORM_CHANGED = 35,
  153. NOTIFICATION_WORLD_2D_CHANGED = 36,
  154. };
  155. /* EDITOR AND DEBUGGING */
  156. #ifdef TOOLS_ENABLED
  157. // Save and restore a CanvasItem state
  158. virtual void _edit_set_state(const Dictionary &p_state) {}
  159. virtual Dictionary _edit_get_state() const { return Dictionary(); }
  160. // Used to move the node
  161. virtual void _edit_set_position(const Point2 &p_position) = 0;
  162. virtual Point2 _edit_get_position() const = 0;
  163. // Used to scale the node
  164. virtual void _edit_set_scale(const Size2 &p_scale) = 0;
  165. virtual Size2 _edit_get_scale() const = 0;
  166. // Used to rotate the node
  167. virtual bool _edit_use_rotation() const { return false; }
  168. virtual void _edit_set_rotation(real_t p_rotation) {}
  169. virtual real_t _edit_get_rotation() const { return 0.0; }
  170. // Used to resize/move the node
  171. virtual void _edit_set_rect(const Rect2 &p_rect) {}
  172. virtual Size2 _edit_get_minimum_size() const { return Size2(-1, -1); } // LOOKS WEIRD
  173. // Used to set a pivot
  174. virtual bool _edit_use_pivot() const { return false; }
  175. virtual void _edit_set_pivot(const Point2 &p_pivot) {}
  176. virtual Point2 _edit_get_pivot() const { return Point2(); }
  177. virtual Transform2D _edit_get_transform() const;
  178. #endif // TOOLS_ENABLED
  179. #ifdef DEBUG_ENABLED
  180. // Those need to be available in debug runtime, to allow for node selection.
  181. // Select the node.
  182. virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
  183. // Used to resize/move the node.
  184. virtual bool _edit_use_rect() const { return false; } // Maybe replace with _edit_get_editmode().
  185. virtual Rect2 _edit_get_rect() const { return Rect2(0, 0, 0, 0); }
  186. #endif // DEBUG_ENABLED
  187. void update_draw_order();
  188. /* VISIBILITY */
  189. void set_visible(bool p_visible);
  190. bool is_visible() const;
  191. bool is_visible_in_tree() const;
  192. void show();
  193. void hide();
  194. void queue_redraw();
  195. void move_to_front();
  196. void set_clip_children_mode(ClipChildrenMode p_clip_mode);
  197. ClipChildrenMode get_clip_children_mode() const;
  198. virtual void set_light_mask(int p_light_mask);
  199. int get_light_mask() const;
  200. void set_modulate(const Color &p_modulate);
  201. Color get_modulate() const;
  202. Color get_modulate_in_tree() const;
  203. virtual void set_self_modulate(const Color &p_self_modulate);
  204. Color get_self_modulate() const;
  205. void set_visibility_layer(uint32_t p_visibility_layer);
  206. uint32_t get_visibility_layer() const;
  207. void set_visibility_layer_bit(uint32_t p_visibility_layer, bool p_enable);
  208. bool get_visibility_layer_bit(uint32_t p_visibility_layer) const;
  209. /* ORDERING */
  210. virtual void set_z_index(int p_z);
  211. int get_z_index() const;
  212. int get_effective_z_index() const;
  213. void set_z_as_relative(bool p_enabled);
  214. bool is_z_relative() const;
  215. virtual void set_y_sort_enabled(bool p_enabled);
  216. virtual bool is_y_sort_enabled() const;
  217. /* DRAWING API */
  218. void draw_dashed_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = -1.0, real_t p_dash = 2.0, bool p_aligned = true, bool p_antialiased = false);
  219. void draw_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
  220. void draw_polyline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
  221. void draw_polyline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width = -1.0, bool p_antialiased = false);
  222. void draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
  223. void draw_multiline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
  224. void draw_multiline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width = -1.0, bool p_antialiased = false);
  225. void draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled = true, real_t p_width = -1.0, bool p_antialiased = false);
  226. void draw_circle(const Point2 &p_pos, real_t p_radius, const Color &p_color, bool p_filled = true, real_t p_width = -1.0, bool p_antialiased = false);
  227. void draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1, 1));
  228. void draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false);
  229. void draw_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = false);
  230. void draw_msdf_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), double p_outline = 0.0, double p_pixel_range = 4.0, double p_scale = 1.0);
  231. void draw_lcd_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1));
  232. void draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p_rect);
  233. void draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture = Ref<Texture2D>());
  234. void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture2D> p_texture = Ref<Texture2D>());
  235. void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture2D> p_texture = Ref<Texture2D>());
  236. void draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1));
  237. void draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Texture2D> &p_texture);
  238. void draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, float p_width = -1, int p_font_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1.0, 1.0, 1.0), BitField<TextServer::JustificationFlag> p_jst_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND, TextServer::Direction p_direction = TextServer::DIRECTION_AUTO, TextServer::Orientation p_orientation = TextServer::ORIENTATION_HORIZONTAL) const;
  239. void draw_multiline_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, float p_width = -1, int p_font_size = Font::DEFAULT_FONT_SIZE, int p_max_lines = -1, const Color &p_modulate = Color(1.0, 1.0, 1.0), BitField<TextServer::LineBreakFlag> p_brk_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND, BitField<TextServer::JustificationFlag> p_jst_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND, TextServer::Direction p_direction = TextServer::DIRECTION_AUTO, TextServer::Orientation p_orientation = TextServer::ORIENTATION_HORIZONTAL) const;
  240. void draw_string_outline(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, float p_width = -1, int p_font_size = Font::DEFAULT_FONT_SIZE, int p_size = 1, const Color &p_modulate = Color(1.0, 1.0, 1.0), BitField<TextServer::JustificationFlag> p_jst_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND, TextServer::Direction p_direction = TextServer::DIRECTION_AUTO, TextServer::Orientation p_orientation = TextServer::ORIENTATION_HORIZONTAL) const;
  241. void draw_multiline_string_outline(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, float p_width = -1, int p_font_size = Font::DEFAULT_FONT_SIZE, int p_max_lines = -1, int p_size = 1, const Color &p_modulate = Color(1.0, 1.0, 1.0), BitField<TextServer::LineBreakFlag> p_brk_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND, BitField<TextServer::JustificationFlag> p_jst_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND, TextServer::Direction p_direction = TextServer::DIRECTION_AUTO, TextServer::Orientation p_orientation = TextServer::ORIENTATION_HORIZONTAL) const;
  242. void draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_char, int p_font_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1.0, 1.0, 1.0)) const;
  243. void draw_char_outline(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_char, int p_font_size = Font::DEFAULT_FONT_SIZE, int p_size = 1, const Color &p_modulate = Color(1.0, 1.0, 1.0)) const;
  244. void draw_set_transform(const Point2 &p_offset, real_t p_rot = 0.0, const Size2 &p_scale = Size2(1.0, 1.0));
  245. void draw_set_transform_matrix(const Transform2D &p_matrix);
  246. void draw_animation_slice(double p_animation_length, double p_slice_begin, double p_slice_end, double p_offset = 0);
  247. void draw_end_animation();
  248. static CanvasItem *get_current_item_drawn();
  249. /* RECT / TRANSFORM */
  250. void set_as_top_level(bool p_top_level);
  251. bool is_set_as_top_level() const;
  252. void set_draw_behind_parent(bool p_enable);
  253. bool is_draw_behind_parent_enabled() const;
  254. CanvasItem *get_parent_item() const;
  255. virtual Transform2D get_transform() const = 0;
  256. virtual Transform2D get_global_transform() const;
  257. virtual Transform2D get_global_transform_with_canvas() const;
  258. virtual Transform2D get_screen_transform() const;
  259. CanvasItem *get_top_level() const;
  260. _FORCE_INLINE_ RID get_canvas_item() const {
  261. return canvas_item;
  262. }
  263. void set_block_transform_notify(bool p_enable);
  264. bool is_block_transform_notify_enabled() const;
  265. Transform2D get_canvas_transform() const;
  266. Transform2D get_viewport_transform() const;
  267. Rect2 get_viewport_rect() const;
  268. RID get_viewport_rid() const;
  269. RID get_canvas() const;
  270. ObjectID get_canvas_layer_instance_id() const;
  271. Ref<World2D> get_world_2d() const;
  272. virtual void set_material(const Ref<Material> &p_material);
  273. Ref<Material> get_material() const;
  274. virtual void set_use_parent_material(bool p_use_parent_material);
  275. bool get_use_parent_material() const;
  276. Ref<InputEvent> make_input_local(const Ref<InputEvent> &p_event) const;
  277. Vector2 make_canvas_position_local(const Vector2 &screen_point) const;
  278. Vector2 get_global_mouse_position() const;
  279. Vector2 get_local_mouse_position() const;
  280. void set_notify_local_transform(bool p_enable);
  281. bool is_local_transform_notification_enabled() const;
  282. void set_notify_transform(bool p_enable);
  283. bool is_transform_notification_enabled() const;
  284. void force_update_transform();
  285. virtual void set_texture_filter(TextureFilter p_texture_filter);
  286. TextureFilter get_texture_filter() const;
  287. virtual void set_texture_repeat(TextureRepeat p_texture_repeat);
  288. TextureRepeat get_texture_repeat() const;
  289. TextureFilter get_texture_filter_in_tree() const;
  290. TextureRepeat get_texture_repeat_in_tree() const;
  291. // Used by control nodes to retrieve the parent's anchorable area
  292. virtual Rect2 get_anchorable_rect() const { return Rect2(0, 0, 0, 0); }
  293. int get_canvas_layer() const;
  294. CanvasLayer *get_canvas_layer_node() const;
  295. CanvasItem();
  296. ~CanvasItem();
  297. };
  298. VARIANT_ENUM_CAST(CanvasItem::TextureFilter)
  299. VARIANT_ENUM_CAST(CanvasItem::TextureRepeat)
  300. VARIANT_ENUM_CAST(CanvasItem::ClipChildrenMode)
  301. class CanvasTexture : public Texture2D {
  302. GDCLASS(CanvasTexture, Texture2D);
  303. OBJ_SAVE_TYPE(Texture2D); // Saves derived classes with common type so they can be interchanged.
  304. Ref<Texture2D> diffuse_texture;
  305. Ref<Texture2D> normal_texture;
  306. Ref<Texture2D> specular_texture;
  307. Color specular = Color(1, 1, 1, 1);
  308. real_t shininess = 1.0;
  309. RID canvas_texture;
  310. CanvasItem::TextureFilter texture_filter = CanvasItem::TEXTURE_FILTER_PARENT_NODE;
  311. CanvasItem::TextureRepeat texture_repeat = CanvasItem::TEXTURE_REPEAT_PARENT_NODE;
  312. protected:
  313. static void _bind_methods();
  314. public:
  315. void set_diffuse_texture(const Ref<Texture2D> &p_diffuse);
  316. Ref<Texture2D> get_diffuse_texture() const;
  317. void set_normal_texture(const Ref<Texture2D> &p_normal);
  318. Ref<Texture2D> get_normal_texture() const;
  319. void set_specular_texture(const Ref<Texture2D> &p_specular);
  320. Ref<Texture2D> get_specular_texture() const;
  321. void set_specular_color(const Color &p_color);
  322. Color get_specular_color() const;
  323. void set_specular_shininess(real_t p_shininess);
  324. real_t get_specular_shininess() const;
  325. void set_texture_filter(CanvasItem::TextureFilter p_filter);
  326. CanvasItem::TextureFilter get_texture_filter() const;
  327. void set_texture_repeat(CanvasItem::TextureRepeat p_repeat);
  328. CanvasItem::TextureRepeat get_texture_repeat() const;
  329. virtual int get_width() const override;
  330. virtual int get_height() const override;
  331. virtual bool is_pixel_opaque(int p_x, int p_y) const override;
  332. virtual bool has_alpha() const override;
  333. virtual Ref<Image> get_image() const override;
  334. virtual RID get_rid() const override;
  335. CanvasTexture();
  336. ~CanvasTexture();
  337. };
  338. #endif // CANVAS_ITEM_H