Jump to content
Developer Wiki and Function Reference Links ×

Object's gradient fill name?


Petri

Recommended Posts

Hi Petri,

I haven't tried this, but...

Assuming "hObject" is the handle to your object that has gradient fill

var

GradientIndex: longint;

GradientName: string;

begin

{try this first}

GradientIndex:= GetFPat(hObject);

{if that doesn't work, try this instead}

GradientIndex:= GetObjectVariableLongint(hObject, 695);

{now that you have the index of the gradient, you can get its name}

GradientName:= Index2Name(GradientIndex);

end;

Try creating a simple rectangle with a gradient fill, and then export a file as Vectorscript. Then you can see what VS functions are used to define the gradient, as well as what functions are used to set the gradient as a fill for a particular object. In this case I noticed a line that looked like this:

SetObjectVariableLongInt (objectHandle,695,result * -1);

According to the VS Function Reference for the GetFPat function, "A negative value corresponds to internal index of a vector fill pattern applied to the object". Also, the 695 Object Selector is Object Fill Style. Since we want to find the value, use the "Get??" function instead of the "Set??" function.

Good luck,

Link to comment

Thanks, Rick. That makes sense - but does not work. I get the gradient index (they seem to be negative, ie. are vector fills), but no name is returned with Index2Name.

How annoying! Well, I've had the same problem with hatches.

PROCEDURE GetGradientName;
VAR
gradientIndex : LONGINT;
gradientName : STRING;
obHd : HANDLE;

BEGIN
obHd := FSACTLAYER;

gradientIndex := GETFPAT(obHd);
gradientName := INDEX2NAME(gradientIndex);

{MESSAGE(gradientName);}
MESSAGE(gradientIndex);
END;

RUN(GetGradientName);

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...