How to properly create path art object, please help

Hello there,
I have a vector of AIRealPoint , each point is actual X, Y coordinate of the stroke. I need to create path art object out of this vector.
I'm  somehow confused how to correctly construct segments array form the given AIRealPoints, my goal is to have single path object where count of segments is equal to count of AIrealPoints first and last points are anchors. SDK documenation is not really helping here...
Please, take a look at the code snippet, it seems I'm doing something wrong with in and out params of segment , in any case I fail to create simple path object ....
ASErr CretaeVectorPathTest2(vector<AIRealPoint>& stroke)
AIArtHandle artHandle;
ASErr result = kNoErr;
try {
  AIRealPoint start;
  long lngStrokeLength = stroke.size()-1;
  AIArtHandle lineHandle = NULL;
  AIErr error = sAIArt->NewArt( kPathArt, kPlaceAboveAll, NULL, &lineHandle );
  if ( error ) throw( error );
  error = sAIPath->SetPathSegmentCount( lineHandle, lngStrokeLength );
  if ( error ) throw( error );
  AIPathSegment *segment = new AIPathSegment[lngStrokeLength];
  // This is a first point of the path
  segment[0].p.h = stroke[0].h;
  segment[0].p.v = stroke[0].v;
  segment[0].in = segment[0].out = segment[0].p;
  segment[0].corner = true;
  for(inti=1 ;i< lngStrokeLength-1;i++)
   segment[i].p.h = stroke[i].h ;
   segment[i].p.v = stroke[i].h ;
   // NOT GOOD!!!
   segment[i].in.h  = stroke[i-1].h ;
   segment[i].in.v  = stroke[i-1].v ;
   segment[i].out.h  = stroke[i+1].h;
   segment[i].out.v  = stroke[i+1].v;
   segment[i].corner = false;
// NOT GOOD!!!
  // This is a last point of the path
  segment[lngStrokeLength].p.h = stroke[lngStrokeLength].h;
  segment[lngStrokeLength].p.v = stroke[lngStrokeLength].v;
  segment[lngStrokeLength].in = segment[lngStrokeLength].out = segment[lngStrokeLength].p;
  segment[lngStrokeLength].corner = true;
  error = sAIPath->SetPathSegments( lineHandle, 0, lngStrokeLength, segment );
  if ( error ) throw( error );
  error = sAIPath->SetPathClosed( lineHandle, false );
  if ( error ) throw( error );
// apply color width etc.
  AIPathStyle style;
  error = sAIPathStyle->GetPathStyle( lineHandle, &style );
  if ( error ) throw( error );
  style.strokePaint = true;
  style.stroke.color.kind = kFourColor;
  style.stroke.color.c.f.cyan = 0;
  style.stroke.color.c.f.magenta = 0;
  style.stroke.color.c.f.yellow = 0;
  style.stroke.color.c.f.black = 100;
  style.stroke.width = 0.75;
  style.stroke.dash.length = 0;
  delete[] segment;
  error = sAIPathStyle->SetPathStyle( lineHandle, &style );
  if ( error ) throw( error );
catch (ai::Error& ex) {
  result = ex;
return result;
Thanks,
David

As for beziers, Illustrator uses cubic beziers which are fairly straight forward (thank goodness!). Here's a lift from Wikipedia's Bezier entry:
This image is pretty good at demonstrating how AI's bezier segments work. In the animation, the moving point has two lines sticking off it, ending with two points. If P3 was an AISegment, the left-hand blue point would be in and the right-hand point would be out. If we were to translate the state of the animation in its last frame into AI code, you'd basically have something like this:
AISegment segment1, segment2;
segment1.p = p0;
segment1.in = p0;
segment1.out = p1;
segment2.in = p2;
segment2.p = p3;
segment.out = p3;
Note that this would imply any line that continues beyond either end point isn't a smooth beizer curve (i.e. the curve is limited to between these points). That effectively makes them corner points (I think). Also, the line formed by linking in & p or out & p is the tangent to the curve at p, which I think you can make out from from the animation.
Another way to get a feel for this is to use the pen tool to draw a line with a few segments. If you then pick the sub-select tool (white selection arrow, not black selection arrow) and select individual points on the curve, you'll see when you do that two 'anchors' jut out from each point. Those are the in & out for that point on the curve.
Its all a little confusing because technically, a bezier segment between p & q would be p, p.out, q.in & q. (four vertices). To avoid repeating information, and keep it simple for non-beziers, AI's segments are still the vertices. So if you wanted to make the nth segment a beizer, you'd need n & n+1 from AI's path, and you'd modify two-thirds of each AISegment (p, out from n & in, p from n+1).
I hope that helps, but if you have any further questions, feel free to ask! If you need to do anything fancy with beziers, there are some helpful utilites in AIRealBezier.h.

Similar Messages

  • How to properly create complex OCI objects (for Annotation Text)

    I am upgrading a tool that will upload text objects to a table with a ST_ANNOTATION_TEXT field. The app is a C++ app and I need to instantiate a ST_ANNOTATION_TEXT (using OCIObjectNew??). I actually have 2 questions. First, does anyone have an example of how to accomplish this? I seem to be unable to correctly create the annotation text type in C++ to be able to append to (calling OCICollAppend). Second, since ST_ANNOTATION_TEXT is a complex type (contains an array of annotation text elements), do I need to call OCIObjectNew on not only the main ST_ANNOTATION_TEXT type but also for the ST_ANNOTATIONTEXTELEMENT_ARRAY, ST_ANNOT_TEXTELEMENT_ARRAY, and the ST_ANNOTATIONTEXTELEMENT?
    I can't seem to find in info on this so hopefully someone else has been through this.

    user3068343 wrote:
    I am still having an issue where the sub objects are still NULL.Actually I was mistaken. I must have confused getting an Object from OCIObjectNew with using one of its constructor method in a statement.
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/oci18nav004.htm#sthref3438 clearly state the object will have NULL attributes, unless the OCI_ATTR_OBJECT_NEWNOTNULL flag is set on the environment handle.
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/oci11obj.htm#i446308 further tells you what the default value for the object members will be.
    An older 9i doc http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjadv.htm#1008774 also warns about resetting the indicator struct member when you update a member of the object.
    user3068343 wrote:
    ++a) you allocate the object's top-level struct yourself (SDO_GEOMETRY in my case) in C+++
    Above you suggest creating the objects top-level struct myself. How do you create that top level object? I have been using OCIObjectNew on that object as well as its sub objects? Is that how you are creating the top-level object?This technique works only on binds, as objects you get back from defines are always allocated from the object cache. I create the top-level object directly on the stack... This is something I discovered worked, but is not documented, so you're probably on safer ground using OCIObjectNew instead.
    BTW, the reason I can't easily post OCI example code is that my code uses wrappers around the objects that hides most of the OCI:
    Geometry Geometry::make_point(OCIEnv* envhp, OCIError* errhp, float x, float y) {
        Geometry point_geom(envhp, errhp);
        point_geom.set_null(false);
        point_geom.gtype() = 2001;
        PointRef point = point_geom.point();
        point.set_null(false);
        point.x() = x;
        point.y() = y;
        return point_geom;
    }The above creates an 2D point-type SDO_GEOMETRY hidden inside the Geometry class, itself deriving from a GeometryRef class. The latter wraps a C++ API on top of the struct pointers for a SDO_GEOMETRY/SDO_GEOMETRY_ind, while Geometry actually composes the OTT generated value/indicator structs by value, and passes addresses to its nested structs to GeometryRef (its parent class). So GeometryRef can manipulate an object irrelevant of where it was allocated, the stack or the object cache. The Geometry class is a value class, but it's useful for binds only, and like I said uses a behavior which appears to work but is not explicitly documented.
    Unless you have nested objects by reference, nested objects are composed by value in the OTT-generated structs, so the space for all nested objects is already allocated after the first OCIObjectNew. But the members themselves are not initialized, and thus marked as null in the indicator struct.
    In the code above, my Geometry instance is fully allocated (on the stack), but fully uninitialized (the indicator is by default set to all nulls). I first set the atomic flag to non-null, then get the Ref wrapper around its nested SDOPOINT_TYPE to also set it to non-null, and fill in the x/y member (via another NumberRef wrapper, which knows about the member and the indicator for that member, and sets it as non-null when assigned to). Notice how how I return the instance by copy: My point geometry instance doesn't have a pointer-aliasing issue here, only because its two OCIColl* are null. In the general case, you can't copy my value wrappers without making a true deep copy... But I'm getting into the weeds here.
    The important point is that OCIObjectNew doesn't init the nested objects unlike what I stated earlier. Sorry for misleading you on that. --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to properly install airport extreme?please help

    please help me install this airport extreme
    i think im doing everything right but i dont know
    please help
    thanx

    When changing ISPs (or networking equipment) it's always a good idea to start from "scratch" in configuring your equipment.
    I would recommend that you do the following as a minimum:
    Power-down the modem, AirPort base station, and computer(s).
    While all of the devices are powered-down, perform a "factory default" reset on the base station. This will get it back to its "out-of-the-box" configuration and make setting it up much easier, especially if you use the "Assist me" process within the AirPort Utility. (ref: Resetting an AirPort Base Station or Time Capsule)
    After the base station resets, go ahead and power it back down.
    Power-up the modem; wait at least 10-15 minutes.
    Power-up the base station; wait at least 5-10 minutes.
    Power-up your computer(s).
    In this basic configuration, computers connected to the base station, either by wire or wireless (as appropriate for the base station type), should now be able to access the Internet through the ISP's modem. Once Internet connectivity has been verified, you can use the AirPort Utility to configure the base station for wireless security and any other desired options.

  • How can i create a custom object 0REQUID

    Hello all,
    I have a question. How can i create a custom object 0REQUID? Is it possible to create it without actvating BI content?
    Thanks in advance..

    Hi,
    If you want to create a new info object which is a copy of 0REQUID. then
    Go to > info object key figure / Chara catalogue> create new key figure / Chara --> enter 0REQUID in front of TEMPLATE and you will get all details of 0REQUID in your new key figure / chara.
    Hope this helps.
    Assgn pts if helpful.
    Regards
    Edited by: chintamani deshmukh on Apr 14, 2008 11:09 AM

  • How can we create a ABAP object into .ptr file

    HI,
          How can we create a ABAP object into .ptr/.car/.sar format so that we can give it to a remote client and which can be imported into their R/3 system to get the functionality of this object.

    Hello Ramesh
    All you need is SAPLINK. Have a look at the following links:
    <a href="/people/ed.herrmann/blog/2005/11/14/the-enterprise-and-the-bazaar Enterprise and the Bazaar</a>
    <a href="https://sourceforge.net/projects/saplink/">SAPLINK</a>
    Regards
      Uwe

  • How to acess Database in I18N? Please help.

    How to acess Database in I18N? Please help.

    I have tried to overide the getContents() method of ListResourceBundle class but it returning an error at run time saying null Pointer exception.
    Here are the 2 codes resp.
    import java.util.*;
    public class Test1
         static String string ;
         public static void main(String args[])
    Locale locale = Locale.ENGLISH;
    ResourceBundle myResources =
    ResourceBundle.getBundle("MyResources", locale);
    string = myResources.getString("HelpKey");
    System.out.println(string);
    import java.util.*;
    import java.sql.*;
    public class MyResources extends ListResourceBundle
         static String[][] s3= null;
    String s6= null;
         String s7= null;
    public Object[][] getContents()
    Object[][] obj= (Object[][])dataBase();
              for(int i= 0; i< obj.length;++i){
                   for(int j = 0;j<obj.length;++j){
                        System.out.println("GGGGGGGG obj["+i+"]["+j+"]"+obj[i][j]);
              //s6=(String)obj[0][0];
         //     s6= obj[0][0].toString();
              //s7=obj[1][0].toString();
    Object[][] contents = { {s6},{s7}};
         return contents;
         private static String[][] dataBase()
         {           try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con=DriverManager.getConnection("jdbc:odbc:DSN");
                   PreparedStatement stat= con.prepareStatement("Select Value,Key from Table1 where Key= ?");
                   String s1= "HelpKey";
                   stat.setString(1,s1);
                   ResultSet rs= stat.executeQuery();
                   while(rs.next())
                        String s2= (String)rs.getString("Key");
                        String s4= (String)rs.getString("Value");
                        String[][] s3 ={{s2},{s4}};
              catch(Exception e)
              e.printStackTrace();
         return s3;

  • My ebay toolbar and the ebay logo that was in my system tray at the bottom have both disappeared when I installed FireFox??? How do I get them back? Please help.

    my ebay toolbar and the ebay logo that was in my system tray at the bottom have both disappeared when I installed FireFox??? How do I get them back? Please help.

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 
    Regards
    TD 

  • Cannot View Album Art.. please help!

    Hi. I've been wondering how I can put album art onto my nano... I'm quite confused because I have one song that has the album art beside it when in "Now Playing" but for the rest of the songs... I don't see any album art. Please help me.. it has been bugging me for quite a while now =(
      Windows XP  

    What I mean is that you don't have to do the album art for each song, one by one, in an album.
    In itunes, click on the first song in the album. Then hold down the shift key and click on the last song in the album. All the songs inbetween the two you clicked on will be selected.
    Then, just drag or paste the artwork into the box on the left and all the selected songs will get the same artwork.

  • ITunes wont open for me. it keeps saying "the Disc "untitled playlist" cannot be read. An unknown error occurred (-69)." don't know how to get it to work. Please help

    iTunes wont open for me. it keeps saying "the Disc "untitled playlist" cannot be read. An unknown error occurred (-69)." don't know how to get it to work. Please help

    It is likely a hardware failure
    http://support.apple.com/kb/TS3694?viewlocale=en_US#error1

  • TS4605 Hi, I was working in WORD on a file containing huge data. My machine just hung up one day while working and now I seem to have lost the file how do I get it back.  Please HELP me.

    Hi, I was working in WORD on a file containing huge data. My machine just hung up one day while working and now I seem to have lost the file how do I get it back.  Please HELP me.

    Well, iCloud has nothing to do with this.
    Do you have the built-in backup function Time Machine running on your Mac?
    See: http://support.apple.com/kb/ht1427

  • I recently bought a dbx hardware compressor and am not quite sure how to use it in logic express 9. I hav a focusrite saffire 6 usb audio interface and am not dont how to use it in logic. Please help???

    I recently bought a dbx hardware compressor and am not quite sure how to use it in logic express 9. I hav a focusrite saffire 6 usb audio interface and am not dont how to use it in logic. Please help???

    MUYconfundido wrote:
    Pancenter,
    Thanks for the response, but I do not have a midi interface. I am using a midi to usb connector cable, thus bypassing the need for a Midi interface.
    The Mac reads the USB cable as a midi device, but not the keyboard that I am trying to use as a controller. I have tried it with my korg sp 300 and with my Nord Electro 2.
    Thoughts?
    Thanks,
    Tristan
    Tristan...
    This is what you have, correct?
    http://www.alesis.com/usbmidicable
    This from Alesis..
    "The AudioLink Series USB cable receives and outputs MIDI signal thanks to its internal interface. The USB-MIDI Cable connects plug-and-play to your Mac or PC for an all-in-one USB-MIDI solution."
    Notice, -internal interface-. What you have is a simple USB MIDI Interface. Most MIDI interfaces are USB.
    My point is (was), MIDI OUT of the Korg goes to the connector marked MIDI IN on the Alesis, those new to MIDI often get this wrong.
    pancenter-

  • I just updated my iPod touch and all my pictures are gone!!! How do I get them back? Please help!!!

    I just updated my iPod touch 4th generation to iOS 6.0.1 and all my pictures are gone!!! Everything else is there but my pictures! How do I get them back? Please help!!!

    If the photos were i your iPod's Camera Roll album (taken by or saved to the iPod you can:
    - If your PhotoStream is on you can get the last 30 days worth back. See that topic here:
    iOS: Importing personal photos and videos from iOS devices to your computer
    - Or you can restore from backup if you backed up when the photos were on the iPod.
    If the photos were synced to the iPod then you have to get them from where you got them the first time.

  • HT1386 I have been trying to sync my iPhone and its not syncing. I've synced it before but now it has gone away. How can I re-sync it? Please help.

    I have been trying to sync my iPhone and its not syncing. I've synced it before but now it has gone away. How can I re-sync it? Please help.

    you did enable Music syncing in iTunes, yes?

  • How do I get PBS again?  Please help!!!

    I was able to get PBS when I first got Apple TV after putting in a code, but my cable company recently changed their channel lineup, and I can no longer get PBS on Apple TV.  I used to get PBS on channel 314 on my TV, but after speaking with my cable company, I now get it on channel 198, but I can't get anything at PBS on Apple TV. All I get when I go there is the "downloading circle" and nothing happens.  The cable company can't help, and I've written to PBS several times with no reply.  I thought maybe I could get a different code and start over, but I don't know how to do that.  Can anyone help, please.  PBS is one
    of the main reasons I bought Apple TV.  Thanks. 

    I don't know who vaszandrew is, but I (diamond2277) wrote How do I get PBS again?  Please help!!! 
    It got printed and I lost my page so I started over again, and the one above with my question showed             (dated May 2, 9:56 am) as if it were an answer to vasndrew.
    After I wrote, it occurred to me that maybe if I disconnect my Apple TV and reconnect it, I will get PBS, and it worked.  Now I don't need an answer.  Thanks to anyone who was going to answer!  I have to remember my usual answer to technical problems, UNPLUG, AND START AGAIN.

  • My iphone 4 screen turns into blue, and i can't do anything because my power button is broken. How to fix my iphone back? Please help me

    my iphone 4 screen turns into blue, and i can't do anything because my power button is broken. How to fix my iphone back? Please help me

    I am having the SAME exact problem! Except instead of lock button broken it's my home button so I can't do the whole "put in recovery mode" deal. My screen only says "tap the home button 3 times" and it has my screen locked until I hit the home button but since it is broken I can't get in my phone at all. I have all of my work info in my phone so I'm screwed and can't get any help. PLEASE let me know if you find a way around this...!!!
    Thanks!

Maybe you are looking for

  • GETWA_NOT_ASSIGNED in EWA generation

    Hi Experts, I am facing the following dump u201CGETWA_NOT_ASSIGNED u201C, Termination occurred in the ABAP program "SAPLDSVAS_GRAPH" - in u201CSET_EXTREME_VALUES".The main program was "RDSMOP_MAIN ". In the source code you have the termination point

  • Hard Drive Failed after replacement

    My computer recently went in for a repalcement harddrive from HP Support as it is still under warranty. After recieving it back I went and ran the same test that told them the harddrive had failed last time and recieved a failure id of  GGANWC-67H6K8

  • Need help fast, project due in Three days...

    I made a really basic video on iMovie for school, my very first movie, and am having some problems with the quality. The movie was all finished then I shared it, or exported, or whatever to the desktop as and mpeg. The quality though was all pixelate

  • How to use linux_11gR2_database_1of2.zip

    I downloaded the 32 bit 11g files disk1 and disk2 but unzip says that linux_11gR2_database_1of2.zip is not a proper zip file. The FTP to the server was done as binary and I redownloaded disk1 to ensure that it was not corrupted in the download. How d

  • I just want to smash my MacBook...

    I am having so many problems with this thing. Photoshop keeps crashing, it freezes randomly, and now I was working on a project during class and it just decides to shut down. Seriously, I need a better Mac but I cant afford another one, can I just tr