Last active
March 8, 2023 15:22
-
-
Save harpwood/b51dfb8c3afcc46e1e3f6f8bf79c828c to your computer and use it in GitHub Desktop.
Converts inches into pixels based the current screen
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
/** | |
* Converts a length in inches to the equivalent length in pixels, based on the current display's DPI. | |
* @param {number} inches - The length in inches to convert to pixels. | |
* @returns {number} The equivalent length in pixels. | |
* | |
* @author Written by Gkri (Harpwood studio) | |
* @license MIT License https://opensource.org/licenses/MIT | |
*/ | |
function display_inches_to_pixel(inches) { | |
return max(display_get_dpi_x(), display_get_dpi_y()) * inches; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment