Unverified Commit 901832e2 by Rémi Verschelde Committed by GitHub

Merge pull request #39113 from nekomatata/bbcode-image-color

Add color option for img bbcode tag in RichTextLabel to tint images
parents 7460bc36 7b7d4ef0
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
</argument> </argument>
<argument index="2" name="height" type="int" default="0"> <argument index="2" name="height" type="int" default="0">
</argument> </argument>
<argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description> <description>
Adds an image's opening and closing tags to the tag stack, optionally providing a [code]width[/code] and [code]height[/code] to resize the image. Adds an image's opening and closing tags to the tag stack, optionally providing a [code]width[/code] and [code]height[/code] to resize the image and a [code]color[/code] to tint the image.
If [code]width[/code] or [code]height[/code] is set to 0, the image size will be adjusted in order to keep the original aspect ratio. If [code]width[/code] or [code]height[/code] is set to 0, the image size will be adjusted in order to keep the original aspect ratio.
</description> </description>
</method> </method>
......
...@@ -149,6 +149,7 @@ private: ...@@ -149,6 +149,7 @@ private:
struct ItemImage : public Item { struct ItemImage : public Item {
Ref<Texture2D> image; Ref<Texture2D> image;
Size2 size; Size2 size;
Color color;
ItemImage() { type = ITEM_IMAGE; } ItemImage() { type = ITEM_IMAGE; }
}; };
...@@ -381,6 +382,8 @@ private: ...@@ -381,6 +382,8 @@ private:
bool _find_by_type(Item *p_item, ItemType p_type); bool _find_by_type(Item *p_item, ItemType p_type);
void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack); void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack);
static Color _get_color_from_string(const String &p_color_str, const Color &p_default_color);
void _update_scroll(); void _update_scroll();
void _update_fx(ItemFrame *p_frame, float p_delta_time); void _update_fx(ItemFrame *p_frame, float p_delta_time);
void _scroll_changed(double); void _scroll_changed(double);
...@@ -406,7 +409,7 @@ protected: ...@@ -406,7 +409,7 @@ protected:
public: public:
String get_text(); String get_text();
void add_text(const String &p_text); void add_text(const String &p_text);
void add_image(const Ref<Texture2D> &p_image, const int p_width = 0, const int p_height = 0); void add_image(const Ref<Texture2D> &p_image, const int p_width = 0, const int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0));
void add_newline(); void add_newline();
bool remove_line(const int p_line); bool remove_line(const int p_line);
void push_font(const Ref<Font> &p_font); void push_font(const Ref<Font> &p_font);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment