This file contains 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
import argparse | |
import fileinput | |
import re | |
import sqlite3 | |
import sys | |
class Symbol: | |
def __init__(self, name, size, type, template): | |
self.name = name | |
self.size = size |
This file contains 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
mFloatBuffer.position(0); | |
GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY); | |
GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 16, mFloatBuffer); | |
mFloatBuffer.position(2); | |
GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY); | |
GLES11.glTexCoordPointer(2, GLES11.GL_FLOAT, 16, mFloatBuffer); |
This file contains 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
/** | |
* Regex for validating a URI or URI Reference as defined in RFC3986. | |
* | |
* A URI Reference is a URI without the scheme part. They are otherwise the | |
* same except that the first segment of a relative path of a URI reference | |
* can't contain a ':'. | |
* | |
* This syntax does not have IPv6 address support and does not include the IPv4 | |
* rule because IPv4 addresses happens to be a subset of registered names. | |
* Although the final regex can be made a little bit more compact the intent is |
This file contains 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
The bit reduction formulas converts the colors to give a minimal error after converting back to 8 bit. The sum of the signed errors is 0 and the sum of absolute diffs are as small as possible. | |
The formulas that convert back to 8 bit are done using bit shifting which introduces a rounding error for some color values. However bit shifting creates nice symmetric patterns and seems to be how hardware does it. | |
8 bit -> 4 bit -> 8 bit | |
c4 = (c8 + 8) / 17 | |
c8 = c4 << 4 | c4 | |
8 bit -> 5 bit -> 8 bit | |
c5 = (31 * c8 + 127) / 255 |