Register forum user name Search FAQ

WindowRectOp

Script function

world.WindowRectOp

Read about scripting

Type

Method

Summary

Draws a rectangle in a miniwindow

Prototype

long WindowRectOp(BSTR WindowName, short Action, long Left, long Top, long Right, long Bottom, long Colour1, long Colour2);

View list of data type meanings

Description

This draws a rectangle in various styles, controlled by the Action parameter.

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.

Action - what sort of rectangle to draw, as follows:

1 = Frame by a single pixel wide line in Colour1
2 = Fill the entire rectangle by Colour1
3 = InvertRect - the colour on the miniwindow inside that rectangle is inverted
4 = Draw a "3D-style" rectangle in two colours, a single pixel wide (Colour1 is top and left edge colour, Colour2 is bottom and right edge colour)
5 = Draw Edge (draws a 3d-style edge with optional fill)
6 = Flood Fill Border (fills to border specified by Colour1) - the filling commences at the pixel designated by Left, Top and continues until it runs out of pixels that colour. The fill colour is specified by Colour2.
7 = Flood Fill Surface (fills while on surface specified by Colour1) - the filling commences at the pixel designated by Left, Top and continues until it is on pixels that colour. The fill colour is specified by Colour2.

Left, Top, Right, Bottom - describes the rectangle to be drawn.

Colour1 - the colour to draw the rectangle in (or fill it). For Action 5, this must be one of:

5 : Raised
6 : Etched
9 : Bump
10 : Sunken

Colour2 - the colour used by Action 4 for the bottom and right edge. Also it is the colour used for flood filling (Actions 6 and 7). For Action 5, this is:

0x03 (3) top left
0x06 (6) top right
0x09 (9) bottom left
0x0c (12) bottom right
0x0f (15) rect

Diagonal lines:

0x13 (19) diagonal - end top left
0x16 (22) diagonal - end top right
0x19 (25) diagonal - end bottom left
0x1c (28) diagonal - end bottom right

For Action 5 you can also add in the following values to modify the behaviour of the drawn rectangle:

0x0800 - Fill in the middle
0x1000 - For softer buttons
0x4000 - For flat rather than 3D borders
0x8000 - For monochrome borders


For more information, see:

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


Available in MUSHclient version 4.34 onwards.



Lua example

WindowRectOp (win, 1, 20, 20, 70, 70, ColourNameToRGB("blue"))  -- outline

WindowRectOp (win, 2, 50, 20, 80, 80, ColourNameToRGB("green"))  -- filled

WindowRectOp (win, 3, 5, 5, 90, 90, 0)   -- invert 

WindowRectOp (win, 4, 50, 30, 70, 70, ColourNameToRGB("springgreen"), ColourNameToRGB("green"))

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15)  -- raised, not filled

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15 + 0x800)  -- raised, filled

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15 + 0x800 + 0x1000)  -- raised, filled, softer

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15 + 0x800 + 0x1000 + 0x4000)  -- raised, filled, softer, flat

WindowRectOp (win, 5, 30, 30, 70, 70, 6, 15 + 0x800)  -- etched, filled


Lua notes

You can use the following constants for the action:

miniwin.rect_frame = 1
miniwin.rect_fill = 2
miniwin.rect_invert = 3
miniwin.rect_3d_rect = 4
miniwin.rect_draw_edge = 5
miniwin.rect_flood_fill_border = 6
miniwin.rect_flood_fill_surface = 7

You can use the following constants for the Colour1 parameter (argument 7) for action 5 (rect_draw_edge):

miniwin.rect_edge_raised = 5
miniwin.rect_edge_etched = 6
miniwin.rect_edge_bump = 9
miniwin.rect_edge_sunken = 10

You can use the following constants for the Colour2 parameter (argument 8) for action 5 (rect_draw_edge):

miniwin.rect_edge_at_top_left = 3
miniwin.rect_edge_at_top_right = 6
miniwin.rect_edge_at_bottom_left = 9
miniwin.rect_edge_at_bottom_right = 12
miniwin.rect_edge_at_all = 15
miniwin.rect_diagonal_end_top_left = 19
miniwin.rect_diagonal_end_top_right = 22
miniwin.rect_diagonal_end_bottom_left = 25
miniwin.rect_diagonal_end_bottom_right = 28

You can add in these additional constants to the Colour2 parameter (argument 8) for action 5 (rect_draw_edge):

miniwin.rect_option_fill_middle = 2048
miniwin.rect_option_softer_buttons = 4096
miniwin.rect_option_flat_borders = 16384
miniwin.rect_option_monochrom_borders = 32768


Return value

eNoSuchWindow - no such miniwindow

eUnknownOption - Action not in list above

eBadParameter - edge parameter invalid

eOK - completed OK

View list of return code meanings

See Also ...

Topic

MiniWindows

Functions

(GetDeviceCaps) Gets screen device capabilities
(SetCursor) Changes the shape of the mouse cursor
(TextRectangle) Specifies the size of the rectangle in which text is displayed in the output window.
(WindowAddHotspot) Adds a hotspot to a miniwindow
(WindowArc) Draws an arc in a miniwindow
(WindowBezier) Draws a Bézier curve in a miniwindow
(WindowBlendImage) Blends an image into a miniwindow, using a specified blending mode
(WindowCircleOp) Draws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow
(WindowCreate) Creates a miniwindow
(WindowCreateImage) Creates an image in a miniwindow
(WindowDelete) Deletes a miniwindow
(WindowDeleteAllHotspots) Deletes all hotspots from a miniwindow
(WindowDeleteHotspot) Deletes a hotspot from a miniwindow
(WindowDragHandler) Adds a drag handler to a miniwindow hotspot
(WindowDrawImage) Draws an image into a miniwindow
(WindowDrawImageAlpha) Draws an image into a miniwindow respecting the alpha channel
(WindowFilter) Performs a filtering operation over part of the miniwindow.
(WindowFont) Loads a font into a miniwindow
(WindowFontInfo) Returns information about a font
(WindowFontList) Lists all fonts loaded into a miniwindow
(WindowGetImageAlpha) Draws the alpha channel of an image into a miniwindow
(WindowGetPixel) Gets the colour of a single pixel in a miniwindow
(WindowGradient) Draws a gradient in a rectangle
(WindowHotspotInfo) Returns information about a hotspot
(WindowHotspotList) Lists all hotspots installed into a miniwindow
(WindowHotspotTooltip) Changes the tooltip text for a hotspot in a miniwindow
(WindowImageFromWindow) Creates an image from another miniwindow
(WindowImageInfo) Returns information about an image
(WindowImageList) Lists all images installed into a miniwindow
(WindowImageOp) Draws an ellipse, rectangle or round rectangle, filled with an image
(WindowInfo) Returns information about a miniwindow
(WindowLine) Draws a line in a miniwindow
(WindowList) Lists all miniwindows
(WindowLoadImage) Loads an image into a miniwindow from a disk file
(WindowMenu) Creates a pop-up menu inside a miniwindow
(WindowMergeImageAlpha) Merges an image into a miniwindow based on an alpha mask
(WindowMoveHotspot) Moves a hotspot in a miniwindow
(WindowPolygon) Draws a polygon in a miniwindow
(WindowPosition) Moves a miniwindow
(WindowResize) Resizes a miniwindow
(WindowScrollwheelHandler) Adds a scroll-wheel handler to a miniwindow hotspot
(WindowSetPixel) Sets a single pixel in a miniwindow to the specified colour
(WindowSetZOrder) Sets the Z-Order for a miniwindow
(WindowShow) Shows or hides a miniwindow
(WindowText) Draws text into a miniwindow
(WindowTextWidth) Calculates the width of text in a miniwindow
(WindowTransformImage) Draws an image into a miniwindow with optional rotation, scaling, reflection and shearing
(WindowWrite) Writes the contents of a miniwindow to disk as a graphics file

(Help topic: function=WindowRectOp)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.