Mega Code Archive

 
Categories / Delphi / Graphic
 

How to mirror a bitmap

Title: How to mirror a bitmap procedure flip_horizontal(Quelle, Ziel: TBitMap); begin Ziel.Assign(nil); Ziel.Width := Quelle.Width; Ziel.Height := Quelle.Height; StretchBlt(Ziel.Canvas.Handle, 0, 0, Ziel.Width, Ziel.Height, Quelle.Canvas.Handle, 0, Quelle.Height, Quelle.Width, Quelle.Height, srccopy); end; procedure flip_vertikal(Quelle, Ziel: TBitMap); begin Ziel.Assign(nil); Ziel.Width := Quelle.Width; Ziel.Height := Quelle.Height; StretchBlt(Ziel.Canvas.Handle, 0, 0, Ziel.Width, Ziel.Height, Quelle.Canvas.Handle, Quelle.Width, 0, Quelle.Width, Quelle.Height, srccopy); end; procedure TForm1.Button1Click(Sender: TObject); var temp: TBitMap; begin temp := TBitMap.Create; try temp.Assign(Image1.Picture.BitMap); flip_vertikal(Temp, Image1.Picture.Bitmap); finally Temp.Free; end; end;