Sub GetSetShape(shIs As Shape, shTo As Shape)
On Error Resume Next
Dim d11 As Double, d12 As Double, d21 As Double, d22 As Double, X As Double, Y As Double, W As Double, H As Double
Dim tx As Double, ty As Double, shIsCurve As Curve, s As Shape, c As Color
If shIs.Bitmap.CropEnvelopeModified Then
Set shIsCurve = shIs.Bitmap.CropEnvelope
Set s = ActiveLayer.CreateCurve(shIsCurve)
s.Outline.width = 0
shIs.Bitmap.ResetCropEnvelope
shIs.GetPosition X, Y
shIs.GetMatrix d11, d12, d21, d22, tx, ty
shIs.GetSize W, H
ActiveDocument.Undo
shTo.SetMatrix d11, d12, d21, d22, tx, ty
shTo.SetSize W, H
shTo.SetPosition X, Y
Set sm = s.Intersect(shTo)
Set sm2 = s.Weld(sm, True, True)
s.Delete
sm.Delete
shTo.Delete
Set shTo = sm2
shTo.OrderBackOf shIs
Else
shIs.GetPosition X, Y
shIs.GetMatrix d11, d12, d21, d22, tx, ty
shIs.GetSize W, H
shTo.SetMatrix d11, d12, d21, d22, tx, ty
shTo.SetSize W, H
shTo.SetPosition X, Y
shTo.OrderBackOf shIs
End If
If shIs.Transparency.Type = cdrUniformTransparency Then
shTo.Transparency.ApplyUniformTransparency (shIs.Transparency.Uniform)
shTo.Transparency.MergeMode = shIs.Transparency.MergeMode
ElseIf shIs.Transparency.Type = cdrFountainTransparency Then
shTo.Transparency.ApplyFountainTransparency shIs.Transparency.Start, _
shIs.Transparency.End, shIs.Transparency.Fountain.Type, _
shIs.Transparency.Fountain.Angle, shIs.Transparency.Fountain.Steps, _
shIs.Transparency.Fountain.EdgePad, shIs.Transparency.Fountain.MidPoint, _
shIs.Transparency.Fountain.CenterOffsetX, shIs.Transparency.Fountain.CenterOffsetY
shTo.Transparency.MergeMode = shIs.Transparency.MergeMode
If shIs.Transparency.Fountain.Colors.Count > 0 Then
For i = 1 To shIs.Transparency.Fountain.Colors.Count
shTo.Transparency.Fountain.Colors.Add shIs.Transparency.Fountain.Colors(i).Color, shIs.Transparency.Fountain.Colors(i).Position
Next i
End If
ElseIf shIs.Transparency.Type = cdrPatternTransparency Then
shTo.Transparency.ApplyPatternTransparency shIs.Transparency.Pattern.Type, _
shIs.Transparency.Pattern.FilePath, shIs.Transparency.Pattern.Canvas.Index, _
shIs.Transparency.Start, shIs.Transparency.End, shIs.Transparency.Pattern.TransformWithShape
shTo.Transparency.MergeMode = shIs.Transparency.MergeMode
shTo.Transparency.Pattern.BackColor = shIs.Transparency.Pattern.BackColor
shTo.Transparency.Pattern.BackColor = shIs.Transparency.Pattern.BackColor
shTo.Transparency.Pattern.FrontColor = shIs.Transparency.Pattern.FrontColor
shTo.Transparency.Pattern.OriginX = shIs.Transparency.Pattern.OriginX
shTo.Transparency.Pattern.OriginY = shIs.Transparency.Pattern.OriginY
shTo.Transparency.Pattern.RotationAngle = shIs.Transparency.Pattern.RotationAngle
shTo.Transparency.Pattern.SkewAngle = shIs.Transparency.Pattern.SkewAngle
shTo.Transparency.Pattern.MirrorFill = shIs.Transparency.Pattern.MirrorFill
shTo.Transparency.Pattern.TileHeight = shIs.Transparency.Pattern.TileHeight
shTo.Transparency.Pattern.TileWidth = shIs.Transparency.Pattern.TileWidth
shTo.Transparency.Pattern.TransformWithShape = shIs.Transparency.Pattern.TransformWithShape
shTo.Transparency.Pattern.TileOffsetType = shIs.Transparency.Pattern.TileOffsetType
shTo.Transparency.Pattern.TileOffset = shIs.Transparency.Pattern.TileOffset
shTo.Transparency.Pattern = shIs.Transparency.Pattern
ElseIf shIs.Transparency.Type = cdrTextureTransparency Then
shTo.Transparency.ApplyTextureTransparency shIs.Transparency.Texture.TextureName, _
shIs.Transparency.Texture.LibraryName, shIs.Transparency.Start, shIs.Transparency.End
shTo.Transparency.MergeMode = shIs.Transparency.MergeMode
End If
If shIs.Effects.Count <> 0 Then
If shIs.Effects.DropShadowEffect.DropShadow.Type = cdrDropShadowFlat Then
If shIs.Effects.DropShadowEffect.DropShadow.FeatherType = cdrFeatherAverage Then
Set efDrop = shTo.CreateDropShadow(shIs.Effects.DropShadowEffect.DropShadow.Type, _
shIs.Effects.DropShadowEffect.DropShadow.Opacity, shIs.Effects.DropShadowEffect.DropShadow.Feather, _
shIs.Effects.DropShadowEffect.DropShadow.OffsetX, shIs.Effects.DropShadowEffect.DropShadow.OffsetY, _
shIs.Effects.DropShadowEffect.DropShadow.Color, shIs.Effects.DropShadowEffect.DropShadow.FeatherType, _
, , , , shIs.Effects.DropShadowEffect.DropShadow.MergeMode)
Else
Set efDrop = shTo.CreateDropShadow(shIs.Effects.DropShadowEffect.DropShadow.Type, _
shIs.Effects.DropShadowEffect.DropShadow.Opacity, shIs.Effects.DropShadowEffect.DropShadow.Feather, _
shIs.Effects.DropShadowEffect.DropShadow.OffsetX, shIs.Effects.DropShadowEffect.DropShadow.OffsetY, _
shIs.Effects.DropShadowEffect.DropShadow.Color, shIs.Effects.DropShadowEffect.DropShadow.FeatherType, _
shIs.Effects.DropShadowEffect.DropShadow.FeatherEdge, , , , _
shIs.Effects.DropShadowEffect.DropShadow.MergeMode)
End If
Else
If shIs.Effects.DropShadowEffect.DropShadow.FeatherType <> cdrFeatherAverage Then
Set efDrop = shTo.CreateDropShadow(shIs.Effects.DropShadowEffect.DropShadow.Type, _
shIs.Effects.DropShadowEffect.DropShadow.Opacity, shIs.Effects.DropShadowEffect.DropShadow.Feather, , , _
shIs.Effects.DropShadowEffect.DropShadow.Color, shIs.Effects.DropShadowEffect.DropShadow.FeatherType, _
shIs.Effects.DropShadowEffect.DropShadow.FeatherEdge, shIs.Effects.DropShadowEffect.DropShadow.PerspectiveAngle, _
shIs.Effects.DropShadowEffect.DropShadow.PerspectiveStretch, shIs.Effects.DropShadowEffect.DropShadow.Fade, _
shIs.Effects.DropShadowEffect.DropShadow.MergeMode)
Else
Set efDrop = shTo.CreateDropShadow(shIs.Effects.DropShadowEffect.DropShadow.Type, _
shIs.Effects.DropShadowEffect.DropShadow.Opacity, shIs.Effects.DropShadowEffect.DropShadow.Feather, , , _
shIs.Effects.DropShadowEffect.DropShadow.Color, shIs.Effects.DropShadowEffect.DropShadow.FeatherType, , _
shIs.Effects.DropShadowEffect.DropShadow.PerspectiveAngle, _
shIs.Effects.DropShadowEffect.DropShadow.PerspectiveStretch, shIs.Effects.DropShadowEffect.DropShadow.Fade, _
shIs.Effects.DropShadowEffect.DropShadow.MergeMode)
End If
End If
End If
End Sub