Description

Sets an area of the image to a single value.

Return Type

None  

Syntax

object.SetToConstant [NewValue], [lLeft], [lTop], [lRight], [lBottom]

The SetToConstant Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McRegionAccess.
NewValueOptional. A Variant value.

VARIANT : The new pixel value to be applied to the image data. Either a single floating point value or an array of values, one for each channel (which will be 1 if the ChannelToProcess property is other than -1). If only one value is given, then this value is applied to each channel (except for HSI and HSL types, see Notes). If not given, then the default value is 0.0.

lLeftOptional. A Long value.

long : Optional. Left side of the block. Must be between 0 and Right. The default value of -1 is the same as 0.

lTopOptional. A Long value.

long : Optional. Top side of the area. Must be between 0 and Bottom. The default value of -1 is the same as 0.

lRightOptional. A Long value.

long : Optional. Right side of the area. Must be between 0 and Right. The default value of -1 is the same as Right.

lBottomOptional. A Long value.

long : Optional. Bottom side of the area. Must be between 0 and Bottom. The default value of -1 is the same as Bottom.

Remarks

The coordinates are relative to the McRegionAccess ROI, not the image. The pixel values returned are in the requested color model, which may differ from the image's native color model. If different, the pixel values will be converted back into the native color model and the image will be modified.

Exceptions

Notes If a single value is given for the NewValue and the ChannelToProcess property is -1 (all channels), then HSI and HSL region accesses need to be handled differently. In these case, the Hue channel (0) is always set to zero, the Saturation channel (1) is always set to zero and only the Intensity or Luminance channel (2) is given the value supplied. The effect is to have a grayscale fill with the given intensity.