VS:GetGradientData
Jump to navigation
Jump to search
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Gets the spot position, midpoint position and color of the specified gradient segment.
PROCEDURE GetGradientData(
gradient :HANDLE;
segmentIndex :INTEGER;
VAR spotPosition :REAL;
VAR midpointPosition :REAL;
VAR red :LONGINT;
VAR green :LONGINT;
VAR blue :LONGINT);
def vs.GetGradientData(gradient, segmentIndex): return (spotPosition, midpointPosition, red, green, blue)
Parameters
gradient HANDLE Gradient that contains the segment. segmentIndex INTEGER Segment from which to get the data. spotPosition REAL Position of the segment's color spot relative to left-most point of the gradient. midpointPosition REAL Position of the segment's midpoint relative to color spot immediately to left. red LONGINT Red component of the color spot's color. green LONGINT Green component of the color spot's color. blue LONGINT Blue component of the color spot's color.
Example
VectorScript
PROCEDURE Example; VAR gradient :HANDLE; segmentIndex :INTEGER; spotPosition, midpointPosition :REAL; red, green, blue :LONGINT; BEGIN gradient := GetObject('Cyan-Magenta-Yellow'); segmentIndex := 3; if gradient <> NIL then Begin GetGradientData(gradient, segmentIndex, spotPosition, midpointPosition, red, green, blue); Message(red, ' ', green, ' ', blue); END; END; RUN(Example);
Python
def Example(): gradient = vs.GetObject('Cyan-Magenta-Yellow') segmentIndex = 3 if gradient != None: spotPosition, midpointPosition, red, green, blue = vs.GetGradientData(gradient, segmentIndex) vs.Message(red, ' ', green, ' ', blue) Example()
Version
Availability: from VectorWorks10.0