本文整理汇总了C++中CFX_PathData::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_PathData::Append方法的具体用法?C++ CFX_PathData::Append怎么用?C++ CFX_PathData::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_PathData
的用法示例。
在下文中一共展示了CFX_PathData::Append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetZeroAreaPath
FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
CFX_AffineMatrix* pMatrix,
FX_BOOL& bThin,
FX_BOOL bAdjust) const {
if (m_PointCount < 3) {
return FALSE;
}
if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO &&
(m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO &&
(m_pPoints[2].m_Flag & FXPT_TYPE) == FXPT_LINETO &&
m_pPoints[0].m_PointX == m_pPoints[2].m_PointX &&
m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) {
NewPath.AddPointCount(2);
if (bAdjust) {
if (pMatrix) {
FX_FLOAT x = m_pPoints[0].m_PointX, y = m_pPoints[0].m_PointY;
pMatrix->TransformPoint(x, y);
x = (int)x + 0.5f;
y = (int)y + 0.5f;
NewPath.SetPoint(0, x, y, FXPT_MOVETO);
x = m_pPoints[1].m_PointX, y = m_pPoints[1].m_PointY;
pMatrix->TransformPoint(x, y);
x = (int)x + 0.5f;
y = (int)y + 0.5f;
NewPath.SetPoint(1, x, y, FXPT_LINETO);
pMatrix->SetIdentity();
} else {
FX_FLOAT x = (int)m_pPoints[0].m_PointX + 0.5f,
y = (int)m_pPoints[0].m_PointY + 0.5f;
NewPath.SetPoint(0, x, y, FXPT_MOVETO);
x = (int)m_pPoints[1].m_PointX + 0.5f,
y = (int)m_pPoints[1].m_PointY + 0.5f;
NewPath.SetPoint(1, x, y, FXPT_LINETO);
}
} else {
NewPath.SetPoint(0, m_pPoints[0].m_PointX, m_pPoints[0].m_PointY,
FXPT_MOVETO);
NewPath.SetPoint(1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY,
FXPT_LINETO);
}
if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX &&
m_pPoints[0].m_PointY != m_pPoints[1].m_PointY) {
bThin = TRUE;
}
return TRUE;
}
if (((m_PointCount > 3) && (m_PointCount % 2))) {
int mid = m_PointCount / 2;
FX_BOOL bZeroArea = FALSE;
CFX_PathData t_path;
for (int i = 0; i < mid; i++) {
if (!(m_pPoints[mid - i - 1].m_PointX ==
m_pPoints[mid + i + 1].m_PointX &&
m_pPoints[mid - i - 1].m_PointY ==
m_pPoints[mid + i + 1].m_PointY &&
((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO &&
(m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) {
bZeroArea = TRUE;
break;
}
int new_count = t_path.GetPointCount();
t_path.AddPointCount(2);
t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX,
m_pPoints[mid - i].m_PointY, FXPT_MOVETO);
t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX,
m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO);
}
if (!bZeroArea) {
NewPath.Append(&t_path, NULL);
bThin = TRUE;
return TRUE;
}
}
int stratPoint = 0;
int next = 0, i;
for (i = 0; i < m_PointCount; i++) {
int point_type = m_pPoints[i].m_Flag & FXPT_TYPE;
if (point_type == FXPT_MOVETO) {
stratPoint = i;
} else if (point_type == FXPT_LINETO) {
next = (i + 1 - stratPoint) % (m_PointCount - stratPoint) + stratPoint;
if ((m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO &&
(m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_MOVETO) {
if ((m_pPoints[i - 1].m_PointX == m_pPoints[i].m_PointX &&
m_pPoints[i].m_PointX == m_pPoints[next].m_PointX) &&
((m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY) *
(m_pPoints[i].m_PointY - m_pPoints[next].m_PointY) >
0)) {
int pre = i;
if (FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY) <
FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[next].m_PointY)) {
pre--;
next--;
}
int new_count = NewPath.GetPointCount();
NewPath.AddPointCount(2);
NewPath.SetPoint(new_count, m_pPoints[pre].m_PointX,
m_pPoints[pre].m_PointY, FXPT_MOVETO);
NewPath.SetPoint(new_count + 1, m_pPoints[next].m_PointX,
m_pPoints[next].m_PointY, FXPT_LINETO);
//.........这里部分代码省略.........