world.WindowSetPixel
Sets a single pixel in a miniwindow to the specified colour
Prototype
long WindowSetPixel(BSTR WindowName, long x, long y, long Colour);
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
Related topic
See also
| Function | Description |
|---|---|
| WindowArc | Draws an arc in a miniwindow |
| WindowBezier | Draws a Bézier curve in a miniwindow |
| WindowCircleOp | Draws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow |
| WindowCreate | Creates a miniwindow |
| WindowDrawImage | Draws an image into a miniwindow |
| WindowGetPixel | Gets the colour of a single pixel in a miniwindow |
| WindowLine | Draws a line in a miniwindow |
| WindowPolygon | Draws a polygon in a miniwindow |
| WindowRectOp | Draws a rectangle in a miniwindow |