效果图如下:
思路:
1、在画板中使用字符工具,输入“世界 ,你好”,字体是华文琥珀,大小为150.
2、使用remove.bg抠图工具,将文字图片上传,处理完后下载。
3、使用form1中放置rectangle中fill.bitmap,加入第2步中下载的png图片。
4、新建一个form2,在其上放置mediaplayer+mediaplayercontrol,如下设置。
5、将form1的transparency设置为true。(透明)
6、注意form1,form2的位置设成:screencenter
mediaplayer1属性:
MediaPlayer1.Name := 'MediaPlayer1';
MediaPlayer1.FileName :=
'D:\videos\firework.avi';
mediaplayercontrol1属性:
object MediaPlayerControl1: TMediaPlayerControl
Size.Width = 625.000000000000000000
Size.Height = 513.000000000000000000
Align = Center
MediaPlayer = MediaPlayer1
end
form2的属性:
Form2.Name := 'Form2';
Form2.Position := ScreenCenter;
Form2.Transparency := True;
rectangle1的属性:
object Rectangle1: TRectangle
Align = Client
Fill.Bitmap.Bitmap.PNG =d:\fmxwordvideo\helloworld.png
Fill.Bitmap.WrapMode = TileStretch
Fill.Kind = Bitmap
end
form1的属性:
Form1.Position := ScreenCenter;
代码:
procedure TForm1.Action1Execute(Sender: TObject);
begin
Self.MediaPlayer1.Play;
form2.ShowModal;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
bit: TBitmap;
bitAs: PByteArray;
begin
bitAs := Rectangle1.Fill.Bitmap.Bitmap.CreateMask;
self.Rectangle1.Fill.Bitmap.Bitmap.Clear(TAlphaColorRec.Black);
self.Rectangle1.Fill.Bitmap.Bitmap.ApplyMask(bitAs);
end;
代码下载:
链接:https://pan.baidu.com/s/18nheAOxXiZn_4mQQZjOihA
提取码:pfij