ImageEn, unit iexProcEffects

TIEImageEffectsList.EffectToIndex

TIEImageEffectsList.EffectToIndex


Declaration

function EffectToIndex(Operation: TPreviewEffect): Integer; overload;
function EffectToIndex(Operation: TPreviewEffect; const CheckProperty: String; const PropValue: String): Integer; overload;
function EffectToIndex(Operation: TPreviewEffect; const CheckProperty: String; PropValue: Integer): Integer; overload;
function EffectToIndex(Operation: TPreviewEffect; const CheckProperty: String; PropValue: Boolean): Integer; overload;


Description

Return the index of the first instance of a specified preview effect, or -1 if not found.
You can optionally specify a single property to check for a specific match. If the property value does not match PropValue it will not be considered a match.
See also: IPP_Property_List




Examples

// Disable button if there is already a soft-shadow effect applied
btnAddSoftShadow.Enabled := ImageEnView1.IEBitmap.EffectsChain.EffectToIndex( peSoftShadow ) = -1;

// Disable button if there is already a horizontal flip applied
btnAddHorzFlip.Enabled := ImageEnView1.IEBitmap.EffectsChain.EffectToIndex( peRotate, IPP_FLIP_HORZ, True ) = -1;

// If Contrast effect has been added, then modify it. Otherwise add it
idx := ImageEnView1.IEBitmap.EffectsChain.EffectToIndex( peContrast );
if idx = -1 then
  idx := ImageEnView1.IEBitmap.EffectsChain.Add( peContrast );
ImageEnView1.IEBitmap.EffectsChain.Items[idx].Contrast_Contrast := trkContrast.Position;
ImageEnView1.Update();   // Must call update after manually setting properties

// If HSV effect has been added, then modify it. Otherwise add it
idx := ImageEnView1.IEBitmap.EffectsChain.EffectToIndex( peHSV );
if idx = -1 then
  idx := ImageEnView1.IEBitmap.EffectsChain.Add( peHSV );
ImageEnView1.IEBitmap.EffectsChain.Items[idx].HSV_H := trkHsvH.Position;
ImageEnView1.Update();   // Must call update after manually setting properties