| Home | News | Tutorials | Downloads | FAQ | Screenshots | Links | Credits |

Writing Own Plug-ins

Basics

For writing Video2Photo plug-ins you need basic knowledge of Borland Pascal. Version of Borland Delphi 5-7 are recommended. Video2Photo plug-ins are simple DLL's loaded when Video2Photo starts. When the plug-in effect is applied the RunProcBMP procedure is executed and the Source Bitmap will be modified.

top

A Plug-in Example

We will present a simple Lumakey effect plug-in. This plug-in will replace all pixels of the Source Bitmap (SRC), which have a luminance value over a pre-selected luminance limit (Param0) with a color defined by RGB components (Param2, Param3, Param4). In this example the Source Bitmap was scanned using Pixels array of the bitmap canvas. This method is slower but better to understand. For faster methods ScanLine property can be used. For better results external Image Processing libraries can be used.


The User Interface of Lumakey Plug-in

top

Register your plug-ins

If you are a developer and you want your plug-ins to be distributed/published with Video2Photo please contact the author (E-mail: Please start you e-mail client and type the e-mail address which you see on screen.).

Example of plug-ins (not implemented yet):

  • Photo CD export
  • Other Image file formats conversions

top

Lumakey.dll souce code

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

//RunProcBMP Code
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

//Plugin Initialization
PluginNameSet('Lumakey');
SetLength(Params,0);

//Add parameters & User Interface elements
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.

top