world.WindowGetImageAlpha

MUSHclient script function (Method) — introduced in version 4.52

Draws the alpha channel of an image into a miniwindow

Prototype

long WindowGetImageAlpha(BSTR WindowName, BSTR ImageId, long Left, long Top, long Right, long Bottom, long SrcLeft, long SrcTop);

Data type meanings

Description

This copies the alpha channel of an image to the miniwindow, showing the alpha information as grayscale.

The alpha channel could be used when copying an image onto the miniwindow using the WindowMergeImageAlpha function.

Thus you could use WindowGetImageAlpha to create a scratch window (one not visible to the player) which holds the alpha information. This could then be turned into another image by using WindowImageFromWindow. This image is now available for use with WindowMergeImageAlpha to selectively copy the image to another miniwindow (this image would be used as the MaskId).

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. (In the case of WindowGetImageAlpha you would probably never want to actually show the image, as it is just the alpha, or mask, channel).

Parameters:

WindowName - the name of an existing miniwindow.

ImageId - an image id that you have loaded (which must have an alpha channel - generally this means it will be 32 bits per pixel, which is 8 bits for each of red, green and blue, and 8 bits for the alpha information).

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

SrcLeft, SrcTop - the source offset in the original image (use 0,0 to get the whole image).

Lua example

WindowGetImageAlpha (win, "im", 20, 20, 0, 0)

Return value

eNoSuchWindow - no such miniwindow

eImageNotInstalled - that image was not loaded with WindowLoadImage (or WindowLoadImageMemory), or the image does not have an alpha channel.

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
WindowDrawImageAlphaDraws an image into a miniwindow respecting the alpha channel
WindowImageInfoReturns information about an image
WindowImageListLists all images installed into a miniwindow
WindowImageOpDraws an ellipse, rectangle or round rectangle, filled with an image