BlendPixel
Script function

world.BlendPixel

DOC_scripting Read about scripting

Type

Method

Summary

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

Prototype

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

DOC_data_types View list of data type meanings


Description

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:

http://www.gammon.com.au/mushclient/mw_blending.htm



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 ...

Topics

DOC_scripting Scripting
DOC_utils Utilities

Functions

FNC_AddFont AddFont (Adds a custom font for use by MUSHclient)
FNC_Base64Decode Base64Decode (Takes a base-64 encoded string and decodes it.)
FNC_Base64Encode Base64Encode (Encodes a string using base-64 encoding.)
FNC_ChangeDir ChangeDir (Changes the MUSHclient working directory)
FNC_CreateGUID CreateGUID (Creates a GUID - Global Unique Identifier)
FNC_EditDistance EditDistance (Returns the Levenshtein Edit Distance between two words)
FNC_ErrorDesc ErrorDesc (Converts a MUSHclient script error code into an human-readable description)
FNC_ExportXML ExportXML (Exports a world item in XML format)
FNC_FilterPixel FilterPixel (Performs a filtering operation on one pixel)
FNC_FixupEscapeSequences FixupEscapeSequences (Converts "escape sequences" like \t to their equivalent codes.)
FNC_FixupHTML FixupHTML (Fixes up text for writing as HTML)
FNC_FlashIcon FlashIcon (Flashes the MUSHclient icon on the Windows taskbar)
FNC_GenerateName GenerateName (Generates a random character name)
FNC_GetClipboard GetClipboard (Gets the clipboard contents)
FNC_GetScriptTime GetScriptTime (Returns the amount of time spent in script routines)
FNC_GetSoundStatus GetSoundStatus (Gets the status of a sound started by PlaySound)
FNC_GetUniqueID GetUniqueID (Creates a unique ID for general use, or for making Plugin IDs)
FNC_GetUniqueNumber GetUniqueNumber (Returns a unique number)
FNC_Hash Hash (Produces a hash (checksum) of a specified piece of text)
FNC_Help Help (Shows help for a script function, or a list of functions)
FNC_ImportXML ImportXML (Imports configuration data in XML format)
FNC_Metaphone Metaphone (Returns the metaphone code for the supplied word)
FNC_MoveMainWindow MoveMainWindow (Move and resize the main MUSHclient window)
FNC_MoveWorldWindow MoveWorldWindow (Move and resize a world window)
FNC_MoveWorldWindowX MoveWorldWindowX (Move and resize a specific world window)
FNC_MtRand MtRand (Returns pseudo-random number using the Mersenne Twister algorithm)
FNC_MtSrand MtSrand (Seed the Mersenne Twister pseudo-random number generator)
FNC_PlaySound PlaySound (Plays a sound using DirectSound)
FNC_ReadNamesFile ReadNamesFile (Loads in a file for generating character names)
FNC_Replace Replace (Replaces one substring with another)
FNC_SetBackgroundColour SetBackgroundColour (Sets a background colour for the output window)
FNC_SetBackgroundImage SetBackgroundImage (Sets a background image for the output window)
FNC_SetClipboard SetClipboard (Sets the clipboard contents)
FNC_SetForegroundImage SetForegroundImage (Sets a foreground image for the output window)
FNC_SetStatus SetStatus (Sets the status line text)
FNC_SetToolBarPosition SetToolBarPosition (Sets the position of the game toolbars on the screen.)
FNC_ShiftTabCompleteItem ShiftTabCompleteItem (Adds an item to the list shown for Shift+Tab completion)
FNC_Simulate Simulate (Simulate input from the MUD, for debugging purposes)
FNC_Sound Sound (Plays a sound)
FNC_StopSound StopSound (Stop playing a sound started by PlaySound)
FNC_StripANSI StripANSI (Strips ANSI colour sequences from a string)
FNC_Trace Trace (Trace mode property)
FNC_TraceOut TraceOut (Outputs the supplied message to the world Trace)
FNC_TranslateDebug TranslateDebug (Sends a debugging message to the localizing translator script)
FNC_TranslateGerman TranslateGerman (Translate German umluat sequences)
FNC_Transparency Transparency (Sets the transparency of the main MUSHclient window under Windows XP)
FNC_Trim Trim (Trims leading and trailing spaces from a string)
FNC_WindowBlendImage WindowBlendImage (Blends an image into a miniwindow, using a specified blending mode)

(Help topic: function=BlendPixel)

DOC_contents Documentation contents page