locked
How to make a judgment with ID2D1Geometry equal to another ID2D1Geometry ?

    Question

  • How to make a judgment with ID2D1Geometry  equal to another ID2D1Geometry ?
    Tuesday, August 14, 2012 2:47 AM

Answers

  • Depending on what you already know about the geometries you may be able to simplify this. It's fairly easy to tell if two geometries are different: are the height and width of the bounds the same? are they the same type? etc?

    It is harder to confirm that they are the same. If they don't have obvious differences then you'll need to compare the actual contents: query the specific type interface  (ID2D1RectangleGeometry, ID2D1RoundedRectangleGeometryID2D1EllipseGeometry, etc.) and check the type-specific methods to see if they match. For example, you can call GetRect on two rectangles and compare to see if those match.

    --Rob

    Thursday, August 16, 2012 1:34 AM
    Owner

All replies

  • Hello,

    Try using the following:

    ID2D1Geometry::CompareWithGeometry
    http://msdn.microsoft.com/en-us/library/windows/desktop/dd316638(v=vs.85).aspx

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, August 15, 2012 12:15 AM
    Moderator
  • think for reply 

    but CompareWithGeometry is too slowly.

    Thursday, August 16, 2012 1:23 AM
  • Depending on what you already know about the geometries you may be able to simplify this. It's fairly easy to tell if two geometries are different: are the height and width of the bounds the same? are they the same type? etc?

    It is harder to confirm that they are the same. If they don't have obvious differences then you'll need to compare the actual contents: query the specific type interface  (ID2D1RectangleGeometry, ID2D1RoundedRectangleGeometryID2D1EllipseGeometry, etc.) and check the type-specific methods to see if they match. For example, you can call GetRect on two rectangles and compare to see if those match.

    --Rob

    Thursday, August 16, 2012 1:34 AM
    Owner
  • think you Rop

    I am appreciate for your reply! if this work, I will try.as you say, It is harder to cofirm that they are the same,so I have no idea how to do it more effective!

    Friday, August 17, 2012 2:02 AM