Documentation ¶
Index ¶
- type ExpressionParser
- type UnitConverter
- func (uc *UnitConverter) FromCentimeter(cm float64) float64
- func (uc *UnitConverter) FromEm(em float64) float64
- func (uc *UnitConverter) FromInch(inches float64) float64
- func (uc *UnitConverter) FromMillimeter(mm float64) float64
- func (uc *UnitConverter) FromPica(picas float64) float64
- func (uc *UnitConverter) FromPixel(px float64) float64
- func (uc *UnitConverter) FromPixels(pixels float64, unit string) (float64, error)
- func (uc *UnitConverter) FromPoint(points float64) float64
- func (uc *UnitConverter) ToCentimeter(pixels float64) float64
- func (uc *UnitConverter) ToEm(pixels float64) float64
- func (uc *UnitConverter) ToInch(pixels float64) float64
- func (uc *UnitConverter) ToMillimeter(pixels float64) float64
- func (uc *UnitConverter) ToPica(pixels float64) float64
- func (uc *UnitConverter) ToPixel(pixels float64) float64
- func (uc *UnitConverter) ToPixels(value float64, unit string) (float64, error)
- func (uc *UnitConverter) ToPoint(pixels float64) float64
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExpressionParser ¶
ExpressionParser represents the parser and interpreter for unit expressions
func (*ExpressionParser) Parse ¶
func (p *ExpressionParser) Parse(input string) (Value, error)
Parse parses and evaluates the input expression
func (*ExpressionParser) ValueWithOriginal ¶
func (p *ExpressionParser) ValueWithOriginal(v Value) string
ValueWithOriginal returns a string representation of the Value including its original input
type UnitConverter ¶
type UnitConverter struct {
PPI float64
}
func (*UnitConverter) FromCentimeter ¶
func (uc *UnitConverter) FromCentimeter(cm float64) float64
func (*UnitConverter) FromEm ¶
func (uc *UnitConverter) FromEm(em float64) float64
func (*UnitConverter) FromInch ¶
func (uc *UnitConverter) FromInch(inches float64) float64
func (*UnitConverter) FromMillimeter ¶
func (uc *UnitConverter) FromMillimeter(mm float64) float64
func (*UnitConverter) FromPica ¶
func (uc *UnitConverter) FromPica(picas float64) float64
func (*UnitConverter) FromPixel ¶
func (uc *UnitConverter) FromPixel(px float64) float64
func (*UnitConverter) FromPixels ¶
func (uc *UnitConverter) FromPixels(pixels float64, unit string) (float64, error)
FromPixels converts a pixel value to the specified unit
func (*UnitConverter) FromPoint ¶
func (uc *UnitConverter) FromPoint(points float64) float64
func (*UnitConverter) ToCentimeter ¶
func (uc *UnitConverter) ToCentimeter(pixels float64) float64
func (*UnitConverter) ToEm ¶
func (uc *UnitConverter) ToEm(pixels float64) float64
func (*UnitConverter) ToInch ¶
func (uc *UnitConverter) ToInch(pixels float64) float64
func (*UnitConverter) ToMillimeter ¶
func (uc *UnitConverter) ToMillimeter(pixels float64) float64
func (*UnitConverter) ToPica ¶
func (uc *UnitConverter) ToPica(pixels float64) float64
func (*UnitConverter) ToPixel ¶
func (uc *UnitConverter) ToPixel(pixels float64) float64
func (*UnitConverter) ToPixels ¶
func (uc *UnitConverter) ToPixels(value float64, unit string) (float64, error)
ToPixels converts a value from a given unit to pixels
func (*UnitConverter) ToPoint ¶
func (uc *UnitConverter) ToPoint(pixels float64) float64
Click to show internal directories.
Click to hide internal directories.