Converter
in package
Common converter functions.
Table of Contents
Constants
- DEGREE_TO_ANGLE = 60000
- INCH_TO_CM = 2.54
- INCH_TO_PICA = 6
- INCH_TO_PIXEL = 96
- INCH_TO_POINT = 72
- INCH_TO_TWIP = 1440
- PIXEL_TO_EMU = 9525
Methods
- angleToDegree() : int
- Convert angle to degrees.
- cmToEmu() : float
- Convert centimeter to EMU.
- cmToInch() : float
- Convert centimeter to inch.
- cmToPixel() : float
- Convert centimeter to pixel.
- cmToPoint() : float
- Convert centimeter to point.
- cmToTwip() : float
- Convert centimeter to twip.
- cssToCm() : float
- Transforms a size in CSS format (eg. 10px, 10px, ...) to cm.
- cssToEmu() : float
- Transforms a size in CSS format (eg. 10px, 10px, ...) to emu.
- cssToPixel() : float
- Transforms a size in CSS format (eg. 10px, 10px, ...) to pixel.
- cssToPoint() : float|null
- Transforms a size in CSS format (eg. 10px, 10px, ...) to points.
- cssToTwip() : float
- Transforms a size in CSS format (eg. 10px, 10px, ...) to twips.
- degreeToAngle() : int
- Convert degree to angle.
- emuToPixel() : float
- Convert EMU to pixel.
- htmlToRgb() : array<string|int, mixed>
- Convert HTML hexadecimal to RGB.
- inchToCm() : float
- Convert inch to centimeter.
- inchToEmu() : int
- Convert inch to EMU.
- inchToPixel() : float
- Convert inch to pixel.
- inchToPoint() : float
- Convert inch to point.
- inchToTwip() : float
- Convert inch to twip.
- picaToPoint() : float
- Convert pica to point.
- pixelToCm() : float
- Convert pixel to centimeter.
- pixelToEmu() : int
- Convert pixel to EMU.
- pixelToPoint() : float
- Convert pixel to point.
- pixelToTwip() : float
- Convert pixel to twip.
- pointToCm() : float
- Convert point to cm.
- pointToEmu() : float
- Convert point to EMU.
- pointToPixel() : float
- Convert point to pixel.
- pointToTwip() : float
- Convert point to twip unit.
- stringToRgb() : string
- Convert colorname as string to RGB.
Constants
DEGREE_TO_ANGLE
public
mixed
DEGREE_TO_ANGLE
= 60000
INCH_TO_CM
public
mixed
INCH_TO_CM
= 2.54
INCH_TO_PICA
public
mixed
INCH_TO_PICA
= 6
INCH_TO_PIXEL
public
mixed
INCH_TO_PIXEL
= 96
INCH_TO_POINT
public
mixed
INCH_TO_POINT
= 72
INCH_TO_TWIP
public
mixed
INCH_TO_TWIP
= 1440
PIXEL_TO_EMU
public
mixed
PIXEL_TO_EMU
= 9525
Methods
angleToDegree()
Convert angle to degrees.
public
static angleToDegree([float $angle = 1 ]) : int
Parameters
- $angle : float = 1
Return values
intcmToEmu()
Convert centimeter to EMU.
public
static cmToEmu([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
floatcmToInch()
Convert centimeter to inch.
public
static cmToInch([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
floatcmToPixel()
Convert centimeter to pixel.
public
static cmToPixel([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
floatcmToPoint()
Convert centimeter to point.
public
static cmToPoint([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
floatcmToTwip()
Convert centimeter to twip.
public
static cmToTwip([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
floatcssToCm()
Transforms a size in CSS format (eg. 10px, 10px, ...) to cm.
public
static cssToCm(string $value) : float
Parameters
- $value : string
Return values
floatcssToEmu()
Transforms a size in CSS format (eg. 10px, 10px, ...) to emu.
public
static cssToEmu(string $value) : float
Parameters
- $value : string
Return values
floatcssToPixel()
Transforms a size in CSS format (eg. 10px, 10px, ...) to pixel.
public
static cssToPixel(string $value) : float
Parameters
- $value : string
Return values
floatcssToPoint()
Transforms a size in CSS format (eg. 10px, 10px, ...) to points.
public
static cssToPoint(string $value) : float|null
Parameters
- $value : string
Return values
float|nullcssToTwip()
Transforms a size in CSS format (eg. 10px, 10px, ...) to twips.
public
static cssToTwip(string $value) : float
Parameters
- $value : string
Return values
floatdegreeToAngle()
Convert degree to angle.
public
static degreeToAngle([float $degree = 1 ]) : int
Parameters
- $degree : float = 1
Return values
intemuToPixel()
Convert EMU to pixel.
public
static emuToPixel([float $emu = 1 ]) : float
Parameters
- $emu : float = 1
Return values
floathtmlToRgb()
Convert HTML hexadecimal to RGB.
public
static htmlToRgb(string $value) : array<string|int, mixed>
Parameters
- $value : string
-
HTML Color in hexadecimal
Return values
array<string|int, mixed> —Value in RGB
inchToCm()
Convert inch to centimeter.
public
static inchToCm([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
floatinchToEmu()
Convert inch to EMU.
public
static inchToEmu([float $inch = 1 ]) : int
Parameters
- $inch : float = 1
Return values
intinchToPixel()
Convert inch to pixel.
public
static inchToPixel([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
floatinchToPoint()
Convert inch to point.
public
static inchToPoint([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
floatinchToTwip()
Convert inch to twip.
public
static inchToTwip([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
floatpicaToPoint()
Convert pica to point.
public
static picaToPoint([float $pica = 1 ]) : float
Parameters
- $pica : float = 1
Return values
floatpixelToCm()
Convert pixel to centimeter.
public
static pixelToCm([float $pixel = 1 ]) : float
Parameters
- $pixel : float = 1
Return values
floatpixelToEmu()
Convert pixel to EMU.
public
static pixelToEmu([float $pixel = 1 ]) : int
Parameters
- $pixel : float = 1
Return values
intpixelToPoint()
Convert pixel to point.
public
static pixelToPoint([float $pixel = 1 ]) : float
Parameters
- $pixel : float = 1
Return values
floatpixelToTwip()
Convert pixel to twip.
public
static pixelToTwip([float $pixel = 1 ]) : float
Parameters
- $pixel : float = 1
Return values
floatpointToCm()
Convert point to cm.
public
static pointToCm([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
floatpointToEmu()
Convert point to EMU.
public
static pointToEmu([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
floatpointToPixel()
Convert point to pixel.
public
static pointToPixel([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
floatpointToTwip()
Convert point to twip unit.
public
static pointToTwip([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
floatstringToRgb()
Convert colorname as string to RGB.
public
static stringToRgb(string $value) : string
Parameters
- $value : string
-
color name
Return values
string —color as hex RGB string, or original value if unknown