Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Gdip_CompareImage(Bitmap1, Bitmap2, ByRef x, ByRef y)
- {
- static _CompareImage
- if !_CompareImage
- {
- MCode_CompareImage := "8B442414995383E2035503C233DB56C1F802395C241C577E458B7C24188B74241C03C003C0894424248DA4240000000033C98"
- . "5F67E1B8B5424142B5424188BC78B2C023B28753383C10183C0043BCE7CEF037C242483C3013B5C24207CD28B4C24288B54242C5F5E5DC701FFFFFFFF"
- . "C702FFFFFFFF83C8FF5BC38B5424288B44242C5F5E890A89185D33C05BC3"
- VarSetCapacity(_CompareImage, StrLen(MCode_CompareImage)//2)
- Loop % StrLen(MCode_CompareImage)//2 ;%
- NumPut("0x" SubStr(MCode_CompareImage, (2*A_Index)-1, 2), _CompareImage, A_Index-1, "char")
- DllCall("VirtualProtect", "ptr", &_CompareImage, "ptr", VarSetCapacity(_CompareImage), "uint", 0x40, "ptrA", 0)
- }
- Gdip_GetImageDimensions(Bitmap1, width1, height1), Gdip_GetImageDimensions(Bitmap2, width2, height2)
- if (width1 != width2 || height1 != height2)
- return -1
- E1 := Gdip_LockBits(Bitmap1, 0, 0, width1, height1, Stride1, Scan01, BitmapData1)
- E2 := Gdip_LockBits(Bitmap2, 0, 0, width2, height2, Stride2, Scan02, BitmapData2)
- if (E1 || E2)
- return -2
- x := y := 0
- E := DllCall(&_CompareImage, "ptr", Scan01, "ptr", Scan02, "int", width1, "int", height1, "int", Stride1, "int*", x, "int*", y)
- Gdip_UnlockBits(Bitmap1, BitmapData1), Gdip_UnlockBits(Bitmap2, BitmapData2)
- return (E = "") ? -3 : E
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement