Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Звук, графика и видео > Трансформация Graphics32.


Автор: Matematik 8.4.2008, 21:24
Для трансформации битмапа использую библиотеку 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;

Автор: Matematik 9.4.2008, 10:15
"Утро вечера мудреннее" (народная пословица)
Код

bmp1.OuterColor := clGreen32;

This property specifies the color returned by PixelS property when reading the pixel with coordinates that lie outside the bitmap. The default value is $00000000, which corresponds to a fully transparent black. It is also used when performing linear transformations of a bitmap. http://graphics32.org/documentation/Docs/Units/GR32/Classes/TBitmap32/Properties/OuterColor.htm

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)