//创建并填充区域
var
  g: TGPGraphics;
  sb: TGPSolidBrush;
  region: TGPRegion; {定义区域}
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(aclGold);

  region := TGPRegion.Create(MakeRect(50, 50, 150, 150)); {建立区域}
  g.FillRegion(sb, region);                               {填充区域}

  sb.Free;
  region.Free;
  g.Free;
end;


//根据路径建立区域
var
  g: TGPGraphics;
  path: TGPGraphicsPath;
  region: TGPRegion;
  sb: TGPSolidBrush;
const
  pts: array[0..3] of TGPPoint =
    ((x:10 ; y:10 ),
     (x:150; y:10 ),
     (x:100; y:75 ),
     (x:100; y:150));
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(aclRed);
  path := TGPGraphicsPath.Create;
  path.AddPolygon(PGPPoint(@pts), Length(pts));

  region := TGPRegion.Create(path); {根据路径建立区域}
  g.FillRegion(sb, region);

  g.Free;
  path.Free;
  region.Free;
  sb.Free;
end;


//区域联合
var
  g : TGPGraphics;
  sb: TGPSolidBrush;
  region: TGPRegion;
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(aclYellowGreen);

  region := TGPRegion.Create(MakeRect(50, 0, 50, 150)); {建立区域}
  region.Union(MakeRect(0, 50, 150, 50));               {区域联合}
  g.FillRegion(sb, region);                             {填充}

  sb.Free;
  region.Free;
  g.Free;
end;


//用区域剪切画板
var
  g : TGPGraphics;
  sb: TGPSolidBrush;
  p: TGPPen;
  region: TGPRegion;
  font: TGPFont;
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(aclYellowGreen);
  p := TGPPen.Create(aclRed);
  font := TGPFont.Create('宋体',12);

  region := TGPRegion.Create(MakeRect(50, 0, 50, 150)); {建立区域}
  region.Union(MakeRect(0, 50, 150, 50));               {区域联合}
  g.FillRegion(sb, region);

  g.SetClip(region); {用区域剪切画板}

  g.DrawLine(p, 0, 0, 100, 100); {测试画板剪切后的直线}

  sb.SetColor(aclBlack);
  g.DrawString('万一万一万一', -1, font, MakePoint(20.0,20.0), sb); {测试文本}

  sb.Free;
  p.Free;
  region.Free;
  font.Free;
  g.Free;
end;