Article View: adobe.indesign.sdk
Article #130Determine Image Position within it's containing graphic frame.
From: Michael 2 James
Date: Wed, 04 Mar 2009 17:26
Date: Wed, 04 Mar 2009 17:26
40 lines
1900 bytes
1900 bytes
Hi,
I am trying to obtain the offset of an image item within it's containing frame. i.e. if I set the top left co-ordiante to be x:10pt , y:10pt
I need to obtain this programatically.
I have tried using Both the ITransformSuite and ITransformFacade without much luck. The values I am getting are not what I expect.
I.e.
K2Vector<PMReal> i_x; K2Vector<PMReal> i_y;
Utils<Facade::ITransformFacade>()->GetItemsTranslation( UIDList( imageRef
), Transform::InnerCoordinates(), &i_x, &i_y );
always gives me 0,0 ( as you would expect ).
Transform::ParentCoordinates()
Gives me a value but it doesn't seem to be relative to the top left of the containing image item.
The strange thing is that if I create 2 image frames and import the same image, I get different values for the positions within the parent ( even if the positions of the images within their respective frames are the same in the InDesign"Control" panel ).
But if I create a box and duplicate it and then import the images, I get the same values for the offsets ( although they are still not what I expect ).
This difference seems to be related to the original position a box is drawn with on the spread.
Ultimately, I would like to obtain the scale, rotation, skew and offset of an image and then apply those same criteria to another image ( possibly on another document ).
TIA,
Mike.
Technical Details
Message-ID:
<59b81d17.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit From: "Michael 2 James" <mike.james@oppolis.com> Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.indesign.sdk Subject: Determine Image Position within it's containing graphic frame. Message-ID: <59b81d17.-1@webcrossing.la2eafNXanI> Date: Wed, 4 Mar 2009 09:26:35 -0800 Lines: 41 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit