(******************************************************* * Video2Photo Plug-in Interface ©2003 by Daniel Codres * Plug-in Name: Lumakey * Author: Daniel Codres ********************************************************) library Lumakey; uses windows, CommonTypes2, graphics, v2p_pInterface, sysUtils ; procedure RunProcBMP(SRC,DEST:TBitmap); var x,y : Integer; Invert : Boolean; LumaLimit, RColor, GColor, BColor : Integer; function Luma(C:TColor):Integer; begin result:=Round((GetRValue(C)+GetGValue(C)+GetBValue(C))/3); end; begin //Your code here if SRC=NIL then exit; if DEST=NIL then exit; LumaLimit:=GetParam(0)^.Value; Invert:=GetParam(1)^.Value; RColor:=GetParam(2)^.Value; GColor:=GetParam(3)^.Value; BColor:=GetParam(4)^.Value; for y:=0 to SRC.Height-1 do begin for x:=0 to SRC.Width-1 do begin if (luma(SRC.Canvas.Pixels[x,y])<=LumaLimit) XOR Invert then DEST.Canvas.Pixels[x,y]:=RGB(RColor,GColor,BColor) else DEST.Canvas.Pixels[x,y]:=SRC.Canvas.Pixels[x,y]; end;//line end;//bitmap end; exports RunProcBMP, GetParam, GetParamCount, ParamExists, SetParam, PluginNameGet, Version; begin //Name PluginNameSet('Lumakey'); SetLength(Params,0); //Add params AddParam('Luma Limit',pmInteger,0,uiSlider,0,255); AddParam('Invert',pmBoolean,False,uiCheckBox); AddParam('Bkg. Red',pmInteger,0,uiRadioCtrl,0,255,15,80); AddParam('Bkg. Green',pmInteger,0,uiRadioCtrl,0,255,115,80); AddParam('Bkg. Blue',pmInteger,255,uiRadioCtrl,0,255,215,80); end.