Converter
Common converter functions.
Table of Contents
- 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
- 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
- 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
int —cmToEmu()
Convert centimeter to EMU.
public
static cmToEmu([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
float —cmToInch()
Convert centimeter to inch.
public
static cmToInch([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
float —cmToPixel()
Convert centimeter to pixel.
public
static cmToPixel([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
float —cmToPoint()
Convert centimeter to point.
public
static cmToPoint([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
float —cmToTwip()
Convert centimeter to twip.
public
static cmToTwip([float $centimeter = 1 ]) : float
Parameters
- $centimeter : float = 1
Return values
float —cssToCm()
Transforms a size in CSS format (eg. 10px, 10px, ...) to cm.
public
static cssToCm(string $value) : float
Parameters
- $value : string
Return values
float —cssToEmu()
Transforms a size in CSS format (eg. 10px, 10px, ...) to emu.
public
static cssToEmu(string $value) : float
Parameters
- $value : string
Return values
float —cssToPixel()
Transforms a size in CSS format (eg. 10px, 10px, ...) to pixel.
public
static cssToPixel(string $value) : float
Parameters
- $value : string
Return values
float —cssToPoint()
Transforms a size in CSS format (eg. 10px, 10px, ...) to points.
public
static cssToPoint(string $value) : float
Parameters
- $value : string
Return values
float —cssToTwip()
Transforms a size in CSS format (eg. 10px, 10px, ...) to twips.
public
static cssToTwip(string $value) : float
Parameters
- $value : string
Return values
float —degreeToAngle()
Convert degree to angle.
public
static degreeToAngle([float $degree = 1 ]) : int
Parameters
- $degree : float = 1
Return values
int —emuToPixel()
Convert EMU to pixel.
public
static emuToPixel([float $emu = 1 ]) : float
Parameters
- $emu : float = 1
Return values
float —htmlToRgb()
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
float —inchToEmu()
Convert inch to EMU.
public
static inchToEmu([float $inch = 1 ]) : int
Parameters
- $inch : float = 1
Return values
int —inchToPixel()
Convert inch to pixel.
public
static inchToPixel([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
float —inchToPoint()
Convert inch to point.
public
static inchToPoint([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
float —inchToTwip()
Convert inch to twip.
public
static inchToTwip([float $inch = 1 ]) : float
Parameters
- $inch : float = 1
Return values
float —picaToPoint()
Convert pica to point.
public
static picaToPoint([float $pica = 1 ]) : float
Parameters
- $pica : float = 1
Return values
float —pixelToCm()
Convert pixel to centimeter.
public
static pixelToCm([float $pixel = 1 ]) : float
Parameters
- $pixel : float = 1
Return values
float —pixelToEmu()
Convert pixel to EMU.
public
static pixelToEmu([float $pixel = 1 ]) : int
Parameters
- $pixel : float = 1
Return values
int —pixelToPoint()
Convert pixel to point.
public
static pixelToPoint([float $pixel = 1 ]) : float
Parameters
- $pixel : float = 1
Return values
float —pixelToTwip()
Convert pixel to twip.
public
static pixelToTwip([float $pixel = 1 ]) : float
Parameters
- $pixel : float = 1
Return values
float —pointToCm()
Convert point to cm.
public
static pointToCm([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
float —pointToEmu()
Convert point to EMU.
public
static pointToEmu([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
float —pointToPixel()
Convert point to pixel.
public
static pointToPixel([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
float —pointToTwip()
Convert point to twip unit.
public
static pointToTwip([float $point = 1 ]) : float
Parameters
- $point : float = 1
Return values
float —stringToRgb()
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