Fixing and improving imlib_draw_image

Hi,

I have improved the imlib_draw_image method by:
1/ DONE Fixing the broken application of alpha when using RGB565 images.

  • The current release gives weird rainbow effects as the alpha value is just multiplied by the color value.

2/ DONE Adding the ability to pass a color palette when the other image is grayscale.

  • This saves me having to allocate an extra RGB buffer for thermograph images allowing me to use higher resolution images.

3/ PENDING INPUT FROM EVERYONE Add some sort of ability to generate a smooth alpha if the other image is grayscale, so doubling the use of the other image as an alpha and an image.

  • I think the simplest way to do this is if a 2 value tuple was passed represented (the grayscale value that would represent 0 alpha, the grayscale representing the maximum alpha). Then the function could just say anything under grayscale value of 0 alpha is invisible, between 0 alpha to maximum grayscale alpha is smoothed, and over maximum is just full alpha). Does that make sense/do you agree this is a good way to do it?

So the method becomes.
image.draw_image(image, x, y[, x_scale=1.0[, y_scale=1.0[, alpha=256[, mask=None, [color_palette, [alpha_smooth]]]]]])

Can you send a PR on GitHub?