Einzelnen Beitrag anzeigen

Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#4

Re: Transparentes GIF und JPEG zusammenlegen

  Alt 28. Okt 2009, 17:09
Ohne SChickscnack, der wohl einfachste Weg ist:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  x,y: integer;
begin
  OpenPictureDialog1.Filter :='jpegfiles|*.jpg';
  if OpenPictureDialog1.Execute then
  begin
    bmp := TBitmap.Create;
    try
      image1.Picture.LoadFromFile(OpenPictureDialog1.FileName); // JPEG
      bmp.Width := image1.Picture.Width;
      bmp.Height := image1.Picture.Height;
      bmp.PixelFormat := pf24Bit;
      bmp.Canvas.Draw(0, 0, image1.Picture.Graphic);
      image1.Picture.Assign(bmp);

      x := (image1.Picture.Width div 2) - (image2.Picture.Width div 2);
      y := (image1.Picture.Height div 2) - (image2.Picture.Height div 2);
      image1.Canvas.Draw(x, y, image2.Picture.Graphic); // Draw the PNG-Logo
    finally
      bmp.Free;
    end;
  end;
end;
Angehängte Dateien
Dateityp: zip sample_109.zip (344,4 KB, 12x aufgerufen)
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat