var
VideoForm: TVideoForm;
SysDev: TSysDevEnum;
implementation
uses Math;
{$R *.dfm}
procedure TVideoForm.FormCreate(Sender: TObject);
var
i: integer;
Device: TMenuItem;
begin
SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
if SysDev.CountFilters > 0 then
for i := 0 to SysDev.CountFilters - 1 do
begin
Device := TMenuItem.Create(Devices);
Device.Caption := SysDev.Filters[i].FriendlyName;
Device.Tag := i;
Device.OnClick := OnSelectDevice;
Devices.Add(Device);
end;
VMRBitmap:= TVMRBitmap.Create(VideoWindow);
end;
with FG do
CheckDSError(
RenderStream(@PIN_CATEGORY_PREVIEW , nil, FR, nil, VW));
FilterGraph.Play;
//원내용
with FilterGraph as ICaptureGraphBuilder2 do
CheckDSError(RenderStream(@PIN_CATEGORY_PREVIEW , nil, Filter as IBaseFilter, nil, VideoWindow as IbaseFilter));
FilterGraph.Play;
end;
procedure TVideoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
SysDev.Free;
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;
procedure TVideoForm.FormDestroy(Sender: TObject);
begin
VMRBitmap.Free;
end;
procedure TVideoForm.ext1Click(Sender: TObject);
begin
with VMRBitmap, Canvas do
begin
LoadEmptyBitmap(300,200,pf24bit, clSilver);
Source := VMRBitmap.Canvas.ClipRect;
Options := VMRBitmap.Options + [vmrbSrcColorKey];
ColorKey := clSilver;
Brush.Color := clSilver;
Font.Color := clWhite;
Font.Style := [fsBold];
Font.Size := 30;
Font.Name := 'Arial';
TextOut(0,0,'Hello Word :)');
DrawTo(0,0,1,1,0.5);
end;
end;
procedure TVideoForm.Bitmap1Click(Sender: TObject);
var Bitmap: TBitmap;
begin
if OpenDialog.Execute then
Begin
Bitmap:= TBitmap.Create;
try
Bitmap.LoadFromFile(OpenDialog.FileName);
VMRBitmap.LoadBitmap(Bitmap);
VMRBitmap.Source := VMRBitmap.Canvas.ClipRect;
VMRBitmap.DrawTo(0,0,0.5,0.5, 0.5);
finally
Bitmap.Free;
end;
end;
제가 D5가 없기때문에 해보진 못하지만, 그렇게 어렵지 않은데...
TVideoWindow의 mode 속성을 vmr로 바꾸시고,
TVMRBitmap 생성하셔서 colorkey 설정하고
Draw 해주면 될것 같습니다만...