Fixing and improving imlib_draw_image

Discussion related to "under the hood" OpenMV topics.
Posts: 13
Joined: Tue Mar 10, 2020 4:08 am

Fixing and improving imlib_draw_image

Postby mirkwood » Sat Apr 11, 2020 6:00 am


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]]]]]])
User avatar
Posts: 4271
Joined: Sun May 24, 2015 2:10 pm

Re: Fixing and improving imlib_draw_image

Postby kwagyeman » Sat Apr 11, 2020 12:03 pm

Can you send a PR on GitHub?

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 25 guests