Для трансформации битмапа использую библиотеку http://graphics32.org Фон получается черный. Как его изменить? http://ipicture.ru/Gallery/Viewfull/1265739.html
| Код | procedure TForm1.Button1Click(Sender: TObject); var bmp1 : TBitmap32; bmp2 : TBitmap32; tt : TAffineTransformation; r : TRect; begin bmp1 := TBitmap32.Create; bmp2 := TBitmap32.Create; tt := TAffineTransformation.Create; try bmp1.LoadFromFile('1.bmp'); Image1.Picture.Assign(bmp1); tt.Clear; tt.Scale(1.01, 1.01); // увеличить tt.Rotate(0,0,10); // повернуть tt.SrcRect := FloatRect(0,0,bmp1.Width-1, bmp1.Height-1); r := tt.GetTransformedBounds(FloatRect(0,0,bmp1.Width-1, bmp1.Height-1)); // размер новой картинки tt.Translate(-1*r.Left, -1*r.Top); //переместить bmp2.SetSize(r.Right-r.Left, r.Bottom-r.Top);
GR32_Transforms.Transform(bmp2, bmp1, tt{, Rect(0,0,bmp1.Width-1, bmp1.Height-1)}); //*** Image2.Picture.Assign(bmp2); finally tt.Free; bmp1.Free; bmp2.Free; end; end;
|
|