3. Where are we?
spTree
nvGrpSpPr grpSpPr sp
nvSpPr spPr
style txBody
xfrm geo
fillProperties lineProperties
effectProperties scene3D
sp3D bwMode
4. Transform “Variables”
• Shapes
– Offset X
– Offset Y
– Extents X
– Extents Y
• Group Shapes
– Offset X
– Offset Y
– Extents X
– Extents Y
– Child Offset X
– Child Offset Y
– Child Extents X
– Child Extents Y
5. Coordinate Space
( 0,0 )
X-Axis
Y-Axis
2D Units measures in EMUs ( 914400 EMUs per inch )
7. Group Transform “Variables”
( 0,0 )
Offset X == Ch Offset X
Offset Y == Ch Offset Y
Extent Y == Ch Extent Y
Extent X == Ch Extent X
8. Lesson #1
• When a group is created the group’s offset
and extents are equal to the children’s
offset and extents.
Offset_X == ChOffset_X
Offset_Y == ChOffset_Y
Extent_X == Extent_X
Extent_Y == Extent_Y
9. Lesson #2
• Effect Bounds do not relate to extent
variables for shapes or groups
( 0,0 )
Offset X == Ch Offset X
Offset Y == Ch Offset Y
Extent Y == Ch Extent Y
Extent X == Ch Extent X
10. Case 1
Scenario: A slide contains two shapes, a block arrow and a triangle.
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset
Extent
Offset
Extent
Child Shapes
BeforeAfter
11. Case 2
Scenario: Given Case 1, move the block arrow to the right
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 2673 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
12. Case 3
Scenario: Given Case 1, resize block arrow to 150% ( towards the BR of the slide )
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 1467 726
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
13. Case 4
Scenario: Given Case 1, rotate the block arrow 90 degrees, clockwise
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
Rotation = 5,400,000
14. Lesson #3
• Rotation does not change the offset or
extents of the target shape
– But it might change the offset or extents of a
containing shape
– “Resolved” at rendering time
15. Case 5
Scenario: Given Case 1, group both shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
16. The Details
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
Explanation
First determine the offset for the group:
Offset_X = Min ( Offset_X, Offset_X )
= Min ( 914, 3657 )
= 914
Offset_Y = Min ( Offset_Y, Offset_Y )
= Min ( 1524, 3449 )
= 1524
Next determine the extent of the group:
Extent_X = Max ( ( Offset_X + Extent_X - Offset_X ) ,
( Offset_X + Extent_X - Offset_X ) )
= Max ( 978, 3803 )
= 3803
Extent_Y = Max ( ( Offset_Y + Extent_Y - Offset_Y ) ,
( Offset_Y + Extent_Y - Offset_Y ) )
= Max ( 484, 2839 )
= 2839
And based on Lesson #1, the children values are the same …
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
Descrepancies between the table and details are due to rounding errors
17. Case 6
Scenario: Given Case 5, move the group to the right
X Y
Offset 4197 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
18. The Details
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
Explanation
Because the entire group was moved to the right ( along the X-axis ) the Offset_X
value of the group was the only variable that changed.
X Y
Offset 4197 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
Descrepancies between the table and details are due to rounding errors
19. Case 7
Scenario: Given Case 5, resize the group to 50% ( towards the TL of the slide )
X Y
Offset 914 1524
Extent 1919 1413
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
20. The Details
Explanation
Because we have scaled the group down by approximately 50% and we have not
moved it, we are only modifying the group shape extents. The modification, not
surprisingly, is ( approximately ) 50%.
Extent_X = Extent_X * .50
= 3803 * .5
= 1901
Extent_Y = Extent_Y * .50
= 2840 * .5
= 1420
X Y
Offset 914 1524
Extent 1919 1413
ChOffset 914 1524
ChExtent 3803 2840
Group Shape ( new )
Descrepancies between the table and details are due to rounding errors
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape ( old )
21. Case 8
Scenario: Given Case 5, rotate the group shape 90 degrees, clockwise
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
Rotation = 5,400,000
22. Case 9
Scenario: Given Case 5, rotate the block arrow 90 degrees, clockwise
X Y
Offset 1161 1277
Extent 3557 3087
ChOffset 1161 1277
ChExtent 3557 3087
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
Rotation = 5,400,000
23. The Details
Explanation
Since the block arrow ( a child shape ) was rotated, first a rotation value is applied to
that spPr.
As a result of the application of rotation on the block arrow, the bounding box of the
block arrow changes; this change ripples into the dimension of the group.
Leaving the calculation of the new bounding for the block arrow as an exercise for the
reader, a quick survey illustrates the general change. Observe:
X Y
Offset 1161 1277
Extent 3557 3087
ChOffset 1161 1277
ChExtent 3557 3087
Group Shape ( new )
Descrepancies between the table and details are due to rounding errors
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape ( old )
• The block arrow’s bounding box ( looking at the resultant picture ) is farther
along the X-axis. Note the group shape’s X-offset is 247 units longer.
• Because the X-Offset is longer, and the triangle has not moved, the group
shape’s X-extent is shorter … by 247 units.
• Since rotation occurs against the center of the selection, the top of the block
arrow’s bounding box is a shorter distance from the Y-axis. Note the group
shape’s Y-offset is 247 units shorter.
• Because the Y-Offset is shorter, and the triangle has not moved, the group
shape’s Y-extent is longer … by 247 units.
This is much easier to follow with matrix math, but I didn’t want to force this on
folks …
25. Case 10
Scenario: Given Case 5, move the triangle to the right
X Y
Offset 914 1524
Extent 5618 2840
ChOffset 914 1524
ChExtent 5618 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 5472 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
26. The Details
X Y
Offset 914 1524
Extent 978 484
Offset 5472 3449
Extent 1060 914
Child Shapes
Explanation
Since we moved just the triangle shape along the X-axis, the triangle’s spPr gets an
updated Offset_X. Then we must recompute the group shape transform:
First determine the offset for the group:
Offset_X = Min ( Offset_X, Offset_X )
= Min ( 914, 5472 )
= 914
Offset_Y = Min ( Offset_Y, Offset_Y )
= Min ( 1524, 3449 )
= 1524
Next determine the extent of the group:
Extent_X = Max ( ( Offset_X + Extent_X - Offset_X ) ,
( Offset_X + Extent_X - Offset_X ) )
= Max ( 5472 , 5618 )
= 5618
Extent_Y = Max ( ( Offset_Y + Extent_Y - Offset_Y ) ,
( Offset_Y + Extent_Y - Offset_Y ) )
= Max ( 484, 2839 )
= 2839
And based on Lesson #1, the children values are the same …
X Y
Offset 914 1524
Extent 5618 2840
ChOffset 914 1524
ChExtent 5618 2840
Group Shape
Descrepancies between the table and details are due to rounding errors
27. Case 11
Scenario: Given Case 5, ungroup
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
28. Case 12
Scenario: Given Case 6, ungroup
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 4197 1524
Extent 978 484
Offset 6941 3449
Extent 1060 914
Child Shapes
X Y
Offset 4197 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
29. The Details
X Y
Offset 4197 1524
Extent 3803 2840
Offset 914 1524
Extent 3803 2840
Child Shapes ( Old )
Explanation
Since the group was moved along the X-axis, we need to determine new X-axis values
for the child shapes. The child shapes still have their original offset and extent values.
Offset_X = G Offset_X – G chOffset_X + Offset_X
= 4197 – 914 + 914
= 4197
Offset_Y = G Offset_Y – G chOffset_Y + Offset_Y
= 1524 – 1524 + 1524
= 1524
Offset_X = G Offset_X – G chOffset_X + Offset_X
= 4197 – 914 + 3657
= 6940
Offset_Y = G Offset_Y – G chOffset_Y + Offset_Y
= 1524 – 1524 + 3449
= 3449
X Y
Offset 4197 1524
Extent 978 484
Offset 6941 3449
Extent 1060 914
Child Shape ( New)
Discrepancies between the table and details are due to rounding errors
30. Case 13
Scenario: Given Case 7, ungroup
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 493 241
Offset 2298 2482
Extent 535 454
Child Shapes
X Y
Offset 914 1524
Extent 1919 1413
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
31. The Details
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes ( Old )
Explanation
Since the group shape was scaled down by 50% but not moved, only the block arrow’s offset values will be
unchanged.
To determine the two shape’s extents, we simply apply the scaling factor:
Extent_X = Extent_X * .5 Extent_Y = Extent_Y * .5
= 978 * .5 = 484 * .5
= 489 = 242
Extent_X = Extent_X *.5 Extent_Y = Extent_Y *.5
= 1060 * .5 = 914 * .5
= 535 = 457
X Y
Offset 914 1524
Extent 493 241
Offset 2298 2482
Extent 535 454
Child Shape ( New)
Discrepancies between the table and details are due to rounding errors
To determine the offsets, we need to scale the values by the ratio of the group shape’s extent values. We
first translate to zero, apply the scale, and then translate back.
Offset_X = ( Offset_X – G chOff_X ) * ( G extent_X / G chEnt_X ) + G Offset_X
= ( 914 – 914 ) * ( 1919 / 3803 ) + 914
= 914
Offset_Y = ( Offset_Y – G chOff_Y ) * ( G extent_Y / G chEnt_Y ) + G Offset_Y
= ( 1524 – 1524 ) ( 1413 / 2840 ) + 1524
= 1524
Offset_X = ( Offset_X – G chOff_X ) * ( G extent_X / G chEnt_X ) + G Offset_X
= ( 3657 – 914 ) * ( 1919 / 3803 ) + 914
= 2285
Offset_Y = ( Offset_Y – G chOff_Y ) * ( G extent_Y / G chEnt_Y ) + G Offset_Y
= ( 3449 – 1524 ) ( 1413 / 2840 ) + 1524
= 2487
32. Lesson #5
• Scaling is always done using the ratio of
the group extents to the group children
extents ( even for calculating offsets )
33. Case 14
Scenario: Given Case 8, ungroup
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 3504 1289
Extent 978 484
Offset 1323 3858
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 3803 2840
ChOffset 914 1524
ChExtent 3803 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
Rotation = 5,400,000
34. Case 15
Scenario: Given Case 9, ungroup
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
X Y
Offset 1161 1277
Extent 3557 3087
ChOffset 1161 1277
ChExtent 3557 3087
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 3657 3449
Extent 1060 914
Child Shapes
BeforeAfter
Rotation = 5,400,000
Rotation = 5,400,000
35. Case 16
Scenario: Given Case 10, ungroup
X Y
Offset
Extent
ChOffset
ChExtent
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 5472 3449
Extent 1060 914
Child Shapes
X Y
Offset 914 1524
Extent 5618 2840
ChOffset 914 1524
ChExtent 5618 2840
Group Shape
X Y
Offset 914 1524
Extent 978 484
Offset 5472 3449
Extent 1060 914
Child Shapes
BeforeAfter
36. Disclaimer
This presentation is for informational purposes only, and
should not be relied upon as a substitute or replacement for
Microsoft formal file format documentation, which is
available at the following
website: https://msdn.microsoft.com/en-
us/library/cc313118(v=office.12).aspx. Any views or
opinions presented in this material are solely those of the
author and do not necessarily represent those of
Microsoft. Microsoft disclaims all liability for mistakes or
inaccuracies in this presentation.