How to determine if the graphic or picture is damage?
I have Encrypted->Decrypted images and draw it to canvas.
i got no error when assigning it to jpg(TJpegImage)
DecryptJepegImage(PWordInfo(FWordList[i])^.Image, jpg); // No errors here
but i got errors when im going开发者_运维问答 to draw it to canvas.
bmp.Canvas.StretchDraw(Rect(0, 0, bmp.Width, bmp.Height), jpg); // says Access violation!
My question is how to determine if it has damage so that i could use alternative Image or pics in it.
That's not really enough information to go on. The one thing that I can be pretty sure of is that it's almost certainly not caused by damage to the encrypted image. Access Violation
means invalid memory access somewhere. Either you're dereferencing a pointer that's nil, or you've got corrupted memory.
Just going by my gut reaction, the first thing I'd check is that whatever you're doing with pointer casting in the first line is correct. Pointer errors are a frequent source of access violations.
Also, is this a nil pointer error or a corrupt pointer error? You can tell by the address in the access violation. If either one starts with a bunch of 0s (or in rare cases, a bunch of Fs) then that means you're dereferencing a nil somewhere. Make sure that bmp
and bmp.canvas
are assigned. But if the addresses both look like valid memory addresses, then you've got memory corruption. That's harder to track down, and you'll have to spend some quality time with the debugger.
精彩评论