I checked your code.
Are you sure, you have followed the tutorial correctly?
As I don't have BGRABitmap installed on my computer, what I can do is eye-checking only on your code. Your code is using 255, while the tutorial told you to use 128 on the p^.values assignments.
I know I told you to change 128 to 255, but I only said it on formula for valore.