vfp改变图像尺寸的大小

*用来改变现有图像的尺寸
*******************************************
*算法制作:行者孙(QQ:310727570)
*******************************************
*VFP应用程式算法群:12787940
*******************************************
FUNCTION resizeimage(pSourceFileNAme as String,pNewFileNAme as String,nWidth as Long,nHeight as long)
PRIVATE pSourceFileNAme,pNewFileNAme,nWidth,nHeight
DECLARE INTEGER GdiplusStartup IN gdiplus;
   INTEGER @token, STRING @INPUT, INTEGER OUTPUT
DECLARE INTEGER GdipSaveImageToFile IN gdiplus.DLL ;
   INTEGER nImage, STRING wFilename, STRING qEncoder, INTEGER nEncoderParamsPtr
DECLARE INTEGER GdipLoadImageFromFile IN gdiplus.DLL ;
   STRING wFilename, INTEGER @nImage
DECLARE INTEGER GdipGetImageGraphicsContext IN gdiplus.DLL ;
   INTEGER nImage, INTEGER @ nGraphics
DECLARE INTEGER GdipCreateBitmapFromScan0 IN gdiplus.DLL ;
   INTEGER nWidth, INTEGER nHeight, INTEGER nStride;
   , INTEGER nPixelFormat ;
   , STRING @ cScan0, INTEGER @ nImage
DECLARE INTEGER GdipDrawImageRect IN gdiplus.DLL ;
   INTEGER nGraphics, INTEGER nImage, SINGLE,SINGLE,SINGLE,SINGLE
DECLARE INTEGER CLSIDFromString IN ole32 STRING lpsz, STRING @pclsid
DECLARE INTEGER GdiplusShutdown IN gdiplus INTEGER token
DECLARE integer GdipDisposeImage IN gdiplus  long

 

LOCAL hToken, cInput
hToken = 0
cInput = PADR(CHR(1), 16, CHR(0))
GdiplusStartup(@hToken, @cInput, 0)

LOCAL nImage
nImage = 0
GdipLoadImageFromFile(STRCONV(pSourceFileNAme + CHR(0), 5), @nImage)
#DEFINE   GDIPLUS_PIXELFORMAT_32bppARGB          0x0026200A

LOCAL nBitmap, nWidth, nHeight, nX, nY
nBitmap = 0
nX = 0
nY = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, GDIPLUS_PIXELFORMAT_32bppARGB, 0, @nBitmap)

LOCAL nGraphics
nGraphics = 0
GdipGetImageGraphicsContext (nBitmap, @nGraphics)

GdipDrawImageRect(nGraphics, nImage, nX, nY, nWidth, nHeight)
LOCAL lcEncoder
lcEncoder = REPLICATE(CHR(0),16)

*CLSIDFromString(STRCONV("{557CF401-1A04-11D3-9A73-0000F81EF32E}" + CHR(0), 5), @lcEncoder)

ERASE (pNewFileNAme)
*GdipSaveImageToFile (nBitmap, STRCONV(pNewFileNAme,5) + CHR(0), lcEncoder, 0)
GdipSaveImageToFile (nBitmap, STRCONV(pNewFileNAme,5) + CHR(0), 0h00F47C55041AD3119A730000F81EF32E, 0)
GdipDisposeImage(@nImage)


GdiplusShutdown(hToken)

 

CLEAR DLLS
ENDFUNC

 

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值