在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
TWICImage 的 Width、Height 属性, 可以读取但不能赋值. 调整 TWICImage 的大小、比例, 可以通过 IWICBitmapScaler 接口. //IWICBitmapScaler.Initialize 函数有四种比例变换的算法: WICBitmapInterpolationModeNearestNeighbor = 0; WICBitmapInterpolationModeLinear = $1; WICBitmapInterpolationModeCubic = $2; WICBitmapInterpolationModeFant = $3; 测试代码: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} uses Wincodec; procedure TForm1.Button1Click(Sender: TObject); var WicImg: TWICImage; Factory: IWICImagingFactory; Scaler: IWICBitmapScaler; {图像比例变换接口} begin WicImg := TWICImage.Create; WicImg.LoadFromFile('c:\temp\test.jpg'); Factory := WicImg.ImagingFactory; Factory.CreateBitmapScaler(Scaler); Scaler.Initialize(WicImg.Handle, WicImg.Width div 2, WicImg.Height div 3, WICBitmapInterpolationModeFant); WicImg.Handle := IWICBitmap(Scaler); Canvas.Draw(0, 0, WicImg); Scaler := nil; Factory := nil; WicImg.Free; end; end. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论