-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Vectorio color index #6176
Vectorio color index #6176
Conversation
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 looks right to me
import vectorio | ||
|
||
|
||
def increment_color(shape): |
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.
Oh wow this is a fun capability
I didn't test but looked over the code. One question what if I set a |
@gamblor21 good question on the outside range. There isn't automatic wrapping for values outside the range, however they also don't result in an exception. Current behavior is values outside of the valid range result in the shape being drawn black which is maybe unexpected behavior. I'll add some more explicit checks that raise an exception for invalid values. Thanks for having a look over this! |
On valid ranges for color values - it’s really up to the colorconverter/pixelshader/palette to decide what to do with an index out of range, no? I agree with just passing the configured color index straight into the pixel shader as you have it here. Why define a different behavior for invalid indices than the object to which those indices matter? |
That does make sense to me, it would be better to enforce the range within Palette which should then carry over to the usage here if I understand correctly. |
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.
I did not test but it looks good to me now.
Makes sense to me. The original was more of a question just to ensure it was thought of (and possibly a long term issue for Palette if it does not check ranges). |
Thanks folks! |
Implementing
color_index
argument and property for all of the vectorio shapes. This allows user to specify which color index to fill the shape from the given palette. Previous behavior was always defaulting to the0
index within the palette.There is a script illustrating it's usage in this PR inside of
tests/vecotrio/color_index.py
If the argument is omitted the previous behavior is the default.