[Home] [Downloads] [Search] [Help/forum]

MUSHclient scripting

Description of MUSHclient world function: world.WindowDrawImageAlpha


Name WindowDrawImageAlpha
Type Method
Summary Draws an image into a miniwindow respecting the alpha channel
Prototype long WindowDrawImageAlpha(BSTR WindowName, BSTR ImageId, long Left, long Top, long Right, long Bottom, double Opacity, long SrcLeft, long SrcTop);

View list of data type meanings

Description

This copies an image to the miniwindow, using the alpha channel to show transparent areas.

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.

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.

Opacity - the amount of opacity, between 0 and 1 (floating-point number). An opacity of 0 means you will not see the drawn image. An opacity of 1 means the image is fully drawn (apart from where the alpha channel makes part of it opaque). An opacity of 0.5 means the image is merged 50% with the original contents of the miniwindow.

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

The intention of allowing sub-images was so that you could make up a map by having lots of small images (eg. houses, trees, rocks). Now instead of having to load hundreds of tiny image files into memory, which would doubtless take a while to open all those files, you open a single, larger, file in which the various sub-images are "tiled". For example, you might allocate a 32 x 32 pixel square for each image. Now by selecting the appropriate tile you can copy the sub-image from the main image.

For more information, see:

http://www.gammon.com.au/forum/?id=9568


Note: Available in version 4.42 onwards.


Lua example
WindowDrawImageAlpha (win, "im", 20, 20, 0, 0, 1)
Returns eNoSuchWindow - no such miniwindow

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

eBadParameter - opacity not in range 0 to 1.

eOK - completed OK

View list of return code meanings

Introduced in version 4.42

See also ...

Function Description
WindowCreate Creates a miniwindow
WindowCreateImage Creates an image in a miniwindow
WindowDrawImage Draws an image into a miniwindow
WindowDrawImageAlpha Draws an image into a miniwindow respecting the alpha channel
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

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.


Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes


Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes


View all functions

[Back]

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]