5,392
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.SpeedButton1Click(Sender: TObject);
const Path1 = 'C:\1.bmp';
Path2 = 'C:\2.bmp';
var
Img1, Img2: IGPImage;
Graphics1: IGPGraphics;
begin
{ 打开原图片 }
Img1 := TGPImage.Create(Path1);
{ 建一个新图片,假如是缩小一倍 }
Img2 := TGPBitmap.Create(Img1.Width div 2, Img1.Height div 2,
PixelFormat32bppARGB);
{ 获取新图片的绘图表面 }
Graphics1 := TGPGraphics.Create(Img2);
{ 配置 缩放质量为最高质量 }
Graphics1.InterpolationMode := InterpolationModeHighQualityBicubic;
{ 画过来 }
Graphics1.DrawImage(Img1, 0, 0, Img2.Width, Img2.Height, 0, 0, Img1.Width,Img1.Height,UnitPixel);
{ 保存 }
Img2.Save(Path2);
end;
//以下点击DrawImage后显示的GDIPlus下的全部该名的引用
function DrawImageF(image: IGPImage; const point: TGPPointF) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; x, y: Single) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; const rect: TGPRectF) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; x, y, width, height: Single) : TGPGraphics; overload;
function DrawImage(image: IGPImage; const point: TGPPoint) : TGPGraphics; overload;
function DrawImage(image: IGPImage; x, y: Integer) : TGPGraphics; overload;
function DrawImage(image: IGPImage; const rect: TGPRect) : TGPGraphics; overload;
function DrawImage(image: IGPImage; x, y, width, height: Integer) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; const point: TGPPointF; Opacity : Single ) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; x, y: Single; Opacity : Single ) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; const rect: TGPRectF; Opacity : Single ) : TGPGraphics; overload;
function DrawImageF(image: IGPImage; x, y, width, height: Single; Opacity : Single ) : TGPGraphics; overload;
function DrawImage(image: IGPImage; const point: TGPPoint; Opacity : Single ) : TGPGraphics; overload;
function DrawImage(image: IGPImage; x, y: Integer; Opacity : Single ) : TGPGraphics; overload;
function DrawImage(image: IGPImage; const rect: TGPRect; Opacity : Single ) : TGPGraphics; overload;
function DrawImage(image: IGPImage; x, y, width, height: Integer; Opacity : Single ) : TGPGraphics; overload;