/// <summary> /// Converts a point on the passed in UIElement to the corresponding /// texture coordinate for that point. The function assumes (0, 0) /// is the upper-left texture coordinate and (1,1) is the lower-right. /// </summary> /// <param name="pt">The 2D point on the passed in UIElement to convert</param> /// <param name="visual">The UIElement whose coordinate system is being used</param> /// <returns> /// The texture coordinate corresponding to the 2D point on the passed in UIElement /// </returns> internal static Point VisualCoordsToTextureCoords(Point pt, Visual visual) { return VisualCoordsToTextureCoords(pt, visual.CalculateSubgraphRenderBoundsOuterSpace()); }
/// <summary> /// Converts a point given in texture coordinates to the corresponding /// 2D point on the UIElement passed in. /// </summary> /// <param name="uv">The texture coordinate to convert</param> /// <param name="visual">The UIElement whose coordinate system is to be used</param> /// <returns> /// The 2D point on the passed in UIElement cooresponding to the /// passed in texture coordinate. /// </returns> internal static Point TextureCoordsToVisualCoords(Point uv, Visual visual) { return TextureCoordsToVisualCoords(uv, visual.CalculateSubgraphRenderBoundsOuterSpace()); }