Dear Friends,
We are create new plugin for Illustrator CC-2018.
Environment : MAC OS
Language : C++
We need to create mesh effect for selected arts on that project.
So we try to create mesh with using below code,but we unable to get correct result.
Sample Code :
AIMatchingArtSpec spec;
spec.type = kAnyArt;
spec.whichAttr = kArtSelected;
spec.attr = kArtSelected;
error = sAIMatchingArt->GetMatchingArt( &spec, 1, &SelectedPath, &SelectedPathCNT );
art = (*SelectedPath)[SelectedPathCNT - 1];
if(art == NULL)
{
return;
}
sAIArt->NewArt(kMeshArt,kPlaceAboveAll,NULL,&NewArt);
sAIMesh->InitCartesian(NewArt,4,4);
AIMeshSegmentIterator segment= NULL;
sAIArt->GetArtBounds(art, &artBounds);
pointA.h=artBounds.left;
pointA.v=artBounds.top;
pointB.h=artBounds.right;
pointB.v=artBounds.top;
pointC.h=artBounds.right;
pointC.v=artBounds.bottom;
pointD.h=artBounds.left;
pointD.v=artBounds.bottom;
sAIMeshSegmentIterator->SetPoint(segment,0, &pointA); //top left corner point
pointTMP.h=pointA.h+10;
pointTMP.v=pointA.v;
sAIMeshSegmentIterator->SetPoint(segment,1, &pointTMP); //horizontal handle
pointTMP.h=pointB.h-10;
pointTMP.v=pointB.v;
sAIMeshSegmentIterator->SetPoint(segment,2, &pointTMP); //horizontal handle of next point
sAIMeshSegmentIterator->SetPoint(segment,3, &pointB);
sAIMeshSegmentIterator->SetPoint(segment,4, &pointC);
sAIMeshSegmentIterator->SetPoint(segment,5, &pointD);
sAIMeshSegmentIterator->SetPoint(segment,6, &pointB);
sAIMeshSegmentIterator->SetPoint(segment,7, &pointC);
sAIMeshSegmentIterator->NextOnPatch(segment,kAIMeshCounterClockwise); //top right corner
sAIEnvelopeSuite->MakeEnvelope(&art,1,NewArt,nil,&envelop);
sAIEnvelopeSuite->SetEnvelopeObject(envelop,NewArt);
Result Snap:
All the anchor point are placed on origin point.Ref above snap
Excepted Result Snap:
please check above code. I think i made some mistake or missing some process on above code.
Ref above exception result on snap.
If any one have idea about this process kindly help to me.
I will wait for your reply.
With Regards,
Vignesh.K.