From 9789897d1d52331de615b56b49e973f0db658215 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 9 Nov 2016 14:14:15 +0300 Subject: [PATCH] pointsToPixels for rect --- src/dlangui/core/types.d | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dlangui/core/types.d b/src/dlangui/core/types.d index ec1db108..e3148789 100644 --- a/src/dlangui/core/types.d +++ b/src/dlangui/core/types.d @@ -309,11 +309,16 @@ private __gshared int PRIVATE_SCREEN_DPI = 96; /// one point is 1/72 of inch enum POINTS_PER_INCH = 72; -/// convert points (1/72in units) to pixels according to SCREEN_DPI +/// convert length in points (1/72in units) to pixels according to SCREEN_DPI int pointsToPixels(int pt) { return pt * SCREEN_DPI / POINTS_PER_INCH; } +/// rectangle coordinates in points (1/72in units) to pixels according to SCREEN_DPI +Rect pointsToPixels(Rect rc) { + return Rect(rc.left.pointsToPixels, rc.top.pointsToPixels, rc.right.pointsToPixels, rc.bottom.pointsToPixels); +} + /// convert points (1/72in units) to pixels according to SCREEN_DPI int pixelsToPoints(int px) { return px * POINTS_PER_INCH / SCREEN_DPI;