Hoops 的使用

Hoops  的 Segment 的层次是一个树状的结构

"." 指当前打开的段

 

计算文字大小和坐标系转换的代码如下:

 

HC_KEY key = m_pHView->GetModelKey(); float xfrac,yfrac; const char* testSegment = "text"; HC_Open_Segment_By_Key(key); HC_Create_Segment(testSegment); //HC_Compute_Text_Extent (testSegment, "rabbit", &xfrac, &yfrac); HC_KEY keys[3]; keys[0] = HC_KOpen_Segment(testSegment); keys[1] = m_pHView->GetIncludeLinkKey(); keys[2] = m_pHView->GetViewKey(); HC_Set_Text_Font("name = roman, size = 3.5 oru"); HC_Compute_Text_Extent_Enc_Path(3, keys, "mbs", "rabbitrabbitrabbitrabbitrabbitrabbit", &xfrac, &yfrac); //HC_Open_Segment(testSegment); HC_Close_Segment(); HC_KEY sceneKey = m_pHView->GetSceneKey(); HC_Open_Segment_By_Key(sceneKey); HPoint sPt(xfrac,yfrac,0.0); HPoint pt1; HC_Compute_Coordinates(".", "local window", &sPt, "world", &pt1);

你可能感兴趣的:(Hoops 的使用)