You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to generate image files that are limited to 4 colours. (Not shades, or anything. 4 total possible pixel values)
Currently, I do this by having my images as RBG, and carefully making sure to only use my allowed colors. However, due to stuff like anti-aliasing, and sometimes input that isn't properly prepared, I repeatedly have to run a slow and time-consuming algorithm that goes through each pixel and corrects it to the closest match out of the 4 allowed colours.
It would be very helpful to me if this was simply enforced by my framework, and I don't have to think about it any more after I've implemented whatever is needed to create a ColorType.
I doubt this would be very helpful for anyone else, although you never know.
It could be nice if the ColorType could also pack 2 pixels into each byte, but this is not a huge problem for me at the moment, and I can see it causing problems when I want to flip the images 90-degrees. (I'd essentially have to unpack the pixels at that point anyway, or do some really clever stuff, comparing multiple pixels, which sounds fun but exhausting)
If I wanted to do this, would I be looking at a fork of the whole skia-project, and possibly coding some stuff in Rust, or is there some other way to plug in a new ColorType implementation?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I want to generate image files that are limited to 4 colours. (Not shades, or anything. 4 total possible pixel values)
Currently, I do this by having my images as RBG, and carefully making sure to only use my allowed colors. However, due to stuff like anti-aliasing, and sometimes input that isn't properly prepared, I repeatedly have to run a slow and time-consuming algorithm that goes through each pixel and corrects it to the closest match out of the 4 allowed colours.
It would be very helpful to me if this was simply enforced by my framework, and I don't have to think about it any more after I've implemented whatever is needed to create a
ColorType
.I doubt this would be very helpful for anyone else, although you never know.
It could be nice if the
ColorType
could also pack 2 pixels into each byte, but this is not a huge problem for me at the moment, and I can see it causing problems when I want to flip the images 90-degrees. (I'd essentially have to unpack the pixels at that point anyway, or do some really clever stuff, comparing multiple pixels, which sounds fun but exhausting)If I wanted to do this, would I be looking at a fork of the whole skia-project, and possibly coding some stuff in Rust, or is there some other way to plug in a new
ColorType
implementation?Beta Was this translation helpful? Give feedback.
All reactions