10 Replies Latest reply: Feb 7, 2010 2:23 PM by Wayne Constable-AEjbzi RSS

    Document Raster Effects Settings... again...

    Wayne Constable-AEjbzi Community Member

      Hi All,

       

      I know this has been asked a couple of times before, but I don't think anyone ever confirmed the correct way of querying/setting these values.  I'm using the CS3 SDK on Mac OS X 10.6.2

       

      So, as the subject states, I'm after the values in the "Document Raster Effects Settings..." dialog, located in the "Effects" menu.  Specifically, the "Resolution".  I believe it was suggested in the previous threads about this to look at the "outputResolution" field of the AIDocumentSetup struct.  The CS3 SDK states that this field is "Not Used" and the field itself always seems to be set to 800.0 for me.

       

      I noticed that these values were local to the document itself and that modifying them causes the documents dirty flag to be set. So I thought maybe they're stored in the document's dictionary.  So I dumped out the key strings from the document's dictionary and found "AI9 Output Rasterization Resolution" which (after having to guess the data type) always seems to be 300.

       

      I don't know where else to look.  These values have to be stored somewhere as they are stored with the document.  I can view them easily as part of the document object via an Applescript dictionary explorer, but I refuse to believe that Applescript has access to a value that I don't via a plugin.

       

      If anyone can help me shed any light on this I'd really appreciate it!

       

      -W

        • 1. Re: Document Raster Effects Settings... again...
          A. Patterson Community Member

          Man, a lot of people seem to want to do this and apparently we have never found a solution I wish someone from Adobe would chime in here, I'm afraid I'm tapped out for ideas. Unless its actionable, in which case you could probably use AIActionSuite::PlayAction to do an end run on setting it. That said, feels kind of dumb that its so hard to modify document setup when there's an obvious struct.

          • 2. Re: Document Raster Effects Settings... again...
            Wayne Constable-AEjbzi Community Member

            It is getting kinda frustrating.  I've now resorted to listening for a various notifications for clues as to what's going on when that "Ok" button is clicked in the dialog.  So far I'm catching a preferences-changed notification but I haven't yet determined what (if anything) is being sent with it, guess I'll keep looking.

             

            My only goal here is reading the current "Resolution" value, I have no need to modify it.  I'm hoping this much is possible and of course, if I get anywhere, I'll post the details here of course

             

            -W

            • 3. Re: Document Raster Effects Settings... again...
              Wayne Constable-AEjbzi Community Member

              Ok, seems like I made a few hasty assumptions.

               

              The Illustrator preferences are changed when something changes in the Doc Raster Effects Settings dialog.  This dialog seems to be implemented by an external plugin and upon the user clicking "OK", the default values are changed and stored in the preferences, hence the notification.  After looking at the preferences file before and after an alteration to the values, the defaults for this dialog are stored in:

               

              /plugin

              {

                   ...

                   /Rasterize {
                           /Defaults {
                               /Padding 36.0
                               /Mask 0
                               /Spot 1
                               /Alias 0
                               /DPI 300
                               /Type 5
                           }
                           /rasterizeMemory 20

                   }

                   ...

              }

               

              However these are just the default values, presumably the values applied to all new documents.  These settings are also stored at the document level, as closing the document and opening it elsewhere shows the same values.  I'm still convinced that the dictionaries are the right place to look, although needle in haystack springs to mind.

               

              -W

              • 4. Re: Document Raster Effects Settings... again...
                A. Patterson Community Member

                Setting the Document Raster Effects is actionable, so you could always use that as a means. I recorded an action that set the settings to the following:

                 

                Model: CMYK

                Resolution: 300 dpi

                Background: Transparent

                Anti-alias: No

                Create Clipping Mask: No

                Padding: 36 pt

                 

                The action looks like this:

                 

                /version 2
                /name [ 5
                    5365742031
                ]
                /isOpen 1
                /actionCount 1
                /action-1 {
                    /name [ 8
                        416374696f6e2033
                    ]
                    /keyIndex 0
                    /colorIndex 0
                    /isOpen 1
                    /eventCount 1
                    /event-1 {
                        /internalName (ai_plugin_rasterEffectSettings)
                        /localizedName [ 32
                            446f63756d656e742052617374657220456666656374732053657474696e6773
                        ]
                        /isOpen 1
                        /isOn 1
                        /hasDialog 1
                        /showDialog 0
                        /parameterCount 6
                        /parameter-1 {
                            /key 1668246642
                            /showInPalette -1
                            /type (enumerated)
                            /name [ 4
                                434d594b
                            ]
                            /value 5
                        }
                        /parameter-2 {
                            /key 1685088558
                            /showInPalette -1
                            /type (integer)
                            /value 300
                        }
                        /parameter-3 {
                            /key 1651205988
                            /showInPalette -1
                            /type (enumerated)
                            /name [ 11
                                5472616e73706172656e74
                            ]
                            /value 1
                        }
                        /parameter-4 {
                            /key 1634494835
                            /showInPalette -1
                            /type (boolean)
                            /value 0
                        }
                        /parameter-5 {
                            /key 1835103083
                            /showInPalette -1
                            /type (boolean)
                            /value 0
                        }
                        /parameter-6 {
                            /key 1885430884
                            /showInPalette -1
                            /type (unit real)
                            /value 36.0
                            /unit 592476268
                        }
                    }
                }

                 

                Its pretty obvious which parameters are which, so one should be able to use AIActionSuite::PlayAction at worst to change the document raster settings.

                • 5. Re: Document Raster Effects Settings... again...
                  A. Patterson Community Member

                  Nevermind, I found the dictionary entries. The document's dictionary has an entry called 'AI Auto Rasterize'. That is itself a dictionary, which contains the following entries:

                   

                  'padd', real entry (Padding)

                  'mask' boolean entry (Create Mask)

                  'spot' boolean entry (Preserve Spot Colours)

                  'alis' boolean entry (Anti-Alias)

                  'dpi.' integer entry (DPI, yes, that is a period at the end)

                  'colr' integer entry (combination of Colour Model & background colour)

                   

                  That last one will take a little bit of investigation. I think there must be an enum for it somewhere in the headers, but when I changed CMYK (with transparent background) to Greyscale (with transparent background) I believe it changed from 5 to 4. When I tried CMYK (with white background) it went to 1. So those two settings are obvious tied up together, but at worst we can just map them out once and be done with it.

                  • 6. Re: Document Raster Effects Settings... again...
                    A. Patterson Community Member

                    The 'colr' setting seems to be AIRasterizeType from AIRasterize.h, though not all options appear in the dialog. So far all the options from the dialog & the corresponding values that show up in 'colr' do seem to match values in AIRasterizeType though. E.g., Bitmap, white background is 3 (kRasterizeBitmap) while Bitmap, transparent background is 7 (kRasterizeABitmap). I'm not sure why the RGB options don't show up, but as long as you just use the CMYK, Grayscale & Bitmap options from AIRasterizeType, I think you'll be all right.

                    • 7. Re: Document Raster Effects Settings... again...
                      Wayne Constable-AEjbzi Community Member

                      Mr Patterson, you are the man

                       

                      I had originally started to write a dictionary 'walker' to traverse each entry, determine its type and display its value, but I decided to put it down and carry on with some other work and hope for some fresh inspiration.   Guess I should've continued!

                       

                      I don't have access to the code at the moment but I'll give it a go as soon as I am.  I saw that key too but it just never clicked that it could contain another dictionary with everything I needed.

                       

                      On an interesting side note, while I was looking at some of the other notifications, I see there is a "

                      _AIDictionaryKeyChangedNotifyData" structure in AIDictionary.h.  I also remember seeing somewhere, a comment stating that this notification is never sent.

                      Thanks again, I appreciate the time and effort you've put in to investigate this.  If there were an MVP equivalent from Adobe, you'd get one

                      -W
                      • 8. Re: Document Raster Effects Settings... again...
                        A. Patterson Community Member

                        Actually, it didn't take a whole lot of effort once you mentioned the dictionaries. I wrote a dictionary walker myself late last year for debug testing; depending on what key you're holding down it will dump the dictionaries for the art you hit, or the current layer or the dictionary. So it was fairly easy to test I wish it was stand alone, I'd post it somewhere, but unfortunately its pretty tightly integerated into our product so I can't

                         


                        Dictionary key notifier? Interesting. I just did a search and turned it up (top of AIDictionary.h), but unfortunately it has this in the comment:

                         

                        /** The data for the dictionary key-changed notifier. (Not currently sent). */

                         

                        Heh, figures

                         

                        At any rate, this comes up so often I'm just glad we can finally put it to rest. I suspect this thread will get linked to an awful lot!

                        • 9. Re: Document Raster Effects Settings... again...
                          A. Patterson Community Member

                          The more I think about it, a debug dump tool should be included as one of the example projects in the SDKs. It'd be damned handy, it would be a good demonstration of dictionaries to boot. Hint, hint Adobe!

                           

                          Just thought I'd give you a sample of my output to give you ideas, in case you decide to finish that debug tool of yours:

                           

                          *** ------ Debug Dump of document dictionary
                          + Art dictionary 0x17ea0620 - 37 entries
                               + #document [ "XML Node" ] = <not implemented>
                               + AI11 Document Setup Flattener Preset Name [ "Unicode String" ] = "[Medium Resolution]"
                               + -Adobe/Harmony/BaseColor [ "Fill Style" ] = <not implemented>
                               + BleedLeftValue [ "Real" ] = 0
                               + CropAreaActive [ "Integer" ] = 0
                               + CropAreaArray [ "Array" ] = <not implemented>
                               + AI Auto Rasterize [ "Dictionary" ] 6 entries
                                    + padd [ "Real" ] = 36
                                    + mask [ "Boolean" ] = false
                                    + spot [ "Boolean" ] = true
                                    + alis [ "Boolean" ] = false
                                    + dpi. [ "Integer" ] = 300
                                    + colr [ "Integer" ] = 5
                               + AI9 paper simulation [ "Boolean" ] = false
                               + AI9 artboard color [ "Integer" ] = 1
                               + CropAreaInHardCords [ "Boolean" ] = true
                               + AIDocumentCanvasSize [ "Integer" ] = 16383
                               + AI9 artboard color 1 blue [ "Integer" ] = 65535
                               + AI11 document knockout group [ "Boolean" ] = false
                               + AI11 document isolate blending [ "Boolean" ] = false
                               + AI9 Mesh Rasterization Resolution [ "Real" ] = 150
                               + AI9 artboard color 2 red [ "Integer" ] = 52428
                               + AI9 artboard color 2 green [ "Integer" ] = 52428
                               + AI9 Output Rasterization Resolution [ "Real" ] = 300
                               + AI9 transparency grid size [ "Integer" ] = 2
                               + AI9 artboard color 2 blue [ "Integer" ] = 52428
                               + AI9 artboard color 1 green [ "Integer" ] = 65535
                               + AI9 artboard color 1 red [ "Integer" ] = 65535
                               + AI11 Preserve Text Editability [ "Boolean" ] = true
                               + AI11 Document Setup Language Popup [ "Integer" ] = 0
                               + GlobalRepulsion [ "Real" ] = 5
                               + BleedTopValue [ "Real" ] = 0
                               + BleedRightValue [ "Real" ] = 0
                               + AI10 flattener outline strokes [ "Boolean" ] = true
                               + AI10 flattener preserve overprints [ "Boolean" ] = true
                               + AI9 Flattening Quality Level [ "Integer" ] = 4
                               + AI10 flattener raster-vector balance [ "Integer" ] = 75
                               + AI10 flattener clip complex regions [ "Boolean" ] = true
                               + AI10 flattener outline text [ "Boolean" ] = false
                               + kAIFullDocumentVersionStr [ "String" ] = "14.0.0"
                               + SelHatDocTableDict [ "Dictionary" ] 2 entries
                                    + SelHatDocLocalNamesArray [ "Array" ] = <not implemented>
                                    + SelHatDocInterIDsArray [ "Array" ] = <not implemented>
                               + BleedBottomValue [ "Real" ] = 0
                               + -AI9 transparency edit state [ "Integer" ] = -1
                          --------------------------------------------

                           

                          '<not implemented>' simply means I haven't bothered to implement a display for that type yet. The code is exactly the same, naturally, no matter if its art, layer or document -- the keys just indicate what extar work should be done to find the root dictionary to be fed into the output generator.

                          • 10. Re: Document Raster Effects Settings... again...
                            Wayne Constable-AEjbzi Community Member

                            I most definitely agree about the dictionary dump tool.  For such a potentially powerful feature, it deserves a sample in the SDK and its documentation vastly improved.

                             

                            Hopefully I'll get a little time to throw together a similar tool to yours, I'll be sure to post it up here if when I finish it!  I can see it being very handy.

                             

                            Thanks again