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

Register forum user name Search FAQ


Script function


Read about scripting




Blends a single pixel with another, using a specified blending mode


long BlendPixel(long Blend, long Base, short Mode, double Opacity);

View list of data type meanings


This does the same thing as WindowBlendImage, except it operates on a single pixel (that is, a single RGB colour for the blend colour, and a single RGB colour for the base colour). This does the same thing, to a single pixel, as WindowBlendImage (with the same codes). This is intended for situations where you need to work on individual colours - either in a miniwindow image, or generally, to do things like merge them together in various ways.

Blend - the RGB code of the pixel to be blended

Base - the RGB code of the base pixel

Mode - the blending method.

Mode 1 - Normal
Mode 2 - Average
Mode 3 - Interpolate
Mode 4 - Dissolve
Mode 5 - Darken
Mode 6 - Multiply
Mode 7 - Colour Burn
Mode 8 - Linear Burn
Mode 9 - Inverse Colour Burn
Mode 10 - Subtract
Mode 11 - Lighten
Mode 12 - Screen
Mode 13 - Colour Dodge
Mode 14 - Linear Dodge
Mode 15 - Inverse Colour Dodge
Mode 16 - Add
Mode 17 - Overlay
Mode 18 - Soft Light
Mode 19 - Hard Light
Mode 20 - Vivid Light
Mode 21 - Linear Light
Mode 22 - Pin Light
Mode 23 - Hard Mix
Mode 24 - Difference
Mode 25 - Exclusion
Mode 26 - Reflect
Mode 27 - Glow
Mode 28 - Freeze
Mode 29 - Heat
Mode 30 - Negation
Mode 31 - Phoenix
Mode 32 - Stamp
Mode 33 - Xor
Mode 34 - And
Mode 35 - Or
Mode 36 - Red
Mode 37 - Green
Mode 38 - Blue
Mode 39 - Yellow
Mode 40 - Cyan
Mode 41 - Magenta
Mode 42 - Green limited by red
Mode 43 - Green limited by blue
Mode 44 - Green limited by average of red and blue
Mode 45 - Blue limited by red
Mode 46 - Blue limited by green
Mode 47 - Blue limited by average of red and green
Mode 48 - Red limited by green
Mode 49 - Red limited by blue
Mode 50 - Red limited by average of green and blue
Mode 51 - Red only
Mode 52 - Green only
Mode 53 - Blue only
Mode 54 - Discard red
Mode 55 - Discard green
Mode 56 - Discard blue
Mode 57 - All red
Mode 58 - All green
Mode 59 - All blue
Mode 60 - Hue mode
Mode 61 - Saturation mode
Mode 62 - Colour mode
Mode 63 - Luminance mode
Mode 64 - HSL

Opacity - the amount of opacity, between 0 and 1 (floating-point number). An opacity of 0 means the result will be the base pixel. An opacity of 1 means the blend is fully applied. An opacity of 0.5 means the blended pixel is merged 50% with the original pixel.

For more information and screen shots showing the effects of various modes, see:


Available in MUSHclient version 4.36 onwards.

Lua example

BlendPixel (0x123456, 0x445566, 1, 0.5) -- mode 1 (normal) at 50% opacity (gives 0x2b445e)

Return value

-1: The blend mode was not in the above list.

-2: Opacity less than zero or greater than 1.

Otherwise, the RGB code resulting from the blend operation.

See Also ...




(AddFont) Adds a custom font for use by MUSHclient
(Base64Decode) Takes a base-64 encoded string and decodes it.
(Base64Encode) Encodes a string using base-64 encoding.
(ChangeDir) Changes the MUSHclient working directory
(CreateGUID) Creates a GUID - Global Unique Identifier
(EditDistance) Returns the Levenshtein Edit Distance between two words
(ErrorDesc) Converts a MUSHclient script error code into an human-readable description
(ExportXML) Exports a world item in XML format
(FilterPixel) Performs a filtering operation on one pixel
(FixupEscapeSequences) Converts "escape sequences" like \t to their equivalent codes.
(FixupHTML) Fixes up text for writing as HTML
(FlashIcon) Flashes the MUSHclient icon on the Windows taskbar
(GenerateName) Generates a random character name
(GetClipboard) Gets the clipboard contents
(GetScriptTime) Returns the amount of time spent in script routines
(GetSoundStatus) Gets the status of a sound started by PlaySound
(GetUniqueID) Creates a unique ID for general use, or for making Plugin IDs
(GetUniqueNumber) Returns a unique number
(Hash) Produces a hash (checksum) of a specified piece of text
(Help) Shows help for a script function, or a list of functions
(ImportXML) Imports configuration data in XML format
(Menu) Creates a pop-up menu inside the command window
(Metaphone) Returns the metaphone code for the supplied word
(MoveMainWindow) Move and resize the main MUSHclient window
(MoveWorldWindow) Move and resize a world window
(MoveWorldWindowX) Move and resize a specific world window
(MtRand) Returns pseudo-random number using the Mersenne Twister algorithm
(MtSrand) Seed the Mersenne Twister pseudo-random number generator
(PlaySound) Plays a sound using DirectSound
(ReadNamesFile) Loads in a file for generating character names
(Replace) Replaces one substring with another
(SetBackgroundColour) Sets a background colour for the output window
(SetBackgroundImage) Sets a background image for the output window
(SetClipboard) Sets the clipboard contents
(SetForegroundImage) Sets a foreground image for the output window
(SetMainTitle) Sets the main output window title
(SetSelection) Sets a selection range in the output window
(SetStatus) Sets the status line text
(SetTitle) Sets the world window title
(SetToolBarPosition) Sets the position of the game toolbars on the screen.
(SetUnseenLines) Sets the number of "unseen lines" for this world
(ShiftTabCompleteItem) Adds an item to the list shown for Shift+Tab completion
(Simulate) Simulate input from the MUD, for debugging purposes
(Sound) Plays a sound
(StopSound) Stop playing a sound started by PlaySound
(StripANSI) Strips ANSI colour sequences from a string
(Trace) Trace mode property
(TraceOut) Outputs the supplied message to the world Trace
(TranslateDebug) Sends a debugging message to the localizing translator script
(TranslateGerman) Translate German umluat sequences
(Transparency) Sets the transparency of the main MUSHclient window under Windows XP
(Trim) Trims leading and trailing spaces from a string
(WindowBlendImage) Blends an image into a miniwindow, using a specified blending mode

(Help topic: function=BlendPixel)

Documentation contents page

Search ...

Enter a search string to find matching documentation.

Search for:   

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.


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 HostDash]