-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Lua imlib2 fixes #1729
Lua imlib2 fixes #1729
Conversation
✅ Deploy Preview for conkyweb canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start, but can you use the logging functions from logging.h
instead of printf
? I think NORM_ERR
should do what you need.
To make this really usable for my use case I suspect i'll have one more feature commit to add to this PR later today but as this stands hopefully it is an improvement on the existing codebase. |
I've added one more function |
@brndnmtthws I have no idea why |
Yeah that's odd, let me see if I can figure it out. |
|
Each of the following cases cause large numbers of cryptic imlib2 prints, so detect them and print a single error for each.
Previously if the source image was a different to the displayed image the alpha channel was incorrect, as it wasn't scaled leading to a series of artifacts.
Unfortunately we can't use logging.h directly from conky as its in C++ and lua bindings only have access to a C compiler. Instead we now have a very simple C implementation of logging.h to use within the bindings. This change also adds NULL checks to catch some extra invalid states
In some cases you are already working with a cairo_t and know your destination image size, this adds an API that allows you to handle these cases more easily. Along with now being able to draw images with an alpha level. It also leaves the original API unchanged.
Along with some other minor merge / C++ fixes.`
Co-authored-by: Brenden Matthews <github@brenden.brndn.io>
3c865bf
to
745df42
Compare
Checklist
doc/
has been updatedDescription
A range of fixes for the cairo_imlib2 lua helper, after using it for a couple of days
1. Significantly improve error reporting
Previously if you had an error in your code you would get an error message for each call to imlib2 which lead to alot of spam. Instead we now detect and print our own error message for common errors then return to help with this.
2. Implement Stride in a standard way
This doesn't actually fix anything but I noticed it could be improved when I was debugging something else.
3. Scale Alpha masks correctly.
We weren't scaling the output of the alpha mask to the size of the image we were displaying, which lead to the ugly artifacts that can be seen below. (Ignore the general incompleteness of the actual config its half done)
** Broken Image: **
![shot-2024-02-22_17-36-46](https://private-user-images.githubusercontent.com/3827011/306905160-1d1abaa0-a50c-4d3e-9d60-73969d21eae2.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNzY0MjUsIm5iZiI6MTcyMjE3NjEyNSwicGF0aCI6Ii8zODI3MDExLzMwNjkwNTE2MC0xZDFhYmFhMC1hNTBjLTRkM2UtOWQ2MC03Mzk2OWQyMWVhZTIuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjhUMTQxNTI1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzQwNjYxOTFmMjhiYWUxMGUwNDI5ZGVlYzAwMGYxMzVjM2MzYmMwNTBhNWE0NDAyYjBlOGI5MjQxZjMxMzlmYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Yl3JnqK4idyKgo0X7CBJipDaqYcSN6snYeIZrkty3XQ)
** Fixed Image: **
![shot-2024-02-22_17-35-14](https://private-user-images.githubusercontent.com/3827011/306906596-978f7097-74bb-49c2-b123-62eabb84c2ef.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNzY0MjUsIm5iZiI6MTcyMjE3NjEyNSwicGF0aCI6Ii8zODI3MDExLzMwNjkwNjU5Ni05NzhmNzA5Ny03NGJiLTQ5YzItYjEyMy02MmVhYmI4NGMyZWYuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjhUMTQxNTI1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzQwNDMzZWNmZjJkZjY2YTFlODhmNmU4ZDk2ZTE5NWI5MjFlMDE2M2I3ZjZjYzRmYzk3MDQ1YTc2MDQ3OGFhMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.VLtkafbiSq5NZrXL7Hcy0twl7L3P3Nu3iW5kz81AI4Y)
4. Add Docs
Adds similar docs to the one's being worked on for cairo-text-helper