Draws a rectangle, either as a one pixel outline or filled-in, with each of the four corners a separate colour (creating a gradient across the shape).


draw_rectangle_colour(x1, y1, x2, y2, col1, col2, col3, col4, outline);

Argument Description
x1 The x coordinate of the left of the rectangle.
y1 The y coordinate of the top of the rectangle.
x2 The x coordinate of the right of the rectangle.
y2 The y coordinate of the bottom of the rectangle.
col1 The colour of the top left corner.
col2 The colour of the top right corner.
col3 The colour of the bottom right corner.
col4 The colour of the bottom left corner.
outline Whether the rectangle is an outline (true) or filled in (false).

Returns: N/A


With this function you can draw either an outline of a rectangle or a filled rectangle by defining an area where the (x1,y1) position is the top left corner and the (x2,y2) position is the bottom right corner. If it is filled you can define the individual colours for each corner point and if these colours are not the same, you will get a gradient effect from one to the other (the colour settings will over-ride the base colour set with the function draw_set_colour).


draw_rectangle_colour(50, 50, 200, 200, c_black, c_white, c_black, c_white, false);

This would draw a filled-in square with a smooth black/white gradient between the corners.

Back: Drawing Basic Forms
Next: draw_roundrect
© Copyright YoYo Games Ltd. 2018 All Rights Reserved