You have an inconsistency in your code here:
(int)ptrOutput[4 * x * 1] should be: (int)ptrOutput[4 * x + 1] (for both the green and the blue channels.)
...but the real problem is that you can't use bitwise masking to perform alpha blending (only 1-bit alpha testing).
Consider the color value 170 (10101010) and an alpha value of 85 (1010101). AND-ing them together would result in the value 0 (00000000), while the expected value (of a multiplication of the two) would be 170 * 85 / 255 = 56. An OR operation would result in the value 255 (11111111).
More correct would be: newcolor = ((basecolor * (255 - alpha)) + (covercolor * alpha)) / 255.