⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maskingu.pas

📁 DelphiWin32核心API参考光盘内容.是学习书籍中的源码,便于学习.
💻 PAS
字号:
unit MaskingU;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  {copy the background image to the destination}
  Image3.Canvas.Draw(0, 0, Image1.Picture.Bitmap);

  {combine the AND mask image with the background image in the destination
   using a boolean AND operation. this carves out an area for the final
   foreground image}
  BitBlt(Image3.Canvas.Handle, (Image3.Width div 2)-(Image2.Width div 2),
         (Image3.Height div 2)-(Image2.Height div 2), Image2.Width,
         Image2.Height, Image2.Canvas.Handle, 0, 0, SRCAND);

  {copy the result of step one into the 'background' image used for step 2}
  Image4.Canvas.Draw(0, 0, Image3.Picture.Bitmap);

  {copy the 'background' image resulting from step 1 into the destination}
  Image6.Canvas.Draw(0, 0, Image4.Picture.Bitmap);

  {combine the OR mask image with the result from step 1 in the destination
   using a boolean OR operation.  this copies the foreground image into the
   area carved out by step 1 while preserving the pixels around it, thereby
   creating the illusion of transparency.}
  BitBlt(Image6.Canvas.Handle, (Image6.Width div 2)-(Image5.Width div 2),
         (Image6.Height div 2)-(Image5.Height div 2), Image5.Width,
         Image5.Height, Image5.Canvas.Handle, 0, 0, SRCPAINT);
end;








end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -