libSBML C API  5.18.0
GradientStop_t Class Reference

Detailed Description

render A color at a certain location in a color gradient.

The gradient stop concept was more or less taken from the corresponding concept in SVG. A GradientStop_t object represents the color at a certain location in a linear or radial gradient. Each gradient should contain two or more gradient stops which mark the edges of a region within this region color are interpolated based on the distance of the location to the edges of the region.

A gradient stop has two attributes. The first attribute is an offset which determines the location for the gradient stop within the object the gradient is applied to. The offset can either be an absolute value or a relative value or a combination of absolute and relative value. For example, a value of "50%" for the offset means that the gradient stop is located at 50% of the gradient vector. For more information and examples, see the render extension specification or the SVG specification.

The second attribute defines the color for the gradient stop. The color can either be defined be a color value string or by the id of a ColorDefinition_t object.

See also
ColorDefinition_t

Public Member Functions

GradientStop_tGradientStop_clone (const GradientStop_t *gs)
 Creates and returns a deep copy of this GradientStop_t object. More...
 
GradientStop_tGradientStop_create (unsigned int level, unsigned int version, unsigned int pkgVersion)
 Creates a new GradientStop_t using the given SBML Level, Version and “render” package version. More...
 
void GradientStop_free (GradientStop_t *gs)
 Frees this GradientStop_t object. More...
 
const RelAbsVector_tGradientStop_getOffset (const GradientStop_t *gs)
 Returns the value of the "offset" element of this GradientStop_t. More...
 
char * GradientStop_getStopColor (const GradientStop_t *gs)
 Returns the value of the "stop-color" attribute of this GradientStop_t. More...
 
int GradientStop_hasRequiredAttributes (const GradientStop_t *gs)
 Predicate returning 1 (true) if all the required attributes for this GradientStop_t object have been set. More...
 
int GradientStop_isSetOffset (const GradientStop_t *gs)
 Predicate returning 1 (true) if this GradientStop_t's "offset" element is set. More...
 
int GradientStop_isSetStopColor (const GradientStop_t *gs)
 Predicate returning 1 (true) if this GradientStop_t's "stop-color" attribute is set. More...
 
int GradientStop_setOffset (GradientStop_t *gs, const RelAbsVector_t &offset)
 Sets the value of the "offset" element of this GradientStop_t. More...
 
int GradientStop_setStopColor (GradientStop_t *gs, const char *stopColor)
 Sets the value of the "stop-color" attribute of this GradientStop_t. More...
 
int GradientStop_unsetOffset (GradientStop_t *gs)
 Unsets the value of the "offset" element of this GradientStop_t. More...
 
int GradientStop_unsetStopColor (GradientStop_t *gs)
 Unsets the value of the "stop-color" attribute of this GradientStop_t. More...
 

Member Function Documentation

GradientStop_t * GradientStop_clone ( const GradientStop_t gs)

Creates and returns a deep copy of this GradientStop_t object.

Parameters
gsthe GradientStop_t structure.
Returns
a (deep) copy of this GradientStop_t object.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.
GradientStop_t * GradientStop_create ( unsigned int  level,
unsigned int  version,
unsigned int  pkgVersion 
)

Creates a new GradientStop_t using the given SBML Level, Version and “render” package version.

Parameters
levelan unsigned int, the SBML Level to assign to this GradientStop_t.
versionan unsigned int, the SBML Version to assign to this GradientStop_t.
pkgVersionan unsigned int, the SBML Render Version to assign to this GradientStop_t.
Note
Attempting to add an object to an SBMLDocument_t having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument_t), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute. For packages, this means that the parent object to which this package element is being added must have been created with the package namespace, or that the package namespace was added to it, even if that parent is not a package object itself.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.
void GradientStop_free ( GradientStop_t gs)

Frees this GradientStop_t object.

Parameters
gsthe GradientStop_t structure.
const RelAbsVector_t * GradientStop_getOffset ( const GradientStop_t gs)

Returns the value of the "offset" element of this GradientStop_t.

Parameters
gsthe GradientStop_t structure whose offset is sought.
Returns
the value of the "offset" element of this GradientStop_t as a RelAbsVector_t.
char * GradientStop_getStopColor ( const GradientStop_t gs)

Returns the value of the "stop-color" attribute of this GradientStop_t.

Parameters
gsthe GradientStop_t structure whose stop-color is sought.
Returns
the value of the "stop-color" attribute of this GradientStop_t as a pointer to a string.
Warning
The string returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the string will not be reflected in any resulting SBML document unless the string is added to an SBML Document. Even in this case, the string should be deleted, as adding a string to an SBML Document adds a copy of the string, and does not transfer ownership of that string.
int GradientStop_hasRequiredAttributes ( const GradientStop_t gs)

Predicate returning 1 (true) if all the required attributes for this GradientStop_t object have been set.

Parameters
gsthe GradientStop_t structure.
Returns
1 (true) to indicate that all the required attributes of this GradientStop_t have been set, otherwise 0 (false) is returned.
Note
The required attributes for the GradientStop_t object are:
  • "stop-color"
int GradientStop_isSetOffset ( const GradientStop_t gs)

Predicate returning 1 (true) if this GradientStop_t's "offset" element is set.

Parameters
gsthe GradientStop_t structure.
Returns
1 (true) if this GradientStop_t's "offset" element has been set, otherwise 0 (false) is returned.
int GradientStop_isSetStopColor ( const GradientStop_t gs)

Predicate returning 1 (true) if this GradientStop_t's "stop-color" attribute is set.

Parameters
gsthe GradientStop_t structure.
Returns
1 (true) if this GradientStop_t's "stop-color" attribute has been set, otherwise 0 (false) is returned.
int GradientStop_setOffset ( GradientStop_t gs,
const RelAbsVector_t offset 
)

Sets the value of the "offset" element of this GradientStop_t.

Parameters
gsthe GradientStop_t structure.
offsetRelAbsVector_t value of the "offset" element to be set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int GradientStop_setStopColor ( GradientStop_t gs,
const char *  stopColor 
)

Sets the value of the "stop-color" attribute of this GradientStop_t.

Parameters
gsthe GradientStop_t structure.
stopColorconst char * value of the "stop-color" attribute to be set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are: Calling this function with stopColor = NULL or an empty string is equivalent to calling GradientStop_unsetStopColor().
int GradientStop_unsetOffset ( GradientStop_t gs)

Unsets the value of the "offset" element of this GradientStop_t.

Parameters
gsthe GradientStop_t structure.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int GradientStop_unsetStopColor ( GradientStop_t gs)

Unsets the value of the "stop-color" attribute of this GradientStop_t.

Parameters
gsthe GradientStop_t structure.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are: