First, I don't see anything in the Qpixmap documentation or QIcon documentation that suggests this functionality is in place; but it's worth noting that your problem is not well-defined:
-What happens if you subtract a larger from a smaller number? (I.E. (20,20,20)Pixel - (40,40,40)Pixel)
-What happens between a color without an alpha value vs. one with an alpha value?
(I.E. (20,20,20,255) - (20,20,20))
-Must the images be the same size? If not, what do you do? You could error out, or you could just show the difference between the existing values. Or show an image only modified by the difference of the smaller picture.
-etc..
There are probably a billion very specific cases you'll cover in your own code. Were there functionality in place already you'd probably have to modify it. There are (somewhat) obvious solutions such as:
-Treat "no" alpha value as 255
-Subtract only until you hit zero
-Show the absolute value of the difference between pixels
-etc..
but even so, it's such an odd thing to ask for IMO that it's unlikely two people wanting it would program it the same.
IMO Go with the simple:
for each x pixel
for each y pixel
new_images_pixle(absolute_value(image1.x,image2.x),absolute_value(image1.y,image2.y))
for each x pixel
for each y pixel
new_images_pixle(absolute_value(image1.x,image2.x),absolute_value(image1.y,image2.y))
To copy to clipboard, switch view to plain text mode
and cover all of your goofy issues the way you desire.
Bookmarks