Click or drag to resize

IMcDibAccessSetDisplayLut Method

Set a new display LUT from an array LUT entries.

Namespace:  MediaCy.IQL.Engine
Assembly:  MediaCy.IQL.Engine (in MediaCy.IQL.Engine.dll) Version: 10.0.6912.0
Syntax
VB
Function SetDisplayLut ( 
	<OptionalAttribute> NewDisplayLut As Object,
	<OptionalAttribute> <OutAttribute> ByRef ValidateOnlyLut As Object
) As Boolean

Parameters

NewDisplayLut (Optional)
Type: SystemObject
Either a numeric array or a length-2 array of Variant. If a a length-2 Variant then the caller is supplying a "trimmed LUT", with the first element a length-2 double array giving the luminance range over which the LUT is defined (that is, the lumiance that maps onto the middle of the first and last elements of the supplied LUT). The second Variant is the LUT itself, a numeric array as described below. The LUT is given as a Byte array of RGB triples or NumberOfChannels-tuple of Bytes. If the byte-length of this array is evenly divisible by 3, then the array is assumed to be an array of RGB triplets; otherwise it is assumed to be an array of NumberOfChannels-tuples. The NewDisplayLut may also be given as a Long array of RGBA COLORREF or RGBQUAD values.
ValidateOnlyLut (Optional)
Type: SystemObject
If not NULL or Missing (VT_ERROR or vtMissing), the NewDisplayLut is checked for validity and to see if it would change the current LUT, but no actual change is made. The resulting cleaned up Lut is returned into the ValidateOnlyLut as a one-dimensional array of Long COLORREF values.

Return Value

Type: Boolean
True if the LUT actually changes.
Remarks
Each supplied LUT entry may either be a single Byte value, a RGB Byte triplet, or may be a NumberOfChannels-tuple of Bytes (i.e. one Byte for each channel supplied for each LUT entry). You must supply an array of these LUT entries of a length appropriate for the image bit depth (see below for discussion and an exception). Note that you can always supply single Byte values or RGB triplets. In the first case the single Byte array is applied to all channels as a luminance response LUT. In the second case, it specifies a pseudocoloring for either any single channel (either a McImageType.Interpretation of mciMonochrome, or a GetDibBytes call with the lChannel argument something other than mcwcAllChannels). You may also supply an array of NumberOfChannels-tuple of Bytes, which will differ from the above cases only for NumberOfChannels other than 1 or 3. This is the case for McImageType.Interpretation of mciGenericMultiBand (which may have any number of channels per pixel), or of mciComplex and mciPolar (which each have two channels per pixel). For integral pixel types (McImageType.PixelDataType equal mcpdtInteger), the number of LUT entries that must be supplied is &H10000 (65536) for pixel bit depths greater or equal to 16 (mcbpc16Bits or mcbpc32Bits), is &H1000 (4096) for mcbpc12Bits and &H100 (256) for mcbpc8Bits. For floating point pixel types (McImageType.PixelDataType equal mcpdtFloat), any number from &H100 through &H10000 LUT entries may be supplied. If you supply a two-dimensional array dimensioned as (0 to N-1, 0 to Length-1) in VB notation or as [Length,N] in C/C++ notation (that is the fastest moving dimension has the N-tuple elements), where N is either NumberOfChannels, 3 or 1, then the three possible LUT entry types can be unabiguously determined. If a 1-dimensional array is supplied, then it is assumed to be a triple if its length is evenly divisible by 3, otherwise it is assumed to be a single value unless its length exceeds the required (or maximum) length, in which case it is assumed to be a NumberOfChannels-tuple. The McLookupTable.ExtendedLutEx(mceltDisplay,FrameIndex) property will return an array of the proper type, length and shape (see Example). In the case of an image with a McImageType.Interpretation of mciGenericMultiBand (which may have many more than 3 channels per pixel), then the current SetMultichannelRGB determines which of the supplied channel Bytes is assigned to the Red, Green and Blue display LUT's. The fourth supplied channel is always assigned to the Alpha display LUT (currently unused). The supplied LUT may also be RGBA quads (i.e., an array of DWORD COLORREF's). In the case of a McImageType.Interpretation of mciIndexedColor, the McImageType.ColorMap property is exposed in this manner. Finally, you may also supply a single RGBA value as a scalar Long value. In this case, all LUT entries are set to the given RGBA value. This is an easy way to enforce all pixel values being mapped onto a single color. Currently, the Alpha LUT is not used, but in future some supported color interpretations, such as CMYK may make this LUT relevant. In addition to all of the above, you can also supply a "trimmed LUT" as a length-2 Variant with the first element a length-2 double array giving the luminance range over which the LUT is defined (that is, the lumiance that maps onto the middle of the first and last elements of the supplied LUT). The second Variant is the LUT itself, as described above.
Examples
VB
'Set the display LUT and get a DIB that applies it to the image
Dim myDib As McDibAccess
Set myDib = ThisApplication.ActiveImage.PixelBuffer.CreateDibAccess
Dim bChanged As Boolean
bChanged = myDib.SetDisplayLut( ThisApplication.ActiveImage.LookupTable.ExtendedLutEx(mceltDisplay, McActiveFrame))
if bChanged Then
Dim varDib As Variant
varDib = myDib.GetDibBytes( McActiveFrame, mcwcAllChannels, 1, 1, _
0, 0, ThisApplication.ActiveImage.Width, ThisApplication.ActiveImage.Height)
End If
See Also