Hide Comments
Hide Comments

ParsePercent(IXMLNode,String,Single,Boolean,TSVGUnitFactors,Single,Single) Method

Comments (0)

Parses the XML attribute with the specified name into a percentage or length value.

Namespace: RSSVGUtils

expandingSyntax

Delphi

 function ParsePercent( const Node: IXMLNode; const Name: String; DefValue: Single;
  var Inherits: Boolean; UnitFactors: TSVGUnitFactors; Min: Single = 0; Max: Single = 1 ): Single; overload;
 

Parameters

Node

Type: IXMLNode

Name

Type: String

DefValue

Type: Single

Inherits

Type: Boolean

UnitFactors

Type: TSVGUnitFactors

Min

Type: Single

Max

Type: Single

Return Value

Type: Single

expandingRemarks

If the string is blank, the function returns the default value ( DefValue). If the string contains 'inherits', the function returns the default value and sets the Inherits parameter to true.

noteNote

A length is a distance measurement, given as a number along with a unit which may be optional.

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")?

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" | "%")?

Note that the non-property 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, and (b) when a percentage length value represents a percentage of the bounding box width or height on a given object.

noteNote

The UnitFactors parameter specifies the unit factors for conversion of string lengths into actual values. For example, if the input string contains '1cm', the function uses the UnitFactors to know how large a centimer is. It is usually set when the DPI property of the TSVGDocument element is set.

expandingSee Also

Reference

Comments (0)

RiverSoftAVG SVG Component Library (RSCL) © 2013-2015, Thomas G. Grubb