图片处理软件转成模块方便调用

易语言 2020-04-12 16:08:59

图片处理软件转成模块方便调用

GdipGetImageWidth (_hImage, _nWidth)
GdipGetImageHeight (_hImage, _nHeight)
GdipCreateBitmapFromScan0 (_nWidth, _nHeight, 0, #Format32bppArgb, 0, Bitmap)
GdipBitmapLockBits (Bitmap, MakeRCL (0, 0, _nWidth, _nHeight), 位或 (#图像锁定模式_读, #图像锁定模式_写), #Format32bppArgb, _sBitmapData)
_P = _nHeight × _nWidth × 2
_pColor1 = _sBitmapData.Scan0
_pColor2 = _sBitmapData.Scan0 + _P
.变量循环首 (0, _nHeight ÷ 2 - 1, 1, i)
.变量循环首 (0, _nWidth - 1, 1, j)
_noiseColor = RGB2ARGB (取颜色值 (取随机数 (0, 255), 取随机数 (0, 255), 取随机数 (0, 255)), NoiseDensity)
CopyMemory (_pColor1, 取变量地址 (_noiseColor), 4)
CopyMemory (_pColor2, 取变量地址 (_noiseColor), 4)
_pColor1 = _pColor1 + 4 ' //移动指针
_pColor2 = _pColor2 + 4
.变量循环尾 ()
.变量循环尾 ()
GdipBitmapUnlockBits (Bitmap, _sBitmapData)
GdipGetImageGraphicsContext (_hImage, Graphics)
GdipDrawImageRectRect (Graphics, Bitmap, 0, 0, _nWidth, _nHeight, 0, 0, _nWidth, _nHeight, #UnitPixel, 0, 0, 0)
_pImageBuffer = _image_save (_hImage)
GdipDisposeImage (_hImage)
GdipDisposeImage (Bitmap)
GdipDeleteGraphics (Graphics)
调试输出 (取启动时间 () - _nTime)