Defines the SVG Length type, including its Raw value, Unit, and whether it is a percentage. The FMX.RS.SVGTypes.TSVGLength.Raw value represents the length in the current unit (e.g., inch, centimeter, etc); the FMX.RS.SVGTypes.TSVGLength.Pixels and FMX.RS.SVGTypes.TSVGLength.Value properties display the length converted to pixels. This allows you to set the length to 2 inches. Then, depending on what the FMX.RS.SVGTypes.TSVGLength.GetUnitFactors method returns for pixels per inch, the Pixels property can change.
In SVGs, a length is a distance measurement, given as a number along with a unit which may be optional. Lengths are specified in one of two ways depending upon whether they are used in CSS property syntax or SVG presentation attribute syntax:
• When a <length> is used in a style sheet or with a property in a ‘style’ attribute, the syntax must match the following pattern:
length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")?
See the CSS2 specification for the meanings of the unit identifiers. The unit identifier may be in lower (recommended) or upper case.
For properties defined in CSS2 [CSS2], a length unit identifier must be provided (for non-zero values). For SVG-specific properties, the length unit identifier is optional. If a unit is not provided, the length value represents a distance in the current user coordinate system.
• When a <length> is used in an SVG presentation attribute, the syntax must match the following pattern:
length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
The unit identifier, if present, must be in lower case; if not present, the length value represents a distance in the current user coordinate system.
Note that the non-property <length> definition also allows a percentage unit identifier. The meaning of a percentage length value depends on the attribute for which the percentage length value has been specified. Two common cases are: (a) when a percentage length value represents a percentage of the viewport width or height (refer to the section that discusses units in general), and (b) when a percentage length value represents a percentage of the bounding box width or height on a given object (refer to the section that describes object bounding box units).
Namespace: FMX.RS.SVGTypes
Delphi
|
type
TSVGLength = class(TPersistent)
end;
|
|
Name
|
Description
|
|
AsUnit[TSVGUnit]
|
Reads and writes the current length using the specified unit. Setting this property will convert the length to the new unit and the Raw value will be changed.
|
|
aUnit
|
Specifies the units (e.g., inches, centimeters, etc) that the length is currently specified in.
|
|
DefaultIsPercent
|
Defines the default FMX.RS.SVGTypes.TSVGLength.IsPercent value, used to determine if the IsPercent value should be streamed
|
|
IsPercent
|
Specifies whether the FMX.RS.SVGTypes.TSVGLength.Raw value should be interpreted as a percentage or not (with 0 being 0% and 1 equal to 100%)
|
|
OnChange
|
Occurs when the length is changed, either the value or the units
|
|
Pixels
|
Returns the length in pixels by converting the FMX.RS.SVGTypes.TSVGLength.Raw value from its units to pixels, using the FMX.RS.SVGTypes.TSVGLength.GetUnitFactors for conversion of the raw value. If the raw value is a percentage, the property returns the raw value as a value between 0 and 1. Use the FMX.RS.SVGTypes.TSVGLength.Value property to convert the percentage into a value in its range.
|
|
Raw
|
Defines the raw value in the current unit. The length class uses this value as the base value of the length. When you request the raw value in Pixels, the class converts the raw value to number of pixels using the Unit Factors.
|
|
Value
|
Specifies the length value in pixels (based on converting from the Unit). If the length is a percentage, the Pixels value is converted to a final value using the range of the length
|
Top
|
|
Name
|
Description
|
|
FIsPercent
|
Determines if the length in raw value is a percentage or not
|
|
FRaw
|
Stores the raw value of the length
|
|
FUnit
|
Stores the unit type (e.g., mm, px, etc) to use when displaying the length
|
Top
|
A percentage is stored in Raw as a value between 0 and 1.
|