@@ -24,11 +24,11 @@ class Drawing
24
24
/**
25
25
* Convert pixels to EMU
26
26
*
27
- * @param int $pValue Value in pixels
27
+ * @param float $pValue Value in pixels
28
28
*
29
29
* @return float
30
30
*/
31
- public static function pixelsToEmu (int $ pValue = 0 ): float
31
+ public static function pixelsToEmu (float $ pValue = 0 ): float
32
32
{
33
33
return round ($ pValue * 9525 );
34
34
}
@@ -38,15 +38,15 @@ public static function pixelsToEmu(int $pValue = 0): float
38
38
*
39
39
* @param int $pValue Value in EMU
40
40
*
41
- * @return float
41
+ * @return int
42
42
*/
43
- public static function emuToPixels (int $ pValue = 0 ): float
43
+ public static function emuToPixels (int $ pValue = 0 ): int
44
44
{
45
45
if ($ pValue == 0 ) {
46
46
return 0 ;
47
47
}
48
48
49
- return round ($ pValue / 9525 );
49
+ return ( int ) round ($ pValue / 9525 );
50
50
}
51
51
52
52
/**
@@ -96,11 +96,11 @@ public static function centimetersToPoints(float $pValue = 0): float
96
96
/**
97
97
* Convert points width to pixels
98
98
*
99
- * @param int $pValue Value in points
99
+ * @param float $pValue Value in points
100
100
*
101
101
* @return float
102
102
*/
103
- public static function pointsToPixels (int $ pValue = 0 ): float
103
+ public static function pointsToPixels (float $ pValue = 0 ): float
104
104
{
105
105
if ($ pValue == 0 ) {
106
106
return 0 ;
@@ -125,17 +125,17 @@ public static function pixelsToCentimeters(int $pValue = 0): float
125
125
/**
126
126
* Convert centimeters width to pixels
127
127
*
128
- * @param int $pValue Value in centimeters
128
+ * @param float $pValue Value in centimeters
129
129
*
130
- * @return float
130
+ * @return int
131
131
*/
132
- public static function centimetersToPixels (int $ pValue = 0 ): float
132
+ public static function centimetersToPixels (float $ pValue = 0 ): int
133
133
{
134
134
if ($ pValue == 0 ) {
135
135
return 0 ;
136
136
}
137
137
138
- return ($ pValue / 2.54 ) * self ::DPI_96 ;
138
+ return (int ) round ((( $ pValue / 2.54 ) * self ::DPI_96 )) ;
139
139
}
140
140
141
141
/**
@@ -246,6 +246,22 @@ public static function twipsToPixels(int $pValue = 0): float
246
246
return round ($ pValue / 15 );
247
247
}
248
248
249
+ /**
250
+ * Convert points to emu
251
+ *
252
+ * @param float $pValue
253
+ *
254
+ * @return int
255
+ */
256
+ public static function pointsToEmu (float $ pValue = 0 ): int
257
+ {
258
+ if ($ pValue == 0 ) {
259
+ return 0 ;
260
+ }
261
+
262
+ return (int ) round (($ pValue / 0.75 ) / 9525 );
263
+ }
264
+
249
265
/**
250
266
* Convert HTML hexadecimal to RGB
251
267
*
0 commit comments