world.WindowGradient

MUSHclient script function (Method) — introduced in version 4.35

Draws a gradient in a rectangle

Prototype

long WindowGradient(BSTR WindowName, long Left, long Top, long Right, long Bottom, long StartColour, long EndColour, short Mode);

Data type meanings

Description

Draws a gradient - that is a rectangle that gradually changes from the start colour to the end colour.

Note that changes to miniwindows will not become visible until the output window is redrawn. This happens when new (visible) lines arrive from the MUD, or if you call WindowShow, or Redraw.

Parameters:

WindowName - the name of an existing miniwindow.

Left, Top, Right, Bottom - describes the rectangle to draw into.

StartColour - the colour to start the gradient (or, see below if you are using Mode 3)

EndColour - the colour to end the gradient.

Mode - the drawing direction. One of:

1 - horizontal - left to right

2 - vertical - top to bottom

3 - make a texture by xoring the x and y columns sequentially.

For Mode 3 (make a texture) - the StartColour has 3 components, red multiplier, green multiplier, blue multiplier. These are multiplied by the generated colour to give special effects to the generated texture. For example: 0x010203 would multiply the blue component by 1, the green component by 2 and the red component by 3.

For more information, see:

http://www.gammon.com.au/mushclient/mw_shapes.htm

Lua example

WindowGradient (win, 20, 110, 160, 180, 
                ColourNameToRGB ("red"), 
                ColourNameToRGB ("yellow"), 
                1)  -- left to right

WindowGradient (win, 20, 20, 160, 100, 
                ColourNameToRGB ("dodgerblue"), 
                ColourNameToRGB ("lightsalmon"), 
                2)  -- top to bottom

WindowGradient (win, 0, 0, 256, 256, 
                0x010203, 
                0,
                3)  -- XOR texture

Lua notes

You can use the following constants for the mode:

miniwin.gradient_horizontal = 1
miniwin.gradient_vertical = 2
miniwin.gradient_texture = 3

Return value

eNoSuchWindow - no such miniwindow (either source or destination)

eUnknownOption - mode not one of the modes specified above

eOK - completed OK

Return code meanings

Related topic

MiniWindows

See also

FunctionDescription
WindowCreateCreates a miniwindow
WindowCreateImageCreates an image in a miniwindow
WindowDrawImageDraws an image into a miniwindow
WindowImageInfoReturns information about an image
WindowImageListLists all images installed into a miniwindow
WindowImageOpDraws an ellipse, rectangle or round rectangle, filled with an image
WindowLoadImageLoads an image into a miniwindow from a disk file