DrawRect() 공개 정적인 메소드

public static DrawRect ( Texture2D, a_Texture, int x, int y, int w, int h, Color, a_Color ) : void
a_Texture Texture2D,
x int
y int
w int
h int
a_Color Color,
리턴 void
예제 #1
0
    // draw face rectangles
    /// <summary>
    /// Draws the face rectacgles in the given texture.
    /// </summary>
    /// <param name="faces">List of faces.</param>
    /// <param name="tex">The camera shot texture</param>
    public static void DrawFaceRects(Texture2D tex, Face[] faces, Color[] faceColors)
    {
        for (int i = 0; i < faces.Length; i++)
        {
            Face  face      = faces[i];
            Color faceColor = faceColors[i % faceColors.Length];

            FaceRectangle rect = face.faceRectangle;
            CloudTexTools.DrawRect(tex, rect.left, rect.top, rect.width, rect.height, faceColor);
        }

        tex.Apply();
    }
예제 #2
0
    // draw face rectangles
    /// <summary>
    /// Draws the face rectangles in the given texture.
    /// </summary>
    /// <param name="faces">List of faces.</param>
    /// <param name="tex">Tex.</param>
    /// <param name="faceColors">List of face colors for each face</param>
    /// <param name="drawHeadPoseArrow">If true, draws arrow according to head pose of each face</param>
    public void DrawFaceRects(Texture2D tex, Face[] faces, Color[] faceColors, bool drawHeadPoseArrow)
    {
        for (int i = 0; i < faces.Length; i++)
        {
            Face  face      = faces[i];
            Color faceColor = faceColors[i % faceColors.Length];

            FaceRectangle rect = face.faceRectangle;
            CloudTexTools.DrawRect(tex, rect.left, rect.top, rect.width, rect.height, faceColor);

            if (drawHeadPoseArrow)
            {
                HeadPose headPose = face.faceAttributes.headPose;

                int cx     = rect.width / 2;
                int cy     = rect.height / 4;
                int arrowX = rect.left + cx;
                int arrowY = rect.top + (3 * cy);
                int radius = Math.Min(cx, cy);

                float x = arrowX + radius * Mathf.Sin(headPose.yaw * Mathf.Deg2Rad);
                float y = arrowY + radius * Mathf.Cos(headPose.yaw * Mathf.Deg2Rad);

                int arrowHead = radius / 4;
                if (arrowHead > 15)
                {
                    arrowHead = 15;
                }
                if (arrowHead < 8)
                {
                    arrowHead = 8;
                }

                CloudTexTools.DrawArrow(tex, arrowX, arrowY, (int)x, (int)y, faceColor, arrowHead, 30);
            }
        }

        tex.Apply();
    }