Java examples for 2D Graphics:Pixel
from Dp To Pixels
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { int dp = 2; float density = 2.45678f; System.out.println(fromDpToPixels(dp, density)); }/*from ww w .j ava2 s . c om*/ public static int fromDpToPixels(int dp, float density) { return (int) (dp * density + 0.5f); } }