Java Utililty Methods Pixel Convert To

List of utility methods to do Pixel Convert To

Description

The list of methods to do Pixel Convert To are organized into topic(s).

Method

floatpixel2logical_size(float l, float zoom)
Translates the specified screen length into the logical length.
return l / zoom;
shortpixel2WidthUnits(int pxs)
Converts pixel units to Excel width units (one Excel width unit is 1/256th of a character width)
short widthUnits = (short) (EXCEL_COLUMN_WIDTH_FACTOR * (pxs / UNIT_OFFSET_LENGTH));
widthUnits += UNIT_OFFSET_MAP[(pxs % UNIT_OFFSET_LENGTH)];
return widthUnits;
doublepixels2angle(double pixels)
Converts a value from pixels to visual angle on the standard display.
return rad2deg(Math.atan2(pixels / pixelsPerInch, viewingDistance));
float[][]pixels2Molecules(float[] pixels, int width, int height)
pixels Molecules
float[][] mols = new float[width][height - 1];
for (int i = 0; i < (height - 1); i++) {
    for (int j = 0; j < width; j++) {
        mols[j][i] = pixels[j + (i + 1) * width];
return mols;
floatpixelsToCm(float pixels)
pixels To Cm
return (pixels / DPI) * (1 / 0.393700787f);
doublepixelsToInches(int sizeInPixels, int dpi)
pixels To Inches
int sizeInInches = sizeInPixels / dpi;
return sizeInInches;
intpixelsToPoint(int pixels, int dpi)
pixels To Point
int ret = (int) Math.round((pixels * 72.0) / dpi);
return ret;
floatPixelsToPoints(float value, int dpi)
Pixels To Points
return value / dpi * 72;
doublepixelsToYears(double dim, int chartWidth, int firstChartYear, int lastChartYear)
Performs the inverse of yearsToPixels.
return dim * 1 / yearsToPixels(chartWidth, firstChartYear, lastChartYear);
intpixelToEmu(int pixels, int dpi)
pixel To Emu
if (dpi <= 0) {
    dpi = 96;
return pixels * (int) ((float) 914400 / dpi);