This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ColorDict(object): | |
| """Provides a color for each key, trying to create as distinct a set | |
| of colors as possible. | |
| """ | |
| # Minimum difference in hue between unique colors, before we begin | |
| # to recycle old colors rather than generating new ones. | |
| THRESHOLD = 0.05 | |
| def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Modify contrast using a ColorMatrix (on Android) | |
| ColorMatrixColorFilter setContrast(float contrast) { | |
| float scale = contrast + 1.f; | |
| float translate = (-.5f * scale + .5f) * 255.f; | |
| float[] array = new float[] { | |
| scale, 0, 0, 0, translate, | |
| 0, scale, 0, 0, translate, | |
| 0, 0, scale, 0, translate, | |
| 0, 0, 0, 1, 0}; | |
| ColorMatrix matrix = new ColorMatrix(array); |
NewerOlder