本文整理汇总了C++中CPDF_Path::GetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Path::GetObject方法的具体用法?C++ CPDF_Path::GetObject怎么用?C++ CPDF_Path::GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Path
的用法示例。
在下文中一共展示了CPDF_Path::GetObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputPath
void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) {
const CFX_PathData* pPathData = path.GetObject();
if (!pPathData)
return;
FX_PATHPOINT* pPoints = pPathData->GetPoints();
if (path.IsRect()) {
buf << (pPoints[0].m_PointX) << " " << (pPoints[0].m_PointY) << " "
<< (pPoints[2].m_PointX - pPoints[0].m_PointX) << " "
<< (pPoints[2].m_PointY - pPoints[0].m_PointY) << " re\n";
return;
}
CFX_ByteString temp;
for (int i = 0; i < pPathData->GetPointCount(); i++) {
buf << (pPoints[i].m_PointX) << " " << (pPoints[i].m_PointY);
int point_type = pPoints[i].m_Flag & FXPT_TYPE;
if (point_type == FXPT_MOVETO) {
buf << " m\n";
} else if (point_type == FXPT_BEZIERTO) {
buf << " " << (pPoints[i + 1].m_PointX) << " "
<< (pPoints[i + 1].m_PointY) << " " << (pPoints[i + 2].m_PointX)
<< " " << (pPoints[i + 2].m_PointY);
if (pPoints[i + 2].m_Flag & FXPT_CLOSEFIGURE)
buf << " c h\n";
else
buf << " c\n";
i += 2;
} else if (point_type == FXPT_LINETO) {
if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE)
buf << " l h\n";
else
buf << " l\n";
}
}
}
示例2: OutputPath
void OutputPath(std::ostringstream& buf, CPDF_Path path) {
const CFX_PathData* pPathData = path.GetObject();
if (!pPathData)
return;
const std::vector<FX_PATHPOINT>& pPoints = pPathData->GetPoints();
if (path.IsRect()) {
CFX_PointF diff = pPoints[2].m_Point - pPoints[0].m_Point;
buf << pPoints[0].m_Point.x << " " << pPoints[0].m_Point.y << " " << diff.x
<< " " << diff.y << " re\n";
return;
}
ByteString temp;
for (size_t i = 0; i < pPoints.size(); i++) {
buf << pPoints[i].m_Point.x << " " << pPoints[i].m_Point.y;
FXPT_TYPE point_type = pPoints[i].m_Type;
if (point_type == FXPT_TYPE::MoveTo) {
buf << " m\n";
} else if (point_type == FXPT_TYPE::BezierTo) {
buf << " " << pPoints[i + 1].m_Point.x << " " << pPoints[i + 1].m_Point.y
<< " " << pPoints[i + 2].m_Point.x << " " << pPoints[i + 2].m_Point.y;
buf << " c";
if (pPoints[i + 2].m_CloseFigure)
buf << " h";
buf << "\n";
i += 2;
} else if (point_type == FXPT_TYPE::LineTo) {
buf << " l";
if (pPoints[i].m_CloseFigure)
buf << " h";
buf << "\n";
}
}
}