How to create a Gradientcolor from two existing swatches

Hello all,
I have 2 colors in the swatches palette.has anyone how to create a new gradient color from this to swatches.
So far I can get my to colors from the palette and extract their color:
aSwatch1 = sAISwatchList->GetSwatchByName( colList, colorName1 );
aSwatch2 = sAISwatchList->GetSwatchByName( colList, colorName1 );
iErr = sAISwatchList->GetAIColor( aSwatch1, &colorP1);
iErr = sAISwatchList->GetAIColor( aSwatch2, &colorP2);
// now somehow create a new gradient:
iErr = sAIGradient->NewGradient( &gradientHnd );
but what do now. to get the new color from colorP1 and colorP2. I need a simple linear gradient.
Any hints?
regards
Michael

Hello,
> Please, excuse any ignorance below. I'm not well versed in the actual artistic side of Illustrator, just the implementation
excused because you're the one of the few people here who give thoe most usefull answers
> Isn't that to be expected though? From my admittedly limited understanding, the gradient being saved is really just a sequence of colour stops. I would have thought since the angle of the gradient is more of a property of how its applied to the path (or whatever) that it wouldn't make sense to save it on the gradient colour.
No, not from my view (and needs ).
The color for the gradient has a type of AIGradientStyleMap. this struct contains the angle für the linear gradient etc. This color is added to the swatchpalette so it shoud keep the value.
If you replace the CreateGradientSwatch function in SnpGradien.cpp of the SnippetRunner with the following code a 2nd swatch with an different angle is added to the swatchpalette when creating a new linear gradient is created (name seems not what it should but 2 swatches are created. Applying this 2 swatches to a rectangle also the angle is changed as it should be.
So from my point of view Illustrator doesn't take the angle when a new color/swatch is created in the swatch panel. Why the angle is saved by creating a style is another question and difficult to answer without looking inside the source of Illustrator
ASErr SnpGradient::CreateGradientSwatch(const AIGradientHandle gradient, AISwatchRef& swatch)
ASErr result = kNoErr;
try {
// Insert new swatch at end of general swatch group.
swatch = sAISwatchList->InsertNthSwatch(NULL, -1);
// Get gradient name.
ai::UnicodeString gradientName;
result = sAIGradient->GetGradientName(gradient, gradientName);
aisdk::check_ai_error(result);
// Set swatch name.
result = sAISwatchList->SetSwatchName(swatch, gradientName);
aisdk::check_ai_error(result);
// Create the swatch color using the gradient.
AIColor swatchColor;
swatchColor.kind = kGradient;
swatchColor.c.b.gradient = gradient;
swatchColor.c.b.gradientAngle = 30;
swatchColor.c.b.gradientLength = 1;
AIRealPoint origin = {0,0};
swatchColor.c.b.gradientOrigin = origin;
swatchColor.c.b.hiliteAngle = 0;
swatchColor.c.b.hiliteLength = 0;
SnippetRunnerLog::Instance()->WritePrintf("gradientAngle: %.1f",swatchColor.c.b.gradientAngle);
SnippetRunnerLog::Instance()->WritePrintf("gradientLength: %.1f",swatchColor.c.b.gradientLength);
SnippetRunnerLog::Instance()->WritePrintf("gradientOrigin (v / h): %.1f /  %.1f", swatchColor.c.b.gradientOrigin.v, swatchColor.c.b.gradientOrigin.h);
SnippetRunnerLog::Instance()->WritePrintf("gradientAngle: %.1f",swatchColor.c.b.gradientAngle);
SnippetRunnerLog::Instance()->WritePrintf("hiliteLength: %.1f",swatchColor.c.b.hiliteLength);
// Set the swatch color.
result = sAISwatchList->SetAIColor(swatch, &swatchColor);
aisdk::check_ai_error(result);
// making a 2nd swatch
AISwatchRef swatch2;
swatch2 = sAISwatchList->InsertNthSwatch(NULL, -1);
result = sAISwatchList->SetSwatchName(swatch2, (ai::UnicodeString("Grad2")));
  // Create the swatch color using the gradient.
  AIColor swatchColor2;
  swatchColor2.kind = kGradient;
  swatchColor2.c.b.gradient = gradient;
  swatchColor2.c.b.gradientAngle = 60;
  swatchColor2.c.b.gradientLength = 1;
  swatchColor2.c.b.gradientOrigin = origin;
  swatchColor2.c.b.hiliteAngle = 0;
  swatchColor2.c.b.hiliteLength = 0;
result = sAISwatchList->SetAIColor(swatch2, &swatchColor2);
catch (ai::Error& ex) {
result = ex;
return result;
The CS3/CS4 question is easy: for CS3 i use the CS3 SDK and for CS4 I#m working with the CS4 SDK :-)

Similar Messages

  • How to create a table from an existing table with new column

    Hi !
    Please help me.
    I want to create a table from an existing table with data and add two new column to the new table.
    What will be the syntax?

    craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
    new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
    if you want to have VARCHAR2 instead of CHAR for example:
    SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
    Table created.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            CHAR(8)
    SQL> alter table new_dept modify (new_col varchar2(8));
    Table altered.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            VARCHAR2(8)Rgds.
    Didn't see michael's post - it reflects the fix for this problem using CAST.
    Message was edited by:
    dnikiforov

  • How to create a Group from an existing email -

    I just want to create a Group from an existing email received.  Don't want to add people individually to Address Book, then drag them to the Group.  Would prefer to copy/paste the addresses into the Group.  I'm part of a team at work wth 25 people!  Do I really have to add their addresses individually?  Seems ridiculous.  Don't even need their names - just the emails, so when I type in "United," for example, I get all the folks in that Group which is named "United."
    Thanks.

    There was a "magical" set of Applescripts that would have done that, but it no longer works.
    There is no way in the OS to do that besides making the Applescript yourself using the current Script Editor.
    Another way to do what you want is to select all of the addresses (select one, then cmd-A). Then, drag the selection to somewhere in the Finder. That will create a text clipping. You can then drag that text clipping into the address field in Mail.
    The text clipping will be named with the first few email addresses. You can rename it in the Finder.
    Each one can be your own "distribution" list.

  • How to create a Multigroup from two ODC's?

    Hello,
    In an existing PCUI Application, i would like to combine ODC4 and ODC5 into a single Multigroup so that i can add another Multigroup in the place of ODC5. Currently, both of these elements are of LIST Screen Element Types, have only one tab, have different Events and have different field group, structure and so is the different class.
    How can i combine these two into one Multigroup? I have never touched this area in PCUI and would really appreciate if you can provide any help on this.
    Thanks,
    Vasu

    Hi Vasu
    You can add the corresponding event from a tab group  to the existing multigroup or you can also create your own multigroup.
    regards
    shankar

  • HT5071 How to create an iBook from an existing PDF

    I just published a book, paperback. Can I now take it and make it into an iBook?
    Will it need a new ISBN number and things like that?
    Thanks Sarah

    !.) Yes, it's your content to distribute thru other channels if you like. Opne the PDF, and then select/cloy and paste into the iBooks Author template of your choosing. Format and style accordingly, then submit to the store.
    2.) An ISBN is optional.
    See iBooks Author: Publishing and distribution FAQ - Support

  • How to create new solution from Existing solution in integration services on TFS project?

    Hi,
    I am working on SSIS Project and it is created in VS 2008 .I opened the solution in VS 2010 and it is upgraded and unfortynately i don't have the back up to re open it in VS 2008.I am thinking of creating new solution from the existing one and open the new
    solution in VS 2008.I was struck how can we copy existing solution to new solution on TFS.
    Please let me know will this process work? and also how can we create a new solution without losing any files.
    Any help is appreciated.

    Hi moh1kumr,
    As Joost said, you can try to revert the changes back for the checked in files in TFS. For more information, please see:
    http://msdn.microsoft.com/en-us/library/ee371161(v=expression.40).aspx
    http://stackoverflow.com/questions/2694644/how-to-revert-roll-back-a-checkin-in-tfs-2010
    If it doesn’t work, I am afraid you have to design the package in VS 2008 from scratch.
    Regards,
    Mike Yin
    TechNet Community Support

  • Is it possible to use Aperture to make a new image from two existing ones--ie, in a new jpg? I essentially want to create a collage that I can then print as a single image, rather than in a book. Any advice will be most welcome!

    Is it possible to use Aperture to make a new jpg from two existing ones? I'd essentially like to create a photo collage (without using existing templates) that I can then print as a single image, rather than in a book. Any advice will be most welcome! Thanks.

    https://discussions.apple.com/message/15678716#15678716
    (Added)
    The main point is that Aperture is used to make digital negatives as good as they can be (for the uses you define), but it does not ADD date to your digital negatives, nor does it produce NEW combination files.  For those tasks you need a Graphics program.
    Message was edited by: Kirby Krieger

  • How to create a calendar for two years in GL

    how to create a calendar for two years in GL

    Hi,
    - Login into Oracle EBS and select a responsiblity with GL Superuser drants (e.g. General Ledger Super User)
    - Navigate to Setup + Financials + Calendars and open the GUI Accounting (Navigation for R12)
    - Query the used calendard (used from jour Set of Books/ Ledger via the GUI
    - Enter for each Period (= Period Type 13, 16, 18,...) one Record, have a look to the existing data, used the same logic.
    In the GUI, defined the calendar for 2 Years
    Dirk

  • How can I transfer songs from two different itunes?

    I want to transfer songs from my brother's itunes library to my shuffle, but when I plug it in his computer, a message saying that his library is not linked to my library (or something to that extent) and whether I would like to replace the songs. If I click yes, all my existing songs are replaced with HIS songs. If I click on NO, the Shuffle icon does not appear at all and I cannot transfer any of his songs to my shuffle. How can I transfer songs from two different computers into my shuffle without replacing any of my existing music?
    Shuffle   Windows XP  
      Windows XP  

    You'll have to setup your iPod to manual instead of automatic update (I'm not sure, though, if it works with the Shuffle as well).
    Alexander.

  • HT4061 How do I consolidate purchases from two different ids that are on the same bank account, and eliminate the extra id without losing any purchases?

    How do I consolidate purchases from two different ids that are on the same bank account, and eliminate the extra id without losing any purchases? I want my music to match on both ipad and computer.

    Purchases are forever tied to the AppleID they were bought with. There is currently no way to consolidate AppleIDs. Sorry.

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • How to create new or delete the existing row in the grid....

    hi my friends...
    i am developing report using Reuse_alv_grid_display...
    my requirement is... At runtime
              1.  i may create new row on the grid (empty row inwhich  i may enter the data).
              2.  i may delete a existing row in the grid
              3.  i may edit the existing data...
    then i have to trace the modification in the grid in one internal table...
    how can i get into this.....
    note:
    i have some idea to edit the existing record in the grid and trace those modification,
    but i don't know abt how to create new or delete the existing row....
    can you give me some idea...

    Hi deva,
    write a class which implemets these methods
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
    To handle the toolbar on alv
         handle_toolbar
           FOR EVENT toolbar OF cl_gui_alv_grid
              IMPORTING e_object e_interactive,
    To handle the buttons on the alv grid
         handle_user_command
           FOR EVENT user_command OF cl_gui_alv_grid
           IMPORTING e_ucomm.
    endclass.
    Now Implement these methods.
    CLASS lcl_event_receiver IMPLEMENTATION.
    To handle the toolbar on alv
      METHOD handle_toolbar.
       DATA ls_toolbar  TYPE stb_button.
        CLEAR gs_toolbar.
        MOVE 3 TO gs_toolbar-butn_type.
        APPEND gs_toolbar TO e_object->mt_toolbar.
        CLEAR gs_toolbar.
        PERFORM icon_create USING 'ICON_INSERT_ROW' gs_toolbar-icon.
        MOVE text-010 TO gs_toolbar-function.
        MOVE text-012 TO gs_toolbar-quickinfo.
        MOVE ' ' TO gs_toolbar-disabled.
        APPEND gs_toolbar TO e_object->mt_toolbar.
        CLEAR gs_toolbar.
        PERFORM icon_create USING 'ICON_DELETE_ROW' gs_toolbar-icon.
        MOVE text-011 TO gs_toolbar-function.
        MOVE text-013 TO gs_toolbar-quickinfo.
        MOVE ' ' TO gs_toolbar-disabled.
        APPEND gs_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.
       METHOD handle_user_command.
    In this form, check the function code(e_ucomm has the function code), based on that do the required action.
    as i said yesterday(i.e for appending a row, deleting a row, modifying a row)
        PERFORM user_command USING e_ucomm.
      ENDMETHOD
    endclass.
    Before calling the alv method, create a object of this class.
    DATA :
          gref_event_receiver  TYPE REF TO lcl_event_receiver,
          gv_tables_alv          TYPE REF TO cl_gui_alv_grid.
          CREATE OBJECT gref_event_receiver.
          SET HANDLER   gref_event_receiver->handle_user_command
                        FOR gv_tables_alv.
          SET HANDLER   gref_event_receiver->handle_toolbar
                        FOR gv_tables_alv.
    check this program for event handling, it is the similar way
    demo_abap_objects_events
    Hope u understood this.
    Regards,
    Prasant
    reward if helpful

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • How do I calculate days from two different dates?

    Hi all,
    How do I calculate days from two different dates?
    my requirement is to pass the number of days to target field from two dates.
    Current date :  14/04/2010
    Standard date: 01/01/1957 is the standard = day 0
    Is it possible in graphical mapping with out  udf?
    Plz help me on this I have donu2019t have much knowledge on JAVA.
    Thanks

    Hi Yadav,
    Probably this is not the correct forum for XI / PI .
    You can post the same to...
    Process Integration (PI) & SOA Middleware
    Hope this helps.
    Regards
    Raj

  • How do I calculate days from two different dates in XI/PI?

    Hi all,
    How do I calculate days from two different dates in XI/PI?
    my requirement is to pass the number of days to target field from two dates.
    Current date : 14/04/2010
    Standard date: 01/01/1957 is the standard = day 0
    Is it possible in graphical mapping with out udf?
    Plz help me on this I have donu2019t have much knowledge on JAVA.
    Thanks

    Hi Yadav,
    Probably this is not the correct forum for XI / PI .
    You can post the same to...
    Process Integration (PI) & SOA Middleware
    Hope this helps.
    Regards
    Raj

Maybe you are looking for

  • Change Field in Report

    Hello Friends, Is there any possibility to change a name of a field on a report on UCCX. BR

  • In Smartform the data already stored in Arabic ?

    Dear Freinds,           I have developed Smartform and the data is coming perfectly relating to all fields but one particular field data is not getting printed and iam getting data in an un readable format . The data has to be displayed as Arabic TEx

  • Ibook- G4 Questions. Apple Virgin

    I recently acquired an ibook G4 from a friend and am using it as a secondary computer when I am not home. I don't really know much about apple and could really use some help. I was wondering if the OS can be updated above the current 10.4.11 I am cur

  • HT4108 Video out issues. Ipad 3

    After upgrading to ios 6.1.2 my ipad3 , both VGA and hdmi video connectors have stopped working.  They work fine on my iPhone 4S. Anyone else had this problem?

  • Running two Eurotherm 3216 temperature controllers using the driver available from Labview

    Hi All, I am trying to control two Eurotherm 3216 temperature controllers using the driver provided by NI at http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=7F14CDCB24923797E04400144F1EF8.... Specifically, I am using the "Temper