world.WindowSetPixel

MUSHclient script function (Method) — introduced in version 4.36

Sets a single pixel in a miniwindow to the specified colour

Prototype

long WindowSetPixel(BSTR WindowName, long x, long y, long Colour);

Data type meanings

Description

Sets a single pixel in the miniwindow.

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.

x, y - the location of the pixel (x is horizontal, y is vertical)

Colour - the colour to set the pixel to. Note that the pixel which appears in the window may not necessarily be the exact one you chose, depending on the colour depth of your monitor. For example, for 16-bit colour depth, only 5 bits are used for each of red/green/blue, and thus a colour that cannot be exactly expressed in 5 bits will be rounded to the nearest colour.

Warning - although setting individual pixels is reasonably fast, if you need to set a lot (for example, to draw a line or a box), it would be much faster to use the appropriate dedicated function (such as WindowLine). This is because to draw boxes and lines, especially large ones, or filled ones, would take many, many calls to WindowSetPixel to achieve the same result.

Lua example

for x = 1, 360 do
  local y = math.sin (math.rad (x)) * 100
  WindowSetPixel (win, x, y + 120, 0xFF0000)
end -- for

Return value

eNoSuchWindow - no such miniwindow

eOK - success

Return code meanings

Related topic

MiniWindows

See also

FunctionDescription
WindowArcDraws an arc in a miniwindow
WindowBezierDraws a Bézier curve in a miniwindow
WindowCircleOpDraws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow
WindowCreateCreates a miniwindow
WindowDrawImageDraws an image into a miniwindow
WindowGetPixelGets the colour of a single pixel in a miniwindow
WindowLineDraws a line in a miniwindow
WindowPolygonDraws a polygon in a miniwindow
WindowRectOpDraws a rectangle in a miniwindow