public class PixelUtils extends Object
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
DIMENSION_PATTERN |
protected static String |
DIMENSION_REGEX |
static Map<String,Integer> |
dimensionConstantLookup
CODE BELOW IS ADAPTED IN PART FROM MINDRIOT'S SAMPLE CODE HERE:
http://stackoverflow.com/questions/8343971/how-to-parse-a-dimension-string-and-convert-it-to-a-dimension-value
|
Constructor and Description |
---|
PixelUtils() |
Modifier and Type | Method and Description |
---|---|
static android.graphics.PointF |
add(android.graphics.PointF lhs,
android.graphics.PointF rhs) |
static float |
dpToPix(float dp)
Converts a dp value to pixels.
|
static void |
init(android.content.Context ctx)
Recalculates scale value etc.
|
static float |
spToPix(float sp)
Converts an sp value to pixels.
|
static float |
stringToDimension(String dimension) |
static android.graphics.PointF |
sub(android.graphics.PointF lhs,
android.graphics.PointF rhs) |
public static final Map<String,Integer> dimensionConstantLookup
protected static final String DIMENSION_REGEX
protected static final Pattern DIMENSION_PATTERN
public static void init(android.content.Context ctx)
public static android.graphics.PointF add(android.graphics.PointF lhs, android.graphics.PointF rhs)
public static android.graphics.PointF sub(android.graphics.PointF lhs, android.graphics.PointF rhs)
public static float dpToPix(float dp)
dp
- public static float spToPix(float sp)
sp
- public static float stringToDimension(String dimension)