//Transform pixel in percentage
/* - totalpx: Total of pixels depending on the width or height, could be 1920.0 or 1080.0, 1280.0 or 720.0, etc...
respectively.
- px: the pixel desidered to be converted.
- ItIsHeight: boolean to know if is axis x or y ot make the correct calculation.
- BaseOfConversionWidth & BaseOfConversionHeight: the base of conversion from the original pixel are take it, if
the design is HD ready then will be 1280.0 and 720.0, if is full HD then will be 1920.0 and 1080.0, etc... */
public Double TransformPercentage(Double Totalpx, Double px, boolean ItIsHeight, double BaseOfConversionWidth, double BaseOfConversionHeight) {
if (ItIsHeight)
return (px / BaseOfConversionHeight) * Totalpx;
else
return (px / BaseOfConversionWidth) * Totalpx;
}