-
Notifications
You must be signed in to change notification settings - Fork 5
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
Non-fractional ouput? #6
Comments
Thanks for your interest. That’s the classic rasterization problem in computer graphics. I haven’t dealt a lot with fractional pixels but I think a bulletproof solution would blend the colors of two adjacent cells based on how much of that row/column is occupied by each cell. A good-enough solution might give the row/column the color of the cell that occupies the most area in that row/column. One concern that I have about rounding down all cells and giving the leftover pixels to the last cells in a row/column is that this algorithm tends to put the smallest cells on the bottom right corner so if you give those small cells the leftover pixels, these cells may be a lot larger (percentage-wise) than their correct size. However, if you think the cells in your tree map won’t be of radically different sizes (say, a factor of 100 or 1000) then that approach might work quite well. |
@c0bra can I have whatever you're building? |
@Jordan314 I was wanting to do a package size analysis plugin for rollup, I think, but I never got around to it. |
Hi! Thanks for the great library.
Quick question: I'd like to use this to output treemaps on the terminal, where I don't have the capability to render at fractional points. What would be the safest way to handle this? Just giving it the barest of glances I think I could round things down and add the remainders back to the final elements. Wouldn't be perfect but could work.
Thoughts?
The text was updated successfully, but these errors were encountered: