Skip to content

Latest commit

 

History

History
68 lines (61 loc) · 2.06 KB

File metadata and controls

68 lines (61 loc) · 2.06 KB

GetGradientData

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

Name Type Description
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.

Examples

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

Category