LIGHTPARAMS

typedef struct _LIGHTPARAMS
{
   L_UINT uStructSize;
   L_UINT uFreq;
   L_UINT uRAmp;
   L_UINT uGAmp;
   L_UINT uBAmp;
   L_INT nAngle;
   L_UINT uXOrigin;
   L_UINT uYOrigin;
   L_INT nPhase;
   L_INT * pBuff;
   L_UINT uBuffCount;
   L_UINT uFlags;
}LIGHTPARAMS, * pLIGHTPARAMS;

The LIGHTPARAMS structure provides the information needed for the LBitmap::FunctionalLight Function.

Member

Description

uStructSize

Size of this structure, in bytes. Use the sizeof operator to calculate this value.

uFreq

Value that represents the frequency factor. This member used if the uFlags is set to FL_TRIGONOMETRY or to FL_FREEHAND. Valid values range from 1 – 10000. This value is divided internally by 100 (corresponding to a real interval of 0.01 – 100.0).

uRAmp

If the bitmap is grayscale, this parameter represents the amplitude of the master channel. If the bitmap is color and FL_MUL or FL_LINEAR_QUADRATIC are set, this parameter represents the amplitude of each channel. If the bitmap is color and FLB_ADD is used, this represents the amplitude of the red channel. This value is an integer with a value greater than or equal to 0. This value will be multiplied with the results of the selected function (sine, cosine, user buffer , …). The results of the multiplications are then added to the pixel values. These functions as well as the real buffer values are from –1 to 1.

 

Possible values for uRAmp are from 0–100.

uGAmp

Value that represents the amplitude of the green color when the addition operation is used (FL_ADD is set). This value is ignored when grayscale images are used or when the multiplication operation is used (FL_MUL is set). This value is also ignored if uFlags contains FL_LINEAR_QUADRATIC

 

Possible values for uGAmp are from 0–100.

uBAmp

Value that represents the amplitude of the blue color when the addition operation is used (FL_ADD is set). This value is ignored when grayscale images are used or when the multiplication operation is used (FL_MUL is set). This value is also ignored if uFlags contains FL_LINEAR_QUADRATIC

 

Possible values for uBAmp are from 0 –100.

nAngle

Value that represents the angle, in hundredths of degrees. This member is used if uFlags is set to FL_TRIGONOMETRY or to FL_FREEHAND. Valid values for nAngle range from -18000 to 18000. This value is divided internally by 100.

uXOrigin

Value that represents the X coordinate of the origin, in pixels. This member used if the uFlags is set to FL_TRIGONOMETRY and FL_CIRCLES or to FL_LINEAR_QUADRATIC.

uYOrigin

Value that represents the Y coordinate of the origin, in pixels. This member used if the uFlags is set to FL_TRIGONOMETRY and FL_CIRCLES or to FL_LINEAR_QUADRATIC.

nPhase

Value that represents the phase shift angle, in hundredths of degrees, this member used if the uFlags is set to FL_TRIGONOMETRY. Possible values for nPhase are from -18000 to 18000. This value will be divided internally by 100.

pBuff

Pointer holds all points that represents the shape that drawn by the user. This member is used only if uFlags is set to FL_FREEHAND. These values should be between –1000 and 1000. They are internally divided by 1000, so the real values are between –1 and 1.

uBuffCount

Number of points stored in pBuff. This member is used only if uFlags is set to FL_FREEHAND.

uFlags

This member has the following values:

 

Value

Meaning

 

FL_LINEAR_QUADRATIC

[0x1000] If this flag is set, the light will be computed according to distance from the center which is represented by uXOrigin and uYOrigin parameters, The brightness increase for every pixel is proportional to the distance to the effect’s center. If this flag is set, do not set FL_TRIGONOMETRY, FL_FREEHAND.

 

FL_TRIGONOMETRY

[0x2000] If this flag is set then the light will be generated by a sine or cosine function. If this is set, uFreq, nAngle, uXOrigin and uYOrigin are used to compute the light. If this flag is set, do not set FL_LINEAR_QUADRATIC or FL_FREEHAND.

 

FL_FREEHAND 

[0x4000] If this flag is set, the user will pass the light shape in the pBuff parameter. If this flag is set, the nAngle, pBuff and nBuffCount will be used. The nAngle will determine the angle of the light lines compared to the X axis. If this flag is set, do not set FL_LINEAR_QUADRATIC or FL_TRIGONOMETRY.

 

FL_LINEAR_INNER

[0x0001] The linear light will be concentrated at the center (uXOrigin, uYOrigin) and will decreases outwards. This flag is valid only if FL_LINEAR_QUADRATIC is also set.

 

FL_LINEAR_OUTER

[0x0002] The linear light will be concentrated at the far points from the center and will decrease inwards towards the center (uXOrigin, uYOrigin). This flag is valid only if FL_LINEAR_QUADRATIC is also set.

 

FL_QUADRATIC_INNER

[0x0004] The Quadrate light will be concentrated at the center (uXOrigin, uYOrigin) and will decrease outwards. This flag is valid only if FL_LINEAR_QUADRATIC is also set.

 

FL_QUADRATIC_OUTER

[0x0008] The Quadrate light will be concentrated at the far points from the center and will decrease inwards towards the center (uXOrigin, uYOrigin). This flag is valid only if FL_LINEAR_QUADRATIC is also set.

 

FL_UNIDIRECTION

[0x0010] A sine or cosine function will generate the light as lines.

 

 

This flag is valid only if FL_TRIGONOMETRY is also set. The lines are parallel and have no center. The nAngle determines the angle formed by these lines with the X axis.

 

FL_CIRCLES

[0x0020] Sine or cosine function will generate the light as circles around the center (uXOrigin, uYOrigin).

 

 

This flag is valid only if FL_TRIGONOMETRY is also set.

 

FL_ADD

[0x0040] The amplitude parameters value (uRAmp, uGAmp, and uBAmp) are multiplied with the results of the selected function (sine, cosine, freehand). The results are then added to the pixel values of the equivalent channel. These functions as well as the real buffer values are from –1 to 1. This flag is valid only if FL_TRIGONOMETRY or FL_FREEHAND are also set.

 

FL_MUL

[0x0080] Multiply the color factor specified by the uRAmp with the results of the selected function (sine, cosine, freehand). The results are multiplied with every channel value.

 

 

This flag is valid only if FL_TRIGONOMETRY or FL_FREEHAND are also set.

Example

For an example, refer to the LBitmap::FunctionalLight function.