-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transparency flag to pngview #25
Comments
It shouldn't be too hard, but unfortunately I don't have time these days to make changes to the code myself. There are two ways this could be done.
|
Thanks. I might have play and see what I can pull together. |
Had a play around with the following code:
However, couldn't get any noticeable affect from either adjusting the 255 value, 0 value, or replacing DISPMANX_FLAGS_ALPHA_FROM_SOURCE with DISPMANX FLAGS_ALPHA_FIXED_ALL_PIXELS Looks like I'll need to dive in dispmanx a bit further. |
Sorry to hear that. It has been a long time since I looked at this. If I get a chance I will have see what I can do. |
In file imageLayer.c function addElementImageLayer() change For dynamic alpha change:
call:
|
pardon me... What is the use case for this? |
re: nagualcode Ask the OP(bverc), I was just answering their question. I would guess, fading in/out an image... |
Thanks @raspi-user Firstly, the reason my first attempt failed was due the bug #16. Recompiling didn't regenerate my library so it appeared as nothing was happening. Once I sorted that, changing the two lines below worked:
The solution by @raspi-user above is a more elegant solution to the same outcome. However, my application can't use the same alpha value for the entire image. I'd like fully transparent pixels to remain transparent, while all other alphas are scaled down. Is there a nice way to do this with dispmanx? |
Agreed @bverc , I'm looking for a solution for the same problem - true PNG transparency with dynamic alpha changes. The code above was developed en-route to this goal. As suggested by @AndrewFromMelbourne, the required code change will probably have to be performed in image.c. |
Something like this maybe:
Doesn't seem to work, but I think this is close. |
I'm not sure why I gave up on this 18 months ago, as the code I wrote in the above comment works fine. I'll look at adding a flag to pngview and submitting a pull request if of interest to others. |
For AndrewFromMelbourne#25 Added a function to image .c to alllow adjustment of alpha channel over an entire image relatively. Added flag to pngview to control adjust alpha channel
@bverc :Thanks for your great and working pull request: #31 I am trying to load a *.png file with pngview and fade it in and out interactively or over time, how would I achieve this? Any help very welcome! |
Thanks @magdesign Your problem I don't think would be too difficult. If you check -a is set then call I think you would have to run Something like the following (Warning: Untested!):
Good luck! |
Thanks.
The main goal is to fade in/out an image interactively and also move it in x and y and zoom interactively so it would be possible to have an image displayed and then send realtime data to move it over the screen and make it any size and transparency... maybe a bit an overkill for a C beginner like I am :-) |
Sounds like you didn't add the first line of that code before the loop: Regardless, anyway I think your application is a bit niche to try and include in pngview and I think your original idea of calling from bash is correct. Not sure what is causing the flickering. Perhaps the reloading of the image and recalculating the alpha takes too long. I wonder if keeping two instances of pngview running, so have one running, while the second is loading then swap over. Or start each one as a background process and start the next 10ms earlier than the previous one is expected to end. |
Thanks for such a great tool.
How complex would adding a transparency flag to reduce the alpha value by a fraction of the entire image at imageload or on display?
The text was updated successfully, but these errors were encountered: