Age | Commit message (Collapse) | Author |
|
|
|
This sprinkles in some thiserror and anyhow instead of the hand-rolled
'error_froms!' macros and the MainResult. The benefit of this is that
we're hooking into an established ecosystem of error handling and we're
saving a lot of effort in the hand-written Display and Error
implementations.
The reason for not sprinkling anyhow everywhere is because the
retrieval/rendering part of kondou could be split off into a library at
some point, in which case we want to have a proper KondouError type.
However, the argument could be made that the current split of errors is
not very good, especially because many of them boil down to the same
inner errors (RenderError wrapping ApiError wrapping reqwest::Error),
which keeps unnecessary information.
Some future improvements may include
1.) Unifying those error enums into one bigger enum
2.) Attaching more context through anyhow in the application layer
3.) Properly define an API and split off the inner logic from the UI
logic
|
|
|
|
Some slight API changes in rusttype, but apart from that it's only
version number bumps.
|
|
|
|
|
|
Working with a "grid" system where we can specifiy the row and column
number directly is way easier than all the x_slice/y_slice calculations
that have been done in all the methods.
|
|
|
|
While it doesn't look as ugly if you have a major trait with a thick
black border, it still looks a bit off, especially since some of them do
come with the proper alpha channel, while others don't.
This fix uses the same mask for all major traits now as well, which
should make them look more uniform and remove the thick black border.
|
|
|
|
Previously, some areas were "double exposed" to the transparency, making
them a bit darker than the rest.
The solution is to make sure that each part is drawn with the correct
background color, and then only copying pixels instead of blending them
to the final canvas.
|
|
|
|
quick_error used the deprecated Error::cause interface, therefore we
want to use our own error enums with proper methods.
|
|
This would occur if e.g. only the profession was given.
|
|
This makes it so that instead of always going from the middle of the
minor trait, they will now adjust based on where they are going to. This
means if the chosen trait is the top one, the line will start a bit
further to the top, which makes it better to look at.
|
|
|
|
|
|
Doesn't change the outcome but looks better to read
|
|
As it turns out, the algorithm for drawing convex polygons is very bad
at handling aliasing, and the line height looked off as well. The new
algorithm fixes the issue by first drawing a horizontal filled
rectangle, then rotating the rectangle by the required angle (using
bicubic filtering) and finally overlaying the rectangle onto the target.
This improves both the looks of the line height and the aliasing
effects.
|
|
|
|
|
|
Apparently, turning the picture to grayscale also messes with the alpha
channel. A lot of trait icons have a small transparent border though.
Therefore, we want to preserve the alpha channel by copying it back from
the original trait icon. This improves render quality and removes some
of the artifacts.
|
|
|