LOCAL cSourceFile, cTargetFile
cSourceFile = "provide valid image file name"
cTargetFile = "c:\temp\test.bmp"
SET PROCEDURE TO gdiplus ADDITIVE
PRIVATE gdiplus As gdiplusinit, srcImage As gdiimage,;
dstBitmap As gdibitmap
gdiplus = CREATEOBJECT("gdiplusinit")
srcImage = CREATEOBJECT("gdiimage", m.cSourceFile)
IF srcImage.himage = 0
= MESSAGEBOX(cSourceFile + " ",;
48, "Invalid file format or file not found")
RETURN
ENDIF
dstBitmap = CREATEOBJECT("gdibitmap",;
srcImage*2, srcImage*1.5)
WITH dstBitmap
* fill background
.graphics.FillRectangle(ARGB(71,89,73,255),;
0, 0, .imgwidth, .imgheight)
* copy as is
.graphics.drawimage(m.srcImage, 0,0)
* copy with several rotation angles
= DrawImage(-35, 100,0)
= DrawImage(-25, 0,0)
= DrawImage(-5, 0,0)
= DrawImage(25, 0,0)
.SaveToFile(cTargetFile)
ENDWITH
PROCEDURE DrawImage(nAngle, dx, dy)
LOCAL oMatrix As gdimatrix
oMatrix = CREATEOBJECT("gdimatrix")
oMatrix.Translate(srcImage.imgwidth/2, srcImage.imgheight/2)
oMatrix.Rotate(m.nAngle)
WITH dstBitmap
.graphics.SetTransform(oMatrix)
.graphics.drawimage(m.srcImage, dx, dy)
ENDWITH
|