GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Functions
gp_dpi.h File Reference

DPI calculation and conversions. More...

#include <core/gp_debug.h>

Go to the source code of this file.

Functions

static unsigned int gp_dpi_from_size (unsigned int w, unsigned int w_mm, unsigned int h, unsigned int h_mm)
 Calculates DPI from display physical size and resolution.
 
static float gp_dpi_to_ppmm (unsigned int dpi)
 Converts DPI to dots/pixels per mm.
 
static gp_size gp_dpi_mm_to_px (unsigned int dpi, float mm)
 Converts milimeters to pixels.
 

Detailed Description

DPI calculation and conversions.

Definition in file gp_dpi.h.

Function Documentation

◆ gp_dpi_from_size()

static unsigned int gp_dpi_from_size ( unsigned int  w,
unsigned int  w_mm,
unsigned int  h,
unsigned int  h_mm 
)
inlinestatic

Calculates DPI from display physical size and resolution.

Parameters
wWidth in pixels.
w_mmWidth in mm.
hHeight in pixels.
h_mmHeight in mm.
Returns
An average DPI.

Definition at line 25 of file gp_dpi.h.

References GP_DEBUG.

◆ gp_dpi_mm_to_px()

static gp_size gp_dpi_mm_to_px ( unsigned int  dpi,
float  mm 
)
inlinestatic

Converts milimeters to pixels.

Parameters
dpiA DPI usually backend->dpi.
mmSize in milimeters.
Returns
Size in pixels rounded to whole pixels.

Definition at line 53 of file gp_dpi.h.

References gp_dpi_to_ppmm().

◆ gp_dpi_to_ppmm()

static float gp_dpi_to_ppmm ( unsigned int  dpi)
inlinestatic

Converts DPI to dots/pixels per mm.

Parameters
dpiA DPI usually backend->dpi.
Returns
A PPMM a number of pixels per mm.

Definition at line 41 of file gp_dpi.h.

Referenced by gp_dpi_mm_to_px().