{Apply Changes button}
procedure TForm1.btnDesignApplyClick(Sender: TObject);
var
str: String;
TImg: TImage;
begin
str:='';
{discard current bitmap}
BGRAGraphicControl1.DiscardBitmap;
if txtBGColor.Text = 'NONE' Then
begin
theBMP:= TBGRABitmap.Create(img1.Picture.Bitmap);
end
else
begin
//TheBMP.Free;
theImage1 := TBGRABitmap.Create(BGRAGraphicControl1.Width, BGRAGraphicControl1.Height, StringToColor(txtBGColor.Text));
theImage1.FillRect(0, 0, BGRAGraphicControl1.Width, BGRAGraphicControl1.Height, StringToColor(txtBGColor.Text), dmSet);
theBMP.PutImage(0, 0, TheImage1, dmDrawWithTransparency );
end;
str:=txtStyle.Text;
TImg:=getImgControl(str);
if txtStyle.Text = 'NONE' Then
{skip}
else
begin
theImage2:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage2, dmDrawWithTransparency );
end;
str:=txtMouth.Text;
TImg:=getImgControl(str);
if txtMouth.Text = 'NONE' Then
{skip}
else
begin
theImage3:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage3, dmDrawWithTransparency );
end;
str:=txtEyes.Text;
TImg:=getImgControl(str);
if txtEyes.Text = 'NONE' Then
{skip}
else
begin
theImage4:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage4, dmDrawWithTransparency );
end;
str:=txtClothes.Text;
TImg:=getImgControl(str);
if txtClothes.Text = 'NONE' Then
{skip}
else
begin
theImage5:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage5, dmDrawWithTransparency );
end;
str:=txtHair.Text;
TImg:=getImgControl(str);
if txtHair.Text = 'NONE' Then
{skip}
else
begin
theImage6:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage6, dmDrawWithTransparency );
end;
str:=txtFacialHair.Text;
TImg:=getImgControl(str);
if txtFacialHair.Text = 'NONE' Then
{skip}
else
begin
theImage7:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage7, dmDrawWithTransparency );
end;
str:=txtGlasses.Text;
TImg:=getImgControl(str);
if txtGlasses.Text = 'NONE' Then
{skip}
else
begin
theImage7:= TBGRABitmap.Create(TImg.Picture.Bitmap);
theBMP.PutImage(0, 0, theImage7, dmDrawWithTransparency );
end;
// THIS ALL WORKS FINE. I GET MANY LAYERS PU INTO ONE "theBMP"
end;