Urho2d gradient

FanvaronFanvaron USMember ✭✭

Hello everyone,
I'm trying to create a simple BorderImage with a Gradient Background.
Since I could not find any build in gradient functionality my first idea was generating my own Image by creating an empty Image assigning a size and then setting every pixel via SetPixel. Then put this into a texture2d which then gets placed into my actual border Image.
I tried out this approad like this but got a weird grey pattern.

            Image img = new Image();

            img.SetSize(200, 400, 4);

            for (int i = 1; i<=4000; i++)
            {
                for(int j =1; j<=20; j++)
                {
                    img.SetPixel(i, j, Urho.Color.Blue);
                }
            }

So then while looking around I found the BorderImage.setColor(Corner, Color) which when I set the Color for the top left and bottom right gave me a Gradient, so now I was wondering if there is some way to create a custom gradient that I just did not see.

If anyone could maybe give me/point me towards an example for how to get a 2d Gradient or
help me develop my own idea of creating an Image "by hand" I would be most gratefull

Sincerely
Marvin

Sign In or Register to comment.