本文整理汇总了C++中CFX_PathData::GetPointCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_PathData::GetPointCount方法的具体用法?C++ CFX_PathData::GetPointCount怎么用?C++ CFX_PathData::GetPointCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_PathData
的用法示例。
在下文中一共展示了CFX_PathData::GetPointCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
//.........这里部分代码省略.........
示例2: DrawThisAppearance
void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
CPDF_Rect rcClient = GetClientRect();
CFX_ByteTextBuf sLine;
int32_t nCharArray = m_pEdit->GetCharArray();
FX_SAFE_INT32 nCharArraySafe = nCharArray;
nCharArraySafe -= 1;
nCharArraySafe *= 2;
if (nCharArray > 0 && nCharArraySafe.IsValid()) {
switch (GetBorderStyle()) {
case PBS_SOLID: {
CFX_GraphStateData gsd;
gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
CFX_PathData path;
path.SetPointCount(nCharArraySafe.ValueOrDie());
for (int32_t i = 0; i < nCharArray - 1; i++) {
path.SetPoint(
i * 2,
rcClient.left +
((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
rcClient.bottom, FXPT_MOVETO);
path.SetPoint(
i * 2 + 1,
rcClient.left +
((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
rcClient.top, FXPT_LINETO);
}
if (path.GetPointCount() > 0)
pDevice->DrawPath(
&path, pUser2Device, &gsd, 0,
CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255),
FXFILL_ALTERNATE);
} break;
case PBS_DASH: {
CFX_GraphStateData gsd;
gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
gsd.SetDashCount(2);
gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash;
gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap;
gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase;
CFX_PathData path;
path.SetPointCount(nCharArraySafe.ValueOrDie());
for (int32_t i = 0; i < nCharArray - 1; i++) {
path.SetPoint(
i * 2,
rcClient.left +
((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
rcClient.bottom, FXPT_MOVETO);
path.SetPoint(
i * 2 + 1,
rcClient.left +
((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
rcClient.top, FXPT_LINETO);
}
if (path.GetPointCount() > 0)
pDevice->DrawPath(
&path, pUser2Device, &gsd, 0,
CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255),
FXFILL_ALTERNATE);
} break;
}
}
CPDF_Rect rcClip;
CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
CPVT_WordRange* pRange = NULL;
if (!HasFlag(PES_TEXTOVERFLOW)) {
rcClip = GetClientRect();
pRange = &wrRange;
}
IFX_SystemHandler* pSysHandler = GetSystemHandler();
IFX_Edit::DrawEdit(
pDevice, pUser2Device, m_pEdit,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
rcClip, CPDF_Point(0.0f, 0.0f), pRange, pSysHandler, m_pFormFiller);
if (HasFlag(PES_SPELLCHECK)) {
CPWL_Utils::DrawEditSpellCheck(pDevice, pUser2Device, m_pEdit, rcClip,
CPDF_Point(0.0f, 0.0f), pRange,
GetCreationParam().pSpellCheck);
}
}