Related methods:
Igpgraphics. drawimage (); igpimage. getthumbnailimage (); igpimage. rotateflip ();
Whether to specify the difference between width and height when using drawimage to present an image:
// If the image resolution is inconsistent with that of graphics, it is necessary to specify the width and height. uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; Image: igpimage; ix, Iy, GX, GY: single; begin image: = tgpimage. create ('C: \ gdiplusimg \ shapes.bmp '); graphics: = tgpgraphics. create (handle); graphics. drawimage (image, 10, 10, image. width, image. height); graphics. drawimage (image, image. width + 20, 10); IX: = image. horizontalresolution; Iy: = image. verticalresolution; GX: = graphics. dpix; Gy: = graphics. dpiy; text: = format ('%. 0f: %. 0f; %. 0f: %. 0f', [IX, Iy, GX, Gy]); end;
Thumbnail:
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; thumbnail, image: igpimage; begin image: = tgpimage. create ('C: \ gdiplusimg \ apple.gif '); thumbnail: = image. getthumbnailimage (32, 32); graphics: = tgpgraphics. create (handle); graphics. drawimage (image, 0, 0, image. width, image. height); graphics. drawimage (thumbnail, image. width + 2, 0, thumbnail. width, thumbnail. height); end;
Image rotation:
uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; image, imageclone: igpimage; I: integer; begin image: = tgpimage. create ('C: \ gdiplusimg \ bird.bmp '); graphics: = tgpgraphics. create (handle); for I: = 0 to 7 do begin imageclone: = image. clone; imageclone. rotateflip (tgprotatefliptype (I); graphics. drawimage (imageclone, 10, 10, image. width, image. height); graphics. translatetransform (image. width + 10, 0); If I = 3 then begin graphics. translatetransform (-graphics. transform. offsetx, image. height + 10); end;