summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-23 09:59:05 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-23 15:26:17 +0000
commitfc54e054811510c3d7c8a9c6af6c90c3222c7029 (patch)
tree98025207bd4d1f397be489fe54c42b148cf40137
parenta0061afa12e0fec210727c9478adb8ac78c5d63c (diff)
downloadpdfium-fc54e054811510c3d7c8a9c6af6c90c3222c7029.tar.xz
Cleanup PWL_Utils.
This CL removes unused methods, moves methods to correct files and removes unused defines. Change-Id: I5087869b451e57d5325831814f0fa1c7f222cf4d Reviewed-on: https://pdfium-review.googlesource.com/2823 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--BUILD.gn3
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp45
-rw-r--r--fpdfsdk/javascript/color.cpp5
-rw-r--r--fpdfsdk/pdfwindow/PWL_ComboBox.cpp5
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp19
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp9
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.cpp69
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.cpp1867
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.h215
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.h2
-rw-r--r--fpdfsdk/pdfwindow/cpwl_color.cpp179
-rw-r--r--fpdfsdk/pdfwindow/cpwl_color.h7
-rw-r--r--fpdfsdk/pdfwindow/cpwl_pathdata.cpp16
-rw-r--r--fpdfsdk/pdfwindow/cpwl_pathdata.h30
15 files changed, 275 insertions, 2200 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 291d945093..830aa04869 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -966,9 +966,8 @@ static_library("pdfwindow") {
"fpdfsdk/pdfwindow/PWL_Utils.h",
"fpdfsdk/pdfwindow/PWL_Wnd.cpp",
"fpdfsdk/pdfwindow/PWL_Wnd.h",
+ "fpdfsdk/pdfwindow/cpwl_color.cpp",
"fpdfsdk/pdfwindow/cpwl_color.h",
- "fpdfsdk/pdfwindow/cpwl_pathdata.cpp",
- "fpdfsdk/pdfwindow/cpwl_pathdata.h",
]
configs += [ ":pdfium_core_config" ]
deps = [
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index a4506e74a6..cd86f7a0b5 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -889,11 +889,10 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
}
- CPWL_Color crBackground, crBorder;
-
+ CPWL_Color crBackground;
+ CPWL_Color crBorder;
int iColorType;
FX_FLOAT fc[4];
-
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
@@ -904,7 +903,8 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop, crRightBottom;
+ CPWL_Color crLeftTop;
+ CPWL_Color crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
@@ -914,7 +914,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
@@ -1050,8 +1050,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
font_map.SetAPType("D");
- csAP = CPWL_Utils::GetRectFillAppStream(
- rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) +
+ csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, crRightBottom,
nBorderStyle, dsBorder) +
@@ -1094,7 +1093,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
@@ -1107,7 +1106,6 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
CFX_FloatRect rcWindow = GetRotatedRect();
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
-
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1115,7 +1113,6 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
}
int32_t nStyle = 0;
-
CFX_WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
@@ -1167,8 +1164,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
}
CFX_ByteString csAP_D_ON =
- CPWL_Utils::GetRectFillAppStream(
- rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) +
+ CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, crRightBottom, nBorderStyle,
dsBorder);
@@ -1207,8 +1203,8 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop, crRightBottom;
-
+ CPWL_Color crLeftTop;
+ CPWL_Color crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::DASH:
@@ -1217,7 +1213,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
@@ -1238,7 +1234,6 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
}
int32_t nStyle = 0;
-
CFX_WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
@@ -1273,7 +1268,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
if (nStyle == PCS_CIRCLE) {
if (nBorderStyle == BorderStyle::BEVELED) {
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::SubstractColor(crBackground, 0.25f);
+ crRightBottom = crBackground - 0.25f;
} else if (nBorderStyle == BorderStyle::INSET) {
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5f);
crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75f);
@@ -1311,9 +1306,9 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CFX_ByteString csAP_D_ON;
if (nStyle == PCS_CIRCLE) {
- CPWL_Color crBK = CPWL_Utils::SubstractColor(crBackground, 0.25f);
+ CPWL_Color crBK = crBackground - 0.25f;
if (nBorderStyle == BorderStyle::BEVELED) {
- crLeftTop = CPWL_Utils::SubstractColor(crBackground, 0.25f);
+ crLeftTop = crBackground - 0.25f;
crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
crBK = crBackground;
} else if (nBorderStyle == BorderStyle::INSET) {
@@ -1326,11 +1321,11 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
rcCenter, fBorderWidth, crBorder, crLeftTop, crRightBottom,
nBorderStyle, dsBorder);
} else {
- csAP_D_ON = CPWL_Utils::GetRectFillAppStream(
- rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) +
- CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
- crLeftTop, crRightBottom,
- nBorderStyle, dsBorder);
+ csAP_D_ON =
+ CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
+ CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
+ crLeftTop, crRightBottom, nBorderStyle,
+ dsBorder);
}
CFX_ByteString csAP_D_OFF = csAP_D_ON;
@@ -1707,7 +1702,7 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 4fbec5b7c4..b5ccbadabf 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -248,8 +248,7 @@ bool color::convert(CJS_Runtime* pRuntime,
}
CJS_Array aDest;
- CPWL_Color crDest = crSource;
- crDest.ConvertColorType(nColorType);
+ CPWL_Color crDest = crSource.ConvertColorType(nColorType);
ConvertPWLColorToArray(pRuntime, crDest, &aDest);
vRet = CJS_Value(pRuntime, aDest);
@@ -274,7 +273,7 @@ bool color::equal(CJS_Runtime* pRuntime,
CPWL_Color color2;
ConvertArrayToPWLColor(pRuntime, array1, &color1);
ConvertArrayToPWLColor(pRuntime, array2, &color2);
- color1.ConvertColorType(color2.nColorType);
+ color1 = color1.ConvertColorType(color2.nColorType);
vRet = CJS_Value(pRuntime, color1 == color2);
return true;
}
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
index b9e96b2bf1..bc6909a07d 100644
--- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
@@ -153,9 +153,8 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);
pDevice->DrawPath(&path, pUser2Device, nullptr,
- CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,
- GetTransparency()),
- 0, FXFILL_ALTERNATE);
+ PWL_DEFAULT_BLACKCOLOR.ToFXColor(GetTransparency()), 0,
+ FXFILL_ALTERNATE);
}
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index f96455e22d..1ba8e7d72f 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -341,10 +341,8 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
FXPT_TYPE::LineTo, false);
}
if (!path.GetPoints().empty()) {
- pDevice->DrawPath(
- &path, pUser2Device, &gsd, 0,
- CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255),
- FXFILL_ALTERNATE);
+ pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
+ GetBorderColor().ToFXColor(255), FXFILL_ALTERNATE);
}
break;
}
@@ -373,10 +371,8 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
FXPT_TYPE::LineTo, false);
}
if (!path.GetPoints().empty()) {
- pDevice->DrawPath(
- &path, pUser2Device, &gsd, 0,
- CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255),
- FXFILL_ALTERNATE);
+ pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
+ GetBorderColor().ToFXColor(255), FXFILL_ALTERNATE);
}
break;
}
@@ -394,10 +390,9 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
CFX_SystemHandler* pSysHandler = GetSystemHandler();
- CFX_Edit::DrawEdit(
- pDevice, pUser2Device, m_pEdit.get(),
- CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), rcClip,
- CFX_PointF(), pRange, pSysHandler, m_pFormFiller);
+ CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pEdit.get(),
+ GetTextColor().ToFXColor(GetTransparency()), rcClip,
+ CFX_PointF(), pRange, pSysHandler, m_pFormFiller);
}
bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index c7e8c9e97c..ed96e203fd 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -171,9 +171,8 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
- CPWL_Utils::PWLColorToFXColor(GetTextColor()),
- rcList, ptOffset, nullptr, pSysHandler,
- m_pFormFiller);
+ GetTextColor().ToFXColor(255), rcList, ptOffset,
+ nullptr, pSysHandler, m_pFormFiller);
pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);
} else {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
@@ -185,8 +184,8 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
} else {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
- CPWL_Utils::PWLColorToFXColor(GetTextColor()), rcList,
- ptOffset, nullptr, pSysHandler, nullptr);
+ GetTextColor().ToFXColor(255), rcList, ptOffset,
+ nullptr, pSysHandler, nullptr);
}
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
index 23bd753761..e3799366a5 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
@@ -241,7 +241,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
return;
CFX_PointF ptCenter = GetCenterPoint();
- int32_t nTransparancy = GetTransparency();
+ int32_t nTransparency = GetTransparency();
switch (m_eScrollBarType) {
case SBT_HSCROLL:
@@ -263,8 +263,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);
pDevice->DrawPath(&path, pUser2Device, nullptr,
- CPWL_Utils::PWLColorToFXColor(
- PWL_DEFAULT_BLACKCOLOR, nTransparancy),
+ PWL_DEFAULT_BLACKCOLOR.ToFXColor(nTransparency),
0, FXFILL_ALTERNATE);
}
} break;
@@ -284,8 +283,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);
pDevice->DrawPath(&path, pUser2Device, nullptr,
- CPWL_Utils::PWLColorToFXColor(
- PWL_DEFAULT_BLACKCOLOR, nTransparancy),
+ PWL_DEFAULT_BLACKCOLOR.ToFXColor(nTransparency),
0, FXFILL_ALTERNATE);
}
} break;
@@ -299,13 +297,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
// draw border
CFX_FloatRect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
- ArgbEncode(nTransparancy, 100, 100, 100),
+ ArgbEncode(nTransparency, 100, 100, 100),
0.0f);
// draw inner border
rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f);
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
- ArgbEncode(nTransparancy, 255, 255, 255),
+ ArgbEncode(nTransparency, 255, 255, 255),
1.0f);
// draw background
@@ -314,7 +312,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (IsEnabled())
CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw,
- nTransparancy, 80, 220);
+ nTransparency, 80, 220);
else
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
ArgbEncode(255, 255, 255, 255));
@@ -335,31 +333,31 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (IsEnabled())
CPWL_Utils::DrawFillArea(
pDevice, pUser2Device, pts, 7,
- ArgbEncode(nTransparancy, 255, 255, 255));
+ ArgbEncode(nTransparency, 255, 255, 255));
else
- CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7,
- CPWL_Utils::PWLColorToFXColor(
- PWL_DEFAULT_HEAVYGRAYCOLOR, 255));
+ CPWL_Utils::DrawFillArea(
+ pDevice, pUser2Device, pts, 7,
+ PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255));
}
} break;
case PSBT_MAX: {
// draw border
CFX_FloatRect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
- ArgbEncode(nTransparancy, 100, 100, 100),
+ ArgbEncode(nTransparency, 100, 100, 100),
0.0f);
// draw inner border
rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f);
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
- ArgbEncode(nTransparancy, 255, 255, 255),
+ ArgbEncode(nTransparency, 255, 255, 255),
1.0f);
// draw background
rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f);
if (IsEnabled())
CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw,
- nTransparancy, 80, 220);
+ nTransparency, 80, 220);
else
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
ArgbEncode(255, 255, 255, 255));
@@ -381,24 +379,24 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (IsEnabled())
CPWL_Utils::DrawFillArea(
pDevice, pUser2Device, pts, 7,
- ArgbEncode(nTransparancy, 255, 255, 255));
+ ArgbEncode(nTransparency, 255, 255, 255));
else
- CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7,
- CPWL_Utils::PWLColorToFXColor(
- PWL_DEFAULT_HEAVYGRAYCOLOR, 255));
+ CPWL_Utils::DrawFillArea(
+ pDevice, pUser2Device, pts, 7,
+ PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255));
}
} break;
case PSBT_POS: {
// draw border
CFX_FloatRect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
- ArgbEncode(nTransparancy, 100, 100, 100),
+ ArgbEncode(nTransparency, 100, 100, 100),
0.0f);
// draw inner border
rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f);
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
- ArgbEncode(nTransparancy, 255, 255, 255),
+ ArgbEncode(nTransparency, 255, 255, 255),
1.0f);
if (IsEnabled()) {
@@ -412,70 +410,70 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
ptBottom.x += 1.5f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 210, 210, 210),
+ ArgbEncode(nTransparency, 210, 210, 210),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 220, 220, 220),
+ ArgbEncode(nTransparency, 220, 220, 220),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 240, 240, 240),
+ ArgbEncode(nTransparency, 240, 240, 240),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 240, 240, 240),
+ ArgbEncode(nTransparency, 240, 240, 240),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 210, 210, 210),
+ ArgbEncode(nTransparency, 210, 210, 210),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 180, 180, 180),
+ ArgbEncode(nTransparency, 180, 180, 180),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 150, 150, 150),
+ ArgbEncode(nTransparency, 150, 150, 150),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 150, 150, 150),
+ ArgbEncode(nTransparency, 150, 150, 150),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 180, 180, 180),
+ ArgbEncode(nTransparency, 180, 180, 180),
1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
- ArgbEncode(nTransparancy, 210, 210, 210),
+ ArgbEncode(nTransparency, 210, 210, 210),
1.0f);
} else {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
@@ -485,10 +483,9 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
// draw friction
if (rectWnd.Height() > 8.0f) {
- FX_COLORREF crStroke = ArgbEncode(nTransparancy, 120, 120, 120);
+ FX_COLORREF crStroke = ArgbEncode(nTransparency, 120, 120, 120);
if (!IsEnabled())
- crStroke = CPWL_Utils::PWLColorToFXColor(
- PWL_DEFAULT_HEAVYGRAYCOLOR, 255);
+ crStroke = PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255);
FX_FLOAT nFrictionWidth = 5.0f;
FX_FLOAT nFrictionHeight = 5.5f;
@@ -743,8 +740,8 @@ bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
CPWL_Wnd::OnLButtonUp(point, nFlag);
if (HasFlag(PWS_AUTOTRANSPARENT)) {
- if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) {
- SetTransparency(PWL_SCROLLBAR_TRANSPARANCY);
+ if (GetTransparency() != PWL_SCROLLBAR_TRANSPARENCY) {
+ SetTransparency(PWL_SCROLLBAR_TRANSPARENCY);
InvalidateRect();
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index 54e75db8fe..45668b6a25 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -17,66 +17,6 @@
#include "fpdfsdk/pdfwindow/PWL_Icon.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
-CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData,
- int32_t nCount) {
- CFX_ByteTextBuf csAP;
-
- for (int32_t i = 0; i < nCount; i++) {
- switch (pPathData[i].type) {
- case PWLPT_MOVETO:
- csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " m\n";
- break;
- case PWLPT_LINETO:
- csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " l\n";
- break;
- case PWLPT_BEZIERTO:
- csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " "
- << pPathData[i + 1].point.x << " " << pPathData[i + 1].point.y
- << " " << pPathData[i + 2].point.x << " "
- << pPathData[i + 2].point.y << " c\n";
-
- i += 2;
- break;
- default:
- break;
- }
- }
-
- return csAP.MakeString();
-}
-
-void CPWL_Utils::GetPathDataFromArray(CFX_PathData& path,
- const CPWL_PathData* pPathData,
- int32_t nCount) {
- for (int32_t i = 0; i < nCount; i++) {
- switch (pPathData[i].type) {
- case PWLPT_MOVETO:
- path.AppendPoint(pPathData[i].point, FXPT_TYPE::MoveTo, false);
- break;
- case PWLPT_LINETO:
- path.AppendPoint(pPathData[i].point, FXPT_TYPE::LineTo, false);
- break;
- case PWLPT_BEZIERTO:
- path.AppendPoint(pPathData[i].point, FXPT_TYPE::BezierTo, false);
- break;
- default:
- break;
- }
- }
-}
-
-CFX_FloatRect CPWL_Utils::MaxRect(const CFX_FloatRect& rect1,
- const CFX_FloatRect& rect2) {
- CFX_FloatRect rcRet;
-
- rcRet.left = std::min(rect1.left, rect2.left);
- rcRet.bottom = std::min(rect1.bottom, rect2.bottom);
- rcRet.right = std::max(rect1.right, rect2.right);
- rcRet.top = std::max(rect1.top, rect2.top);
-
- return rcRet;
-}
-
CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect,
FX_FLOAT x,
FX_FLOAT y) {
@@ -84,28 +24,6 @@ CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect,
rect.top + y);
}
-bool CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent,
- const CFX_FloatRect& rcChild) {
- return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom &&
- rcChild.right <= rcParent.right && rcChild.top <= rcParent.top;
-}
-
-bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1,
- const CFX_FloatRect& rect2) {
- FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left;
- FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right;
- FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom;
- FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top;
-
- return left < right && bottom < top;
-}
-
-CFX_PointF CPWL_Utils::OffsetPoint(const CFX_PointF& point,
- FX_FLOAT x,
- FX_FLOAT y) {
- return CFX_PointF(point.x + x, point.y + y);
-}
-
CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2) {
CPVT_WordRange wrRet;
@@ -420,40 +338,6 @@ CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit,
return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange);
}
-CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
- IPVT_FontMap* pFontMap,
- const CFX_WideString& sText,
- int32_t nAlignmentH,
- int32_t nAlignmentV,
- FX_FLOAT fFontSize,
- bool bMultiLine,
- bool bAutoReturn,
- const CPWL_Color& crText) {
- CFX_ByteTextBuf sRet;
-
- std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
- pEdit->SetFontMap(pFontMap);
- pEdit->SetPlateRect(rcBBox);
- pEdit->SetAlignmentH(nAlignmentH, true);
- pEdit->SetAlignmentV(nAlignmentV, true);
- pEdit->SetMultiLine(bMultiLine, true);
- pEdit->SetAutoReturn(bAutoReturn, true);
- if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(true, true);
- else
- pEdit->SetFontSize(fFontSize);
-
- pEdit->Initialize();
- pEdit->SetText(sText);
-
- CFX_ByteString sEdit =
- CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f));
- if (sEdit.GetLength() > 0)
- sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
-
- return sRet.MakeString();
-}
-
CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
IPVT_FontMap* pFontMap,
CPDF_Stream* pIconStream,
@@ -915,57 +799,6 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
return sAppStream.MakeString();
}
-CPWL_Color CPWL_Utils::SubstractColor(const CPWL_Color& sColor,
- FX_FLOAT fColorSub) {
- CPWL_Color sRet;
- sRet.nColorType = sColor.nColorType;
-
- switch (sColor.nColorType) {
- case COLORTYPE_TRANSPARENT:
- sRet.nColorType = COLORTYPE_RGB;
- sRet.fColor1 = std::max(1 - fColorSub, 0.0f);
- sRet.fColor2 = std::max(1 - fColorSub, 0.0f);
- sRet.fColor3 = std::max(1 - fColorSub, 0.0f);
- break;
- case COLORTYPE_RGB:
- case COLORTYPE_GRAY:
- case COLORTYPE_CMYK:
- sRet.fColor1 = std::max(sColor.fColor1 - fColorSub, 0.0f);
- sRet.fColor2 = std::max(sColor.fColor2 - fColorSub, 0.0f);
- sRet.fColor3 = std::max(sColor.fColor3 - fColorSub, 0.0f);
- sRet.fColor4 = std::max(sColor.fColor4 - fColorSub, 0.0f);
- break;
- }
-
- return sRet;
-}
-
-CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color& sColor,
- FX_FLOAT fColorDevide) {
- CPWL_Color sRet;
- sRet.nColorType = sColor.nColorType;
-
- switch (sColor.nColorType) {
- case COLORTYPE_TRANSPARENT:
- sRet.nColorType = COLORTYPE_RGB;
- sRet.fColor1 = 1 / fColorDevide;
- sRet.fColor2 = 1 / fColorDevide;
- sRet.fColor3 = 1 / fColorDevide;
- break;
- case COLORTYPE_RGB:
- case COLORTYPE_GRAY:
- case COLORTYPE_CMYK:
- sRet = sColor;
- sRet.fColor1 /= fColorDevide;
- sRet.fColor2 /= fColorDevide;
- sRet.fColor3 /= fColorDevide;
- sRet.fColor4 /= fColorDevide;
- break;
- }
-
- return sRet;
-}
-
CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox,
const CPWL_Color& crText) {
CFX_ByteTextBuf sAP;
@@ -1101,118 +934,6 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
return sAppStream.MakeString();
}
-void CPWL_Utils::ConvertCMYK2GRAY(FX_FLOAT dC,
- FX_FLOAT dM,
- FX_FLOAT dY,
- FX_FLOAT dK,
- FX_FLOAT& dGray) {
- if (dC < 0 || dC > 1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 ||
- dK > 1)
- return;
- dGray = 1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK);
-}
-
-void CPWL_Utils::ConvertGRAY2CMYK(FX_FLOAT dGray,
- FX_FLOAT& dC,
- FX_FLOAT& dM,
- FX_FLOAT& dY,
- FX_FLOAT& dK) {
- if (dGray < 0 || dGray > 1)
- return;
- dC = 0.0f;
- dM = 0.0f;
- dY = 0.0f;
- dK = 1.0f - dGray;
-}
-
-void CPWL_Utils::ConvertGRAY2RGB(FX_FLOAT dGray,
- FX_FLOAT& dR,
- FX_FLOAT& dG,
- FX_FLOAT& dB) {
- if (dGray < 0 || dGray > 1)
- return;
- dR = dGray;
- dG = dGray;
- dB = dGray;
-}
-
-void CPWL_Utils::ConvertRGB2GRAY(FX_FLOAT dR,
- FX_FLOAT dG,
- FX_FLOAT dB,
- FX_FLOAT& dGray) {
- if (dR < 0 || dR > 1 || dG < 0 || dG > 0 || dB < 0 || dB > 1)
- return;
- dGray = 0.3f * dR + 0.59f * dG + 0.11f * dB;
-}
-
-void CPWL_Utils::ConvertCMYK2RGB(FX_FLOAT dC,
- FX_FLOAT dM,
- FX_FLOAT dY,
- FX_FLOAT dK,
- FX_FLOAT& dR,
- FX_FLOAT& dG,
- FX_FLOAT& dB) {
- if (dC < 0 || dC > 1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 ||
- dK > 1)
- return;
- dR = 1.0f - std::min(1.0f, dC + dK);
- dG = 1.0f - std::min(1.0f, dM + dK);
- dB = 1.0f - std::min(1.0f, dY + dK);
-}
-
-void CPWL_Utils::ConvertRGB2CMYK(FX_FLOAT dR,
- FX_FLOAT dG,
- FX_FLOAT dB,
- FX_FLOAT& dC,
- FX_FLOAT& dM,
- FX_FLOAT& dY,
- FX_FLOAT& dK) {
- if (dR < 0 || dR > 1 || dG < 0 || dG > 1 || dB < 0 || dB > 1)
- return;
-
- dC = 1.0f - dR;
- dM = 1.0f - dG;
- dY = 1.0f - dB;
- dK = std::min(dC, std::min(dM, dY));
-}
-
-void CPWL_Utils::PWLColorToARGB(const CPWL_Color& color,
- int32_t& alpha,
- FX_FLOAT& red,
- FX_FLOAT& green,
- FX_FLOAT& blue) {
- switch (color.nColorType) {
- case COLORTYPE_TRANSPARENT: {
- alpha = 0;
- } break;
- case COLORTYPE_GRAY: {
- ConvertGRAY2RGB(color.fColor1, red, green, blue);
- } break;
- case COLORTYPE_RGB: {
- red = color.fColor1;
- green = color.fColor2;
- blue = color.fColor3;
- } break;
- case COLORTYPE_CMYK: {
- ConvertCMYK2RGB(color.fColor1, color.fColor2, color.fColor3,
- color.fColor4, red, green, blue);
- } break;
- }
-}
-
-FX_COLORREF CPWL_Utils::PWLColorToFXColor(const CPWL_Color& color,
- int32_t nTransparancy) {
- int32_t nAlpha = nTransparancy;
- FX_FLOAT dRed = 0;
- FX_FLOAT dGreen = 0;
- FX_FLOAT dBlue = 0;
-
- PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue);
-
- return ArgbEncode(nAlpha, (int32_t)(dRed * 255), (int32_t)(dGreen * 255),
- (int32_t)(dBlue * 255));
-}
-
void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
@@ -1271,9 +992,9 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
const CPWL_Color& color,
- int32_t nTransparancy) {
+ int32_t nTransparency) {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect,
- PWLColorToFXColor(color, nTransparancy));
+ color.ToFXColor(nTransparency));
}
void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
@@ -1281,7 +1002,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
bool bVertical,
bool bHorizontal,
CFX_FloatRect rect,
- int32_t nTransparancy,
+ int32_t nTransparency,
int32_t nStartGray,
int32_t nEndGray) {
FX_FLOAT fStepGray = 1.0f;
@@ -1294,7 +1015,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
CPWL_Utils::DrawStrokeLine(
pDevice, pUser2Device, CFX_PointF(rect.left, fy),
CFX_PointF(rect.right, fy),
- ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f);
+ ArgbEncode(nTransparency, nGray, nGray, nGray), 1.5f);
}
}
@@ -1306,7 +1027,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
CPWL_Utils::DrawStrokeLine(
pDevice, pUser2Device, CFX_PointF(fx, rect.bottom),
CFX_PointF(fx, rect.top),
- ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f);
+ ArgbEncode(nTransparency, nGray, nGray, nGray), 1.5f);
}
}
}
@@ -1319,7 +1040,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
BorderStyle nStyle,
- int32_t nTransparancy) {
+ int32_t nTransparency) {
FX_FLOAT fLeft = rect.left;
FX_FLOAT fRight = rect.right;
FX_FLOAT fTop = rect.top;
@@ -1336,8 +1057,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth,
fTop - fWidth);
pDevice->DrawPath(&path, pUser2Device, nullptr,
- PWLColorToFXColor(color, nTransparancy), 0,
- FXFILL_ALTERNATE);
+ color.ToFXColor(nTransparency), 0, FXFILL_ALTERNATE);
break;
}
case BorderStyle::DASH: {
@@ -1366,8 +1086,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
gsd.m_LineWidth = fWidth;
pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
- PWLColorToFXColor(color, nTransparancy),
- FXFILL_WINDING);
+ color.ToFXColor(nTransparency), FXFILL_WINDING);
break;
}
case BorderStyle::BEVELED:
@@ -1396,7 +1115,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
FXPT_TYPE::LineTo, false);
pDevice->DrawPath(&pathLT, pUser2Device, &gsd,
- PWLColorToFXColor(crLeftTop, nTransparancy), 0,
+ crLeftTop.ToFXColor(nTransparency), 0,
FXFILL_ALTERNATE);
CFX_PathData pathRB;
@@ -1420,7 +1139,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
FXPT_TYPE::LineTo, false);
pDevice->DrawPath(&pathRB, pUser2Device, &gsd,
- PWLColorToFXColor(crRightBottom, nTransparancy), 0,
+ crRightBottom.ToFXColor(nTransparency), 0,
FXFILL_ALTERNATE);
CFX_PathData path;
@@ -1430,8 +1149,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
fRight - fHalfWidth, fTop - fHalfWidth);
pDevice->DrawPath(&path, pUser2Device, &gsd,
- PWLColorToFXColor(color, nTransparancy), 0,
- FXFILL_ALTERNATE);
+ color.ToFXColor(nTransparency), 0, FXFILL_ALTERNATE);
break;
}
case BorderStyle::UNDERLINE: {
@@ -1445,1571 +1163,10 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
gsd.m_LineWidth = fWidth;
pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
- PWLColorToFXColor(color, nTransparancy),
- FXFILL_ALTERNATE);
+ color.ToFXColor(nTransparency), FXFILL_ALTERNATE);
break;
}
}
}
}
-bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) {
- switch (color.nColorType) {
- case COLORTYPE_TRANSPARENT:
- return false;
- case COLORTYPE_GRAY:
- return color.fColor1 < 0.5f;
- case COLORTYPE_RGB:
- return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f;
- case COLORTYPE_CMYK:
- return color.fColor1 + color.fColor2 + color.fColor3 + color.fColor4 >
- 2.0f;
- }
-
- return true;
-}
-
-CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) {
- CPWL_Color crRet = color;
-
- switch (color.nColorType) {
- case COLORTYPE_GRAY:
- crRet.fColor1 = 1.0f - crRet.fColor1;
- break;
- case COLORTYPE_RGB:
- crRet.fColor1 = 1.0f - crRet.fColor1;
- crRet.fColor2 = 1.0f - crRet.fColor2;
- crRet.fColor3 = 1.0f - crRet.fColor3;
- break;
- case COLORTYPE_CMYK:
- crRet.fColor1 = 1.0f - crRet.fColor1;
- crRet.fColor2 = 1.0f - crRet.fColor2;
- crRet.fColor3 = 1.0f - crRet.fColor3;
- crRet.fColor4 = 1.0f - crRet.fColor4;
- break;
- }
-
- return crRet;
-}
-
-CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType,
- const CFX_FloatRect& rect,
- const CPWL_Color& crFill,
- const CPWL_Color& crStroke) {
- CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, false);
- sAppStream += CPWL_Utils::GetColorAppStream(crFill, true);
-
- CFX_ByteString sPath;
- CFX_PathData path;
-
- switch (nType) {
- case PWL_ICONTYPE_CHECKMARK:
- GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_CIRCLE:
- GetGraphics_Circle(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_COMMENT:
- GetGraphics_Comment(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_CROSS:
- GetGraphics_Cross(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_HELP:
- GetGraphics_Help(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_INSERTTEXT:
- GetGraphics_InsertText(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_KEY:
- GetGraphics_Key(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_NEWPARAGRAPH:
- GetGraphics_NewParagraph(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_TEXTNOTE:
- GetGraphics_TextNote(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_PARAGRAPH:
- GetGraphics_Paragraph(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_RIGHTARROW:
- GetGraphics_RightArrow(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_RIGHTPOINTER:
- GetGraphics_RightPointer(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_STAR:
- GetGraphics_Star(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_UPARROW:
- GetGraphics_UpArrow(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_UPLEFTARROW:
- GetGraphics_UpLeftArrow(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_GRAPH:
- GetGraphics_Graph(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_PAPERCLIP:
- GetGraphics_Paperclip(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_ATTACHMENT:
- GetGraphics_Attachment(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_TAG:
- GetGraphics_Tag(sPath, path, rect, PWLPT_STREAM);
- break;
- case PWL_ICONTYPE_FOXIT:
- GetGraphics_Foxit(sPath, path, rect, PWLPT_STREAM);
- break;
- }
-
- sAppStream += sPath;
- if (crStroke.nColorType != COLORTYPE_TRANSPARENT)
- sAppStream += "B*\n";
- else
- sAppStream += "f*\n";
-
- return sAppStream;
-}
-
-void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- int32_t nType,
- const CFX_FloatRect& rect,
- const CPWL_Color& crFill,
- const CPWL_Color& crStroke,
- const int32_t nTransparancy) {
- CFX_GraphStateData gsd;
- gsd.m_LineWidth = 1.0f;
-
- CFX_ByteString sPath;
- CFX_PathData path;
-
- switch (nType) {
- case PWL_ICONTYPE_CHECKMARK:
- GetGraphics_Checkmark(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_CIRCLE:
- GetGraphics_Circle(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_COMMENT:
- GetGraphics_Comment(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_CROSS:
- GetGraphics_Cross(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_HELP:
- GetGraphics_Help(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_INSERTTEXT:
- GetGraphics_InsertText(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_KEY:
- GetGraphics_Key(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_NEWPARAGRAPH:
- GetGraphics_NewParagraph(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_TEXTNOTE:
- GetGraphics_TextNote(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_PARAGRAPH:
- GetGraphics_Paragraph(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_RIGHTARROW:
- GetGraphics_RightArrow(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_RIGHTPOINTER:
- GetGraphics_RightPointer(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_STAR:
- GetGraphics_Star(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_UPARROW:
- GetGraphics_UpArrow(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_UPLEFTARROW:
- GetGraphics_UpLeftArrow(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_GRAPH:
- GetGraphics_Graph(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_PAPERCLIP:
- GetGraphics_Paperclip(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_ATTACHMENT:
- GetGraphics_Attachment(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_TAG:
- GetGraphics_Tag(sPath, path, rect, PWLPT_PATHDATA);
- break;
- case PWL_ICONTYPE_FOXIT:
- GetGraphics_Foxit(sPath, path, rect, PWLPT_PATHDATA);
- break;
- default:
- return;
- }
-
- pDevice->DrawPath(
- &path, pUser2Device, &gsd, PWLColorToFXColor(crFill, nTransparancy),
- PWLColorToFXColor(crStroke, nTransparancy), FXFILL_ALTERNATE);
-}
-
-void CPWL_Utils::GetGraphics_Checkmark(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 15.0f, crBBox.bottom + fHeight * 2 / 5.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 15.0f +
- FX_BEZIER * (fWidth / 7.0f - fWidth / 15.0f),
- crBBox.bottom + fHeight * 2 / 5.0f +
- FX_BEZIER * (fHeight * 2 / 7.0f - fHeight * 2 / 5.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 4.5f +
- FX_BEZIER * (fWidth / 5.0f - fWidth / 4.5f),
- crBBox.bottom + fHeight / 16.0f +
- FX_BEZIER * (fHeight / 5.0f - fHeight / 16.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 4.5f, crBBox.bottom + fHeight / 16.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 4.5f +
- FX_BEZIER * (fWidth / 4.4f - fWidth / 4.5f),
- crBBox.bottom + fHeight / 16.0f - FX_BEZIER * fHeight / 16.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 3.0f +
- FX_BEZIER * (fWidth / 4.0f - fWidth / 3.0f),
- crBBox.bottom},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 3.0f, crBBox.bottom}, PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 3.0f +
- FX_BEZIER * fWidth * (1 / 7.0f + 2 / 15.0f),
- crBBox.bottom + FX_BEZIER * fHeight * 4 / 5.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 14 / 15.0f +
- FX_BEZIER * fWidth * (1 / 7.0f - 7 / 15.0f),
- crBBox.bottom + fHeight * 15 / 16.0f +
- FX_BEZIER * (fHeight * 4 / 5.0f - fHeight * 15 / 16.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 14 / 15.0f,
- crBBox.bottom + fHeight * 15 / 16.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 14 / 15.0f +
- FX_BEZIER * (fWidth * 7 / 15.0f - fWidth * 14 / 15.0f),
- crBBox.bottom + fHeight * 15 / 16.0f +
- FX_BEZIER * (fHeight * 8 / 7.0f - fHeight * 15 / 16.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 3.6f +
- FX_BEZIER * (fWidth / 3.4f - fWidth / 3.6f),
- crBBox.bottom + fHeight / 3.5f +
- FX_BEZIER * (fHeight / 3.5f - fHeight / 3.5f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 3.6f, crBBox.bottom + fHeight / 3.5f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 3.6f,
- crBBox.bottom + fHeight / 3.5f +
- FX_BEZIER * (fHeight / 4.0f - fHeight / 3.5f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f +
- FX_BEZIER * (fWidth / 3.5f - fWidth / 15.0f),
- crBBox.bottom + fHeight * 2 / 5.0f +
- FX_BEZIER * (fHeight * 3.5f / 5.0f - fHeight * 2 / 5.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f, crBBox.bottom + fHeight * 2 / 5.0f},
- PWLPT_BEZIERTO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Circle(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 15.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 15.0f,
- crBBox.bottom + fHeight / 2.0f +
- FX_BEZIER * (fHeight * 14 / 15.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f -
- FX_BEZIER * (fWidth / 2.0f - fWidth / 15.0f),
- crBBox.top - fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f +
- FX_BEZIER * (fWidth * 14 / 15.0f - fWidth / 2.0f),
- crBBox.top - fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15.0f,
- crBBox.bottom + fHeight / 2.0f +
- FX_BEZIER * (fHeight * 14 / 15.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15.0f,
- crBBox.bottom + fHeight / 2.0f -
- FX_BEZIER * (fHeight / 2.0f - fHeight / 15.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f +
- FX_BEZIER * (fWidth * 14 / 15.0f - fWidth / 2.0f),
- crBBox.bottom + fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f -
- FX_BEZIER * (fWidth / 2.0f - fWidth / 15.0f),
- crBBox.bottom + fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f,
- crBBox.bottom + fHeight / 2.0f -
- FX_BEZIER * (fHeight / 2.0f - fHeight / 15.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 3 / 15.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 3 / 15.0f,
- crBBox.bottom + fHeight / 2.0f +
- FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f -
- FX_BEZIER * (fWidth / 2.0f - fWidth * 3 / 15.0f),
- crBBox.top - fHeight * 3 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight * 3 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f +
- FX_BEZIER * (fWidth * 4 / 5.0f - fWidth / 2.0f),
- crBBox.top - fHeight * 3 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 3 / 15.0f,
- crBBox.bottom + fHeight / 2.0f +
- FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 3 / 15.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 3 / 15.0f,
- crBBox.bottom + fHeight / 2.0f -
- FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f +
- FX_BEZIER * (fWidth * 4 / 5.0f - fWidth / 2.0f),
- crBBox.bottom + fHeight * 3 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.bottom + fHeight * 3 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f -
- FX_BEZIER * (fWidth * 4 / 5.0f - fWidth / 2.0f),
- crBBox.bottom + fHeight * 3 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 3 / 15.0f,
- crBBox.bottom + fHeight / 2.0f -
- FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 3 / 15.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_BEZIERTO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Comment(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 15.0f, crBBox.top - fHeight / 6.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 15.0f,
- crBBox.top - fHeight / 6.0f +
- FX_BEZIER * (fHeight / 6.0f - fHeight / 10.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 2 / 15.0f - FX_BEZIER * fWidth / 15.0f,
- crBBox.top - fHeight / 10.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 2 / 15.0f, crBBox.top - fHeight / 10.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 2 / 15.0f, crBBox.top - fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 2 / 15.0f + FX_BEZIER * fWidth / 15.0f,
- crBBox.top - fHeight / 10.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15.0f,
- crBBox.top - fHeight / 6 +
- FX_BEZIER * (fHeight / 6.0f - fHeight / 10.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15.0f, crBBox.top - fHeight / 6.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15.0f, crBBox.bottom + fHeight / 3.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 15.0f,
- crBBox.bottom + fHeight * 4 / 15.0f + FX_BEZIER * fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 2 / 15.0f + FX_BEZIER * fWidth / 15.0f,
- crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 2 / 15.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 5 / 15.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 5 / 15.0f,
- crBBox.bottom + fHeight * 2 / 15 + FX_BEZIER * fHeight * 2 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 5 / 15.0f - FX_BEZIER * fWidth * 2 / 15.0f,
- crBBox.bottom + fHeight * 2 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 6 / 30.0f, crBBox.bottom + fHeight * 2 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 7 / 30.0f + FX_BEZIER * fWidth / 30.0f,
- crBBox.bottom + fHeight * 2 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 7 / 30.0f,
- crBBox.bottom + fHeight * 2 / 15.0f + FX_BEZIER * fHeight * 2 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 7 / 30.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 2 / 15.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 2 / 15.0f - FX_BEZIER * fWidth / 15.0f,
- crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f,
- crBBox.bottom + fHeight / 3.0f - FX_BEZIER * fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f, crBBox.bottom + fHeight / 3.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 15.0f, crBBox.top - fHeight / 6.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 2 / 15.0f, crBBox.top - fHeight * 8 / 30.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 2 / 15.0f, crBBox.top - fHeight * 8 / 30.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 2 / 15, crBBox.top - fHeight * 25 / 60.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 2 / 15.0f, crBBox.top - fHeight * 25 / 60.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 2 / 15.0f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 4 / 15.0f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
- CFX_PointF center_point(crBBox.left + fWidth / 2,
- crBBox.bottom + fHeight / 2);
-
- CPWL_PathData PathArray[] = {
- {{center_point.x, center_point.y + fHeight / 10.0f}, PWLPT_MOVETO},
- {{center_point.x + fWidth * 0.3f,
- center_point.y + fHeight / 10.0f + fWidth * 0.3f},
- PWLPT_LINETO},
- {{center_point.x + fWidth / 10.0f + fWidth * 0.3f,
- center_point.y + fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x + fWidth / 10.0f, center_point.y}, PWLPT_LINETO},
- {{center_point.x + fWidth / 10.0f + fWidth * 0.3f,
- center_point.y - fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x + fWidth * 0.3f,
- center_point.y - fHeight / 10.0f - fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x, center_point.y - fHeight / 10.0f}, PWLPT_LINETO},
- {{center_point.x - fWidth * 0.3f,
- center_point.y - fHeight / 10 - fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x - fWidth / 10.0f - fWidth * 0.3f,
- center_point.y - fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x - fWidth / 10, center_point.y}, PWLPT_LINETO},
- {{center_point.x - fWidth / 10 - fWidth * 0.3f,
- center_point.y + fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x - fWidth * 0.3f,
- center_point.y + fHeight / 10.0f + fHeight * 0.3f},
- PWLPT_LINETO},
- {{center_point.x, center_point.y + fHeight / 10.0f}, PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 60.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 60.0f,
- crBBox.bottom + fHeight / 2.0f +
- FX_BEZIER * (fHeight / 60.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f -
- FX_BEZIER * (fWidth / 2.0f - fWidth / 60.0f),
- crBBox.bottom + fHeight / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.bottom + fHeight / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f + FX_BEZIER * fWidth * 29 / 60.0f,
- crBBox.bottom + fHeight / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 60.0f,
- crBBox.bottom + fHeight / 2.0f +
- FX_BEZIER * (fHeight / 60.0f - fHeight / 2.0f)},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 60.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 60.0f,
- crBBox.bottom + fHeight / 2.0f + FX_BEZIER * fHeight * 29 / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f + FX_BEZIER * fWidth * 29 / 60.0f,
- crBBox.top - fHeight / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f - FX_BEZIER * fWidth * 29 / 60.0f,
- crBBox.top - fHeight / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 60.0f,
- crBBox.bottom + fHeight / 2.0f + FX_BEZIER * fHeight * 29 / 60.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 60.0f, crBBox.bottom + fHeight / 2.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.27f, crBBox.top - fHeight * 0.36f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.27f,
- crBBox.top - fHeight * 0.36f + FX_BEZIER * fHeight * 0.23f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.5f - FX_BEZIER * fWidth * 0.23f,
- crBBox.bottom + fHeight * 0.87f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.5f, crBBox.bottom + fHeight * 0.87f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.5f + FX_BEZIER * fWidth * 0.23f,
- crBBox.bottom + fHeight * 0.87f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.27f,
- crBBox.top - fHeight * 0.36f + FX_BEZIER * fHeight * 0.23f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.27f, crBBox.top - fHeight * 0.36f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.27f - fWidth * 0.08f * 0.2f,
- crBBox.top - fHeight * 0.36f - fHeight * 0.15f * 0.7f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.35f + fWidth * 0.08f * 0.2f,
- crBBox.top - fHeight * 0.51f + fHeight * 0.15f * 0.2f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.35f, crBBox.top - fHeight * 0.51f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.35f - fWidth * 0.1f * 0.5f,
- crBBox.top - fHeight * 0.51f - fHeight * 0.15f * 0.3f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.45f - fWidth * 0.1f * 0.5f,
- crBBox.top - fHeight * 0.68f + fHeight * 0.15f * 0.5f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.45f, crBBox.top - fHeight * 0.68f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.45f, crBBox.bottom + fHeight * 0.30f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 0.45f,
- crBBox.bottom + fHeight * 0.30f - fWidth * 0.1f * 0.7f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.55f,
- crBBox.bottom + fHeight * 0.30f - fWidth * 0.1f * 0.7f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.55f, crBBox.bottom + fHeight * 0.30f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.55f, crBBox.top - fHeight * 0.66f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 0.55f - fWidth * 0.1f * 0.05f,
- crBBox.top - fHeight * 0.66f + fHeight * 0.18f * 0.5f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.45f - fWidth * 0.1f * 0.05f,
- crBBox.top - fHeight * 0.48f - fHeight * 0.18f * 0.3f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.45f, crBBox.top - fHeight * 0.48f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.45f + fWidth * 0.08f * 0.2f,
- crBBox.top - fHeight * 0.48f + fHeight * 0.18f * 0.2f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.37f - fWidth * 0.08f * 0.2f,
- crBBox.top - fHeight * 0.36f - fHeight * 0.18f * 0.7f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.37f, crBBox.top - fHeight * 0.36f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.37f,
- crBBox.top - fHeight * 0.36f + FX_BEZIER * fHeight * 0.13f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.5f + FX_BEZIER * fWidth * 0.13f,
- crBBox.bottom + fHeight * 0.77f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.5f, crBBox.bottom + fHeight * 0.77f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.5f - FX_BEZIER * fWidth * 0.13f,
- crBBox.bottom + fHeight * 0.77f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.37f,
- crBBox.top - fHeight * 0.36f + FX_BEZIER * fHeight * 0.13f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.37f, crBBox.top - fHeight * 0.36f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.37f,
- crBBox.top - fHeight * 0.36f - fWidth * 0.1f * 0.6f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.27f,
- crBBox.top - fHeight * 0.36f - fWidth * 0.1f * 0.6f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.27f, crBBox.top - fHeight * 0.36f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.56f, crBBox.bottom + fHeight * 0.13f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 0.56f,
- crBBox.bottom + fHeight * 0.13f + FX_BEZIER * fHeight * 0.055f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.505f - FX_BEZIER * fWidth * 0.095f,
- crBBox.bottom + fHeight * 0.185f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.505f, crBBox.bottom + fHeight * 0.185f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.505f + FX_BEZIER * fWidth * 0.065f,
- crBBox.bottom + fHeight * 0.185f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.44f,
- crBBox.bottom + fHeight * 0.13f + FX_BEZIER * fHeight * 0.055f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.44f, crBBox.bottom + fHeight * 0.13f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.44f,
- crBBox.bottom + fHeight * 0.13f - FX_BEZIER * fHeight * 0.055f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.505f + FX_BEZIER * fWidth * 0.065f,
- crBBox.bottom + fHeight * 0.075f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.505f, crBBox.bottom + fHeight * 0.075f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.505f - FX_BEZIER * fWidth * 0.065f,
- crBBox.bottom + fHeight * 0.075f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.56f,
- crBBox.bottom + fHeight * 0.13f - FX_BEZIER * fHeight * 0.055f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth * 0.56f, crBBox.bottom + fHeight * 0.13f},
- PWLPT_BEZIERTO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_InsertText(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10}, PWLPT_MOVETO},
- {{crBBox.left + fWidth / 2, crBBox.top - fHeight * 2 / 15}, PWLPT_LINETO},
- {{crBBox.right - fWidth / 10, crBBox.bottom + fHeight / 10},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
- FX_FLOAT k = -fHeight / fWidth;
- CFX_PointF tail;
- CFX_PointF CicleCenter;
- tail.x = crBBox.left + fWidth * 0.9f;
- tail.y = k * (tail.x - crBBox.right) + crBBox.bottom;
- CicleCenter.x = crBBox.left + fWidth * 0.15f;
- CicleCenter.y = k * (CicleCenter.x - crBBox.right) + crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{tail.x + fWidth / 30.0f, -fWidth / 30.0f / k + tail.y}, PWLPT_MOVETO},
- {{tail.x + fWidth / 30.0f - fWidth * 0.18f,
- -k * fWidth * 0.18f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f + fWidth * 0.07f,
- -fWidth * 0.07f / k - k * fWidth * 0.18f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 + fWidth * 0.07f,
- -fWidth * 0.07f / k - k * fWidth / 20 - k * fWidth * 0.18f -
- fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20,
- -k * fWidth / 20 - k * fWidth * 0.18f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - fWidth / 15,
- -k * fWidth / 15 - k * fWidth / 20 - k * fWidth * 0.18f -
- fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - fWidth / 15 +
- fWidth * 0.07f,
- -fWidth * 0.07f / k - k * fWidth / 15 - k * fWidth / 20 -
- k * fWidth * 0.18f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - fWidth / 15 -
- fWidth / 20 + fWidth * 0.07f,
- -fWidth * 0.07f / k + -k * fWidth / 20 + -k * fWidth / 15 -
- k * fWidth / 20 - k * fWidth * 0.18f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - fWidth / 15 -
- fWidth / 20,
- -k * fWidth / 20 + -k * fWidth / 15 - k * fWidth / 20 -
- k * fWidth * 0.18f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.45f,
- -k * fWidth * 0.45f - fWidth / 30 / k + tail.y},
- PWLPT_LINETO},
- {{tail.x + fWidth / 30 - fWidth * 0.45f + fWidth * 0.2f,
- -fWidth * 0.4f / k - k * fWidth * 0.45f - fWidth / 30 / k + tail.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x + fWidth * 0.2f, -fWidth * 0.1f / k + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x, CicleCenter.y}, PWLPT_BEZIERTO},
- {{CicleCenter.x - fWidth / 60.0f, -k * fWidth / 60 + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x - fWidth / 60, -k * fWidth / 60 + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x, CicleCenter.y}, PWLPT_BEZIERTO},
- {{CicleCenter.x - fWidth * 0.22f,
- fWidth * 0.35f / k + CicleCenter.y - fHeight * 0.05f},
- PWLPT_BEZIERTO},
- {{tail.x - fWidth / 30 - fWidth * 0.45f - fWidth * 0.18f,
- fWidth * 0.05f / k - k * fWidth * 0.45f + fWidth / 30 / k + tail.y -
- fHeight * 0.05f},
- PWLPT_BEZIERTO},
- {{tail.x - fWidth / 30.0f - fWidth * 0.45f,
- -k * fWidth * 0.45f + fWidth / 30.0f / k + tail.y},
- PWLPT_BEZIERTO},
- {{tail.x - fWidth / 30.0f, fWidth / 30.0f / k + tail.y}, PWLPT_LINETO},
- {{tail.x + fWidth / 30, -fWidth / 30 / k + tail.y}, PWLPT_LINETO},
- {{CicleCenter.x + fWidth * 0.08f, k * fWidth * 0.08f + CicleCenter.y},
- PWLPT_MOVETO},
- {{CicleCenter.x + fWidth * 0.08f + fWidth * 0.1f,
- -fWidth * 0.1f / k + k * fWidth * 0.08f + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x + fWidth * 0.22f + fWidth * 0.1f,
- k * fWidth * 0.22f + CicleCenter.y - fWidth * 0.1f / k},
- PWLPT_BEZIERTO},
- {{CicleCenter.x + fWidth * 0.22f, k * fWidth * 0.22f + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x + fWidth * 0.22f - fWidth * 0.1f,
- fWidth * 0.1f / k + k * fWidth * 0.22f + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x + fWidth * 0.08f - fWidth * 0.1f,
- fWidth * 0.1f / k + k * fWidth * 0.08f + CicleCenter.y},
- PWLPT_BEZIERTO},
- {{CicleCenter.x + fWidth * 0.08f, k * fWidth * 0.08f + CicleCenter.y},
- PWLPT_BEZIERTO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_NewParagraph(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 20.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 10.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 10.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 20.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.12f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.12f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.22f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.22f,
- crBBox.top - fHeight * 17 / 30.0f - fWidth * 0.14f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.38f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.48f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.48f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.38f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.38f, crBBox.bottom + fWidth * 0.24f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.22f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.12f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.6f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.7f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.7f,
- crBBox.bottom + fHeight / 10.0f + fHeight / 7.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.97f,
- crBBox.bottom + fHeight / 10.0f + fHeight / 7.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.97f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.7f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 17 / 30.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.6f, crBBox.bottom + fHeight / 10.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.7f,
- crBBox.bottom + fHeight / 7 + fHeight * 0.18f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.85f,
- crBBox.bottom + fHeight / 7 + fHeight * 0.18f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.85f,
- crBBox.top - fHeight * 17 / 30.0f - fHeight * 0.08f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.7f,
- crBBox.top - fHeight * 17 / 30.0f - fHeight * 0.08f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.7f,
- crBBox.bottom + fHeight / 7 + fHeight * 0.18f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_TextNote(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.right - fWidth * 3 / 10.0f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 7 / 10.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 10.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 10.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 10.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 10.0f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 3 / 10.0f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 10.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 3 / 10.0f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 3 / 10.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 10.0f, crBBox.bottom + fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 5.0f, crBBox.top - fHeight * 4 / 15.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth / 5.0f, crBBox.top - fHeight * 4 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 5.0f, crBBox.top - fHeight * 7 / 15.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth / 5.0f, crBBox.top - fHeight * 7 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 5.0f, crBBox.top - fHeight * 10 / 15.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 3 / 10.0f, crBBox.top - fHeight * 10 / 15.0f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Paragraph(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.7f, crBBox.top - fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.7f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.634f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.634f, crBBox.top - fHeight * 2 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.566f, crBBox.top - fHeight * 2 / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.566f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f,
- crBBox.top - fHeight / 15.0f - fHeight * 0.4f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.2f,
- crBBox.top - fHeight / 15.0f - fHeight * 0.4f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.2f, crBBox.top - fHeight / 15.0f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_BEZIERTO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_RightArrow(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.right - fWidth / 15.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 2.0f + fWidth / 8.0f,
- crBBox.bottom + fHeight / 5.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f, crBBox.bottom + fHeight / 5.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 15.0f - fWidth * 0.15f,
- crBBox.top - fHeight / 2.0f - fWidth / 25.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.1f,
- crBBox.top - fHeight / 2.0f - fWidth / 25.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.1f,
- crBBox.top - fHeight / 2.0f + fWidth / 25.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 15.0f - fWidth * 0.15f,
- crBBox.top - fHeight / 2.0f + fWidth / 25.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 5.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f + fWidth / 8.0f,
- crBBox.top - fHeight / 5.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 15.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_RightPointer(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.right - fWidth / 30.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth / 30.0f, crBBox.bottom + fHeight / 6.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 4 / 15.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 30.0f, crBBox.top - fHeight / 6.0f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 30.0f, crBBox.top - fHeight / 2.0f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fLongRadius =
- (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
- fLongRadius = fLongRadius * 0.7f;
- FX_FLOAT fShortRadius = fLongRadius * 0.55f;
- CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f,
- (crBBox.top + crBBox.bottom) / 2.0f);
-
- FX_FLOAT px1[5], py1[5];
- FX_FLOAT px2[5], py2[5];
-
- FX_FLOAT fAngel = FX_PI / 10.0f;
-
- for (int32_t i = 0; i < 5; i++) {
- px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel);
- py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel);
-
- fAngel += FX_PI * 2 / 5.0f;
- }
-
- fAngel = FX_PI / 5.0f + FX_PI / 10.0f;
-
- for (int32_t j = 0; j < 5; j++) {
- px2[j] = ptCenter.x + fShortRadius * (FX_FLOAT)cos(fAngel);
- py2[j] = ptCenter.y + fShortRadius * (FX_FLOAT)sin(fAngel);
-
- fAngel += FX_PI * 2 / 5.0f;
- }
-
- CPWL_PathData PathArray[11];
- PathArray[0] = {{px1[0], py1[0]}, PWLPT_MOVETO};
- PathArray[1] = {{px2[0], py2[0]}, PWLPT_LINETO};
-
- for (int32_t k = 0; k < 4; k++) {
- PathArray[(k + 1) * 2] = {{px1[k + 1], py1[k + 1]}, PWLPT_LINETO};
- PathArray[(k + 1) * 2 + 1] = {{px2[k + 1], py2[k + 1]}, PWLPT_LINETO};
- }
-
- PathArray[10] = {{px1[0], py1[0]}, PWLPT_LINETO};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_UpArrow(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth / 10.0f, crBBox.top - fWidth * 3 / 5.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.6f, crBBox.top - fWidth * 3 / 5.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.6f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.bottom + fHeight / 15.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fWidth * 3 / 5.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 10, crBBox.top - fWidth * 3 / 5.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_UpLeftArrow(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
- CFX_PointF leftup(crBBox.left, crBBox.top);
- CFX_PointF rightdown(crBBox.right, crBBox.bottom);
- FX_FLOAT k = -fHeight / fWidth;
- CFX_PointF tail;
- tail.x = crBBox.left + fWidth * 4 / 5.0f;
- tail.y = k * (tail.x - crBBox.right) + rightdown.y;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 20.0f,
- k * (crBBox.left + fWidth / 20.0f - rightdown.x) + rightdown.y},
- PWLPT_MOVETO},
- {{fHeight * 17 / 60.0f / k + tail.x + fWidth / 10.0f + fWidth / 5.0f,
- -fWidth / 5.0f / k + tail.y - fWidth / 10.0f / k +
- fHeight * 17 / 60.0f},
- PWLPT_LINETO},
- {{fHeight * 17 / 60.0f / k + tail.x + fWidth / 10.0f,
- tail.y - fWidth / 10.0f / k + fHeight * 17 / 60.0f},
- PWLPT_LINETO},
- {{tail.x + fWidth / 10.0f, tail.y - fWidth / 10.0f / k}, PWLPT_LINETO},
- {{tail.x - fWidth / 10.0f, tail.y + fWidth / 10.0f / k}, PWLPT_LINETO},
- {{fHeight * 17 / 60.0f / k + tail.x - fWidth / 10.0f,
- tail.y + fWidth / 10.0f / k + fHeight * 17 / 60.0f},
- PWLPT_LINETO},
- {{fHeight * 17 / 60.0f / k + tail.x - fWidth / 10.0f - fWidth / 5.0f,
- fWidth / 5.0f / k + tail.y + fWidth / 10.0f / k + fHeight * 17 / 60.0f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 20.0f,
- k * (crBBox.left + fWidth / 20.0f - rightdown.x) + rightdown.y},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Graph(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth * 0.05f, crBBox.top - fWidth * 0.15f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.15f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.275f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.05f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.05f, crBBox.top - fWidth * 0.15f},
- PWLPT_LINETO},
-
- {{crBBox.left + fWidth * 0.275f, crBBox.top - fWidth * 0.45f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.475f, crBBox.top - fWidth * 0.45f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.475f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.275f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.275f, crBBox.top - fWidth * 0.45f},
- PWLPT_LINETO},
-
- {{crBBox.left + fWidth * 0.5f, crBBox.top - fHeight * 0.05f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.7f, crBBox.top - fHeight * 0.05f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.7f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.5f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.5f, crBBox.top - fHeight * 0.05f},
- PWLPT_LINETO},
-
- {{crBBox.left + fWidth * 0.725f, crBBox.top - fWidth * 0.35f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.925f, crBBox.top - fWidth * 0.35f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.925f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.725f, crBBox.bottom + fHeight * 0.08f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.725f, crBBox.top - fWidth * 0.35f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth / 60, crBBox.top - fHeight * 0.25f}, PWLPT_MOVETO},
- {{crBBox.left + fWidth / 60, crBBox.bottom + fHeight * 0.25f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 60,
- crBBox.bottom + fHeight * 0.25f - fWidth * 57 / 60.0f * 0.35f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 30,
- crBBox.bottom + fHeight * 0.25f - fWidth * 57 / 60.0f * 0.35f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 30, crBBox.bottom + fHeight * 0.25f},
- PWLPT_BEZIERTO},
-
- {{crBBox.right - fWidth / 30, crBBox.top - fHeight * 0.33f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 30,
- crBBox.top - fHeight * 0.33f + fHeight / 15 * 0.5f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 30 - fWidth * 0.12f,
- crBBox.top - fHeight * 0.33f + fHeight / 15 * 0.5f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 30 - fWidth * 0.12f,
- crBBox.top - fHeight * 0.33f},
- PWLPT_BEZIERTO},
-
- {{crBBox.right - fWidth / 30 - fWidth * 0.12f,
- crBBox.bottom + fHeight * 0.2f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 30 - fWidth * 0.12f,
- crBBox.bottom + fHeight * 0.2f -
- (fWidth * 57 / 60.0f - fWidth * 0.24f) * 0.25f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 60 + fWidth * 0.12f,
- crBBox.bottom + fHeight * 0.2f -
- (fWidth * 57 / 60.0f - fWidth * 0.24f) * 0.25f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 60 + fWidth * 0.12f,
- crBBox.bottom + fHeight * 0.2f},
- PWLPT_BEZIERTO},
-
- {{crBBox.left + fWidth / 60 + fWidth * 0.12f,
- crBBox.top - fHeight * 0.2f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth / 60 + fWidth * 0.12f,
- crBBox.top - fHeight * 0.2f +
- (fWidth * 11 / 12.0f - fWidth * 0.36f) * 0.25f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15 - fWidth * 0.24f,
- crBBox.top - fHeight * 0.2f +
- (fWidth * 11 / 12.0f - fWidth * 0.36f) * 0.25f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15 - fWidth * 0.24f,
- crBBox.top - fHeight * 0.2f},
- PWLPT_BEZIERTO},
-
- {{crBBox.right - fWidth / 15 - fWidth * 0.24f,
- crBBox.bottom + fHeight * 0.25f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 15 - fWidth * 0.24f,
- crBBox.bottom + fHeight * 0.25f -
- (fWidth * 14 / 15.0f - fWidth * 0.53f) * 0.25f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.29f,
- crBBox.bottom + fHeight * 0.25f -
- (fWidth * 14 / 15.0f - fWidth * 0.53f) * 0.25f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.29f, crBBox.bottom + fHeight * 0.25f},
- PWLPT_BEZIERTO},
-
- {{crBBox.left + fWidth * 0.29f, crBBox.top - fHeight * 0.33f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.29f,
- crBBox.top - fHeight * 0.33f + fWidth * 0.12f * 0.35f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.17f,
- crBBox.top - fHeight * 0.33f + fWidth * 0.12f * 0.35f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.17f, crBBox.top - fHeight * 0.33f},
- PWLPT_BEZIERTO},
-
- {{crBBox.left + fWidth * 0.17f, crBBox.bottom + fHeight * 0.3f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.17f,
- crBBox.bottom + fHeight * 0.3f - fWidth * (14 / 15.0f - 0.29f) * 0.35f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15 - fWidth * 0.12f,
- crBBox.bottom + fHeight * 0.3f - fWidth * (14 / 15.0f - 0.29f) * 0.35f},
- PWLPT_BEZIERTO},
- {{crBBox.right - fWidth / 15 - fWidth * 0.12f,
- crBBox.bottom + fHeight * 0.3f},
- PWLPT_BEZIERTO},
-
- {{crBBox.right - fWidth / 15 - fWidth * 0.12f,
- crBBox.top - fHeight * 0.25f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth / 15 - fWidth * 0.12f,
- crBBox.top - fHeight * 0.25f + fWidth * 0.35f * (11 / 12.0f - 0.12f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 60,
- crBBox.top - fHeight * 0.25f + fWidth * 0.35f * (11 / 12.0f - 0.12f)},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth / 60, crBBox.top - fHeight * 0.25f},
- PWLPT_BEZIERTO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.1f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.23f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f,
- crBBox.top - fHeight * 0.5f + fWidth * 0.04f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.6f,
- crBBox.top - fHeight * 0.5f + fWidth * 0.04f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.5f},
- PWLPT_BEZIERTO},
-
- {{crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.23f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 0.25f, crBBox.top - fHeight * 0.1f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.1f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.23f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.23f},
- PWLPT_LINETO},
-
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.4f - fWidth * 0.25f * 0.4f,
- crBBox.top - fHeight * 0.5f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.15f,
- crBBox.top - fHeight * 0.65f + fHeight * 0.15f * 0.4f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.15f, crBBox.top - fHeight * 0.65f},
- PWLPT_BEZIERTO},
-
- {{crBBox.right - fWidth * 0.15f, crBBox.top - fHeight * 0.65f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 0.15f,
- crBBox.top - fHeight * 0.65f + fHeight * 0.15f * 0.4f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.6f + fWidth * 0.25f * 0.4f,
- crBBox.top - fHeight * 0.5f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.5f},
- PWLPT_BEZIERTO},
-
- {{crBBox.left + fWidth * 0.6f,
- crBBox.top - fHeight * 0.5f + fWidth * 0.04f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.4f,
- crBBox.top - fHeight * 0.5f + fWidth * 0.04f},
- PWLPT_BEZIERTO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f},
- PWLPT_BEZIERTO},
-
- {{crBBox.left + fWidth * 0.5f, crBBox.top - fHeight * 0.65f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.5f, crBBox.bottom + fHeight * 0.1f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Tag(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.1f},
- PWLPT_MOVETO},
- {{crBBox.left + fWidth * 0.1f, crBBox.top - fHeight * 0.5f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.3f, crBBox.bottom + fHeight * 0.1f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 0.1f, crBBox.bottom + fHeight * 0.1f},
- PWLPT_LINETO},
- {{crBBox.right - fWidth * 0.1f, crBBox.top - fHeight * 0.1f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.1f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.3f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 0.2f, crBBox.top - fHeight * 0.3f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 0.2f, crBBox.top - fHeight * 0.5f},
- PWLPT_LINETO},
- {{crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.7f},
- PWLPT_MOVETO},
- {{crBBox.right - fWidth * 0.2f, crBBox.top - fHeight * 0.7f},
- PWLPT_LINETO}};
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type) {
- FX_FLOAT fOutWidth = crBBox.right - crBBox.left;
- FX_FLOAT fOutHeight = crBBox.top - crBBox.bottom;
-
- CFX_FloatRect crInBox = crBBox;
- crInBox.left = crBBox.left + fOutWidth * 0.08f;
- crInBox.right = crBBox.right - fOutWidth * 0.08f;
- crInBox.top = crBBox.top - fOutHeight * 0.08f;
- crInBox.bottom = crBBox.bottom + fOutHeight * 0.08f;
-
- FX_FLOAT fWidth = crInBox.right - crInBox.left;
- FX_FLOAT fHeight = crInBox.top - crInBox.bottom;
-
- CPWL_PathData PathArray[] = {
- {{crInBox.left, crInBox.top}, PWLPT_MOVETO},
- {{crInBox.left + fWidth * 0.45f, crInBox.top}, PWLPT_LINETO},
- {{crInBox.left + fWidth * 0.45f,
- crInBox.top - FX_BEZIER * fHeight * 0.4f},
- PWLPT_BEZIERTO},
- {{crInBox.left + fWidth * 0.45f - FX_BEZIER * fWidth * 0.45f,
- crInBox.top - fHeight * 0.4f},
- PWLPT_BEZIERTO},
- {{crInBox.left, crInBox.top - fHeight * 0.4f}, PWLPT_BEZIERTO},
- {{crInBox.left, crInBox.top}, PWLPT_LINETO},
-
- {{crInBox.left + fWidth * 0.60f, crInBox.top}, PWLPT_MOVETO},
- {{crInBox.left + fWidth * 0.75f, crInBox.top}, PWLPT_LINETO},
- {{crInBox.left + fWidth * 0.75f,
- crInBox.top - FX_BEZIER * fHeight * 0.7f},
- PWLPT_BEZIERTO},
- {{crInBox.left + fWidth * 0.75f - FX_BEZIER * fWidth * 0.75f,
- crInBox.top - fHeight * 0.7f},
- PWLPT_BEZIERTO},
- {{crInBox.left, crInBox.top - fHeight * 0.7f}, PWLPT_BEZIERTO},
- {{crInBox.left, crInBox.top - fHeight * 0.55f}, PWLPT_LINETO},
- {{crInBox.left + FX_BEZIER * fWidth * 0.60f,
- crInBox.top - fHeight * 0.55f},
- PWLPT_BEZIERTO},
- {{crInBox.left + fWidth * 0.60f,
- crInBox.top - FX_BEZIER * fHeight * 0.55f},
- PWLPT_BEZIERTO},
- {{crInBox.left + fWidth * 0.60f, crInBox.top}, PWLPT_BEZIERTO},
-
- {{crInBox.left + fWidth * 0.90f, crInBox.top}, PWLPT_MOVETO},
- {{crInBox.left + fWidth * 0.90f,
- crInBox.top - FX_BEZIER * fHeight * 0.85f},
- PWLPT_BEZIERTO},
- {{crInBox.left + fWidth * 0.90f - FX_BEZIER * fWidth * 0.90f,
- crInBox.top - fHeight * 0.85f},
- PWLPT_BEZIERTO},
- {{crInBox.left, crInBox.top - fHeight * 0.85f}, PWLPT_BEZIERTO},
- {{crInBox.left, crInBox.bottom}, PWLPT_LINETO},
- {{crInBox.right, crInBox.bottom}, PWLPT_LINETO},
- {{crInBox.right, crInBox.top}, PWLPT_LINETO},
- {{crInBox.left + fWidth * 0.90f, crInBox.top}, PWLPT_LINETO},
- };
-
- if (type == PWLPT_STREAM)
- sPathData = GetAppStreamFromArray(PathArray, FX_ArraySize(PathArray));
- else
- GetPathDataFromArray(path, PathArray, FX_ArraySize(PathArray));
-}
-
-void CPWL_Color::ConvertColorType(int32_t nConvertColorType) {
- if (nColorType == nConvertColorType)
- return;
-
- switch (nColorType) {
- case COLORTYPE_TRANSPARENT:
- break;
- case COLORTYPE_GRAY:
- switch (nConvertColorType) {
- case COLORTYPE_RGB:
- CPWL_Utils::ConvertGRAY2RGB(fColor1, fColor1, fColor2, fColor3);
- break;
- case COLORTYPE_CMYK:
- CPWL_Utils::ConvertGRAY2CMYK(fColor1, fColor1, fColor2, fColor3,
- fColor4);
- break;
- }
- break;
- case COLORTYPE_RGB:
- switch (nConvertColorType) {
- case COLORTYPE_GRAY:
- CPWL_Utils::ConvertRGB2GRAY(fColor1, fColor2, fColor3, fColor1);
- break;
- case COLORTYPE_CMYK:
- CPWL_Utils::ConvertRGB2CMYK(fColor1, fColor2, fColor3, fColor1,
- fColor2, fColor3, fColor4);
- break;
- }
- break;
- case COLORTYPE_CMYK:
- switch (nConvertColorType) {
- case COLORTYPE_GRAY:
- CPWL_Utils::ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4,
- fColor1);
- break;
- case COLORTYPE_RGB:
- CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4,
- fColor1, fColor2, fColor3);
- break;
- }
- break;
- }
- nColorType = nConvertColorType;
-}
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h
index cbf54e6a90..a4ecc19ee5 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.h
+++ b/fpdfsdk/pdfwindow/PWL_Utils.h
@@ -9,45 +9,12 @@
#include "core/fpdfdoc/cpvt_wordrange.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
-#include "fpdfsdk/pdfwindow/cpwl_pathdata.h"
class CFX_Edit;
-class CFX_PathData;
-
struct CPWL_Color;
-#define PWL_PDF2WIN(color) (uint8_t(color * 255))
-#define PWL_WIN2PDF(color) ((FX_FLOAT)((FX_FLOAT)color / 255.0f))
-
#define PWL_MAKEDWORD(low, high) \
((uint32_t)((uint16_t)(low) | (uint32_t)(((uint16_t)(high)) << 16)))
-#define PWL_GETLOWWORD(dword) ((uint16_t)(dword))
-#define PWL_GETHIGHWORD(dword) ((uint16_t)(dword >> 16))
-
-#define PWL_ICONTYPE_CHECKMARK 0
-#define PWL_ICONTYPE_CIRCLE 1
-#define PWL_ICONTYPE_COMMENT 2
-#define PWL_ICONTYPE_CROSS 3
-#define PWL_ICONTYPE_HELP 4
-#define PWL_ICONTYPE_INSERTTEXT 5
-#define PWL_ICONTYPE_KEY 6
-#define PWL_ICONTYPE_NEWPARAGRAPH 7
-#define PWL_ICONTYPE_TEXTNOTE 8
-#define PWL_ICONTYPE_PARAGRAPH 9
-#define PWL_ICONTYPE_RIGHTARROW 10
-#define PWL_ICONTYPE_RIGHTPOINTER 11
-#define PWL_ICONTYPE_STAR 12
-#define PWL_ICONTYPE_UPARROW 13
-#define PWL_ICONTYPE_UPLEFTARROW 14
-
-#define PWL_ICONTYPE_GRAPH 15
-#define PWL_ICONTYPE_PAPERCLIP 16
-#define PWL_ICONTYPE_ATTACHMENT 17
-#define PWL_ICONTYPE_TAG 18
-
-#define PWL_ICONTYPE_FOXIT 19
-
-#define PWL_ICONTYPE_UNKNOWN -1
// checkbox & radiobutton style
#define PCS_CHECK 0
@@ -66,36 +33,18 @@ struct CPWL_Color;
#define PPBL_LABELLEFTICONRIGHT 5
#define PPBL_LABELOVERICON 6
-enum PWL_PATH_TYPE { PWLPT_PATHDATA, PWLPT_STREAM };
-
class CPWL_Utils {
public:
static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize);
static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize);
- static bool IntersectRect(const CFX_FloatRect& rect1,
- const CFX_FloatRect& rect2);
- static bool ContainsRect(const CFX_FloatRect& rcParent,
- const CFX_FloatRect& rcChild);
- static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale);
+
static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2);
static CFX_FloatRect GetCenterSquare(const CFX_FloatRect& rect);
- static CPWL_Color SubstractColor(const CPWL_Color& sColor,
- FX_FLOAT fColorSub);
- static CPWL_Color DevideColor(const CPWL_Color& sColor,
- FX_FLOAT fColorDevide);
- static CFX_FloatRect MaxRect(const CFX_FloatRect& rect1,
- const CFX_FloatRect& rect2);
+
static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect,
FX_FLOAT x,
FX_FLOAT y);
- static CFX_PointF OffsetPoint(const CFX_PointF& point,
- FX_FLOAT x,
- FX_FLOAT y);
- static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color,
- int32_t nTransparancy = 255);
- static bool IsBlackOrWhite(const CPWL_Color& color);
- static CPWL_Color GetReverseColor(const CPWL_Color& color);
static CFX_ByteString GetColorAppStream(const CPWL_Color& color,
const bool& bFillOrStroke = true);
@@ -118,7 +67,6 @@ class CPWL_Utils {
const CPWL_Color& color);
static CFX_ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
const CPWL_Color& color);
-
static CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
IPVT_FontMap* pFontMap,
CPDF_Stream* pIconStream,
@@ -133,7 +81,6 @@ class CPWL_Utils {
static CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
const CPWL_Color& crText);
-
static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit,
const CFX_PointF& ptOffset,
const CPVT_WordRange* pRange = nullptr,
@@ -143,22 +90,13 @@ class CPWL_Utils {
CFX_Edit* pEdit,
const CFX_PointF& ptOffset,
const CPVT_WordRange* pRange = nullptr);
- static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox,
- IPVT_FontMap* pFontMap,
- const CFX_WideString& sText,
- int32_t nAlignmentH,
- int32_t nAlignmentV,
- FX_FLOAT fFontSize,
- bool bMultiLine,
- bool bAutoReturn,
- const CPWL_Color& crText);
static CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox);
static void DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
const CPWL_Color& color,
- int32_t nTransparancy);
+ int32_t nTransparency);
static void DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
@@ -182,7 +120,7 @@ class CPWL_Utils {
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
BorderStyle nStyle,
- int32_t nTransparancy);
+ int32_t nTransparency);
static void DrawFillArea(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_PointF* pPts,
@@ -193,72 +131,12 @@ class CPWL_Utils {
bool bVertical,
bool bHorizontal,
CFX_FloatRect rect,
- int32_t nTransparancy,
+ int32_t nTransparency,
int32_t nStartGray,
int32_t nEndGray);
- public:
- static void ConvertCMYK2RGB(FX_FLOAT dC,
- FX_FLOAT dM,
- FX_FLOAT dY,
- FX_FLOAT dK,
- FX_FLOAT& dR,
- FX_FLOAT& dG,
- FX_FLOAT& dB);
- static void ConvertRGB2CMYK(FX_FLOAT dR,
- FX_FLOAT dG,
- FX_FLOAT dB,
- FX_FLOAT& dC,
- FX_FLOAT& dM,
- FX_FLOAT& dY,
- FX_FLOAT& dK);
-
- static void ConvertRGB2GRAY(FX_FLOAT dR,
- FX_FLOAT dG,
- FX_FLOAT dB,
- FX_FLOAT& dGray);
- static void ConvertGRAY2RGB(FX_FLOAT dGray,
- FX_FLOAT& dR,
- FX_FLOAT& dG,
- FX_FLOAT& dB);
-
- static void ConvertCMYK2GRAY(FX_FLOAT dC,
- FX_FLOAT dM,
- FX_FLOAT dY,
- FX_FLOAT dK,
- FX_FLOAT& dGray);
- static void ConvertGRAY2CMYK(FX_FLOAT dGray,
- FX_FLOAT& dC,
- FX_FLOAT& dM,
- FX_FLOAT& dY,
- FX_FLOAT& dK);
-
- static void PWLColorToARGB(const CPWL_Color& color,
- int32_t& alpha,
- FX_FLOAT& red,
- FX_FLOAT& green,
- FX_FLOAT& blue);
-
- public:
- static CFX_ByteString GetIconAppStream(
- int32_t nType,
- const CFX_FloatRect& rect,
- const CPWL_Color& crFill,
- const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);
- static void DrawIconAppStream(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- int32_t nType,
- const CFX_FloatRect& rect,
- const CPWL_Color& crFill,
- const CPWL_Color& crStroke,
- const int32_t nTransparancy);
-
private:
- static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData,
- int32_t nCount);
- static void GetPathDataFromArray(CFX_PathData& path,
- const CPWL_PathData* pPathData,
- int32_t nCount);
+ static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale);
static CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
const CPWL_Color& crText);
@@ -281,87 +159,6 @@ class CPWL_Utils {
static CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox);
static CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox,
FX_FLOAT fRotate);
-
- static void GetGraphics_Checkmark(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Circle(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Comment(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Cross(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Help(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_InsertText(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Key(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_NewParagraph(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_TextNote(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Paragraph(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_RightArrow(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_RightPointer(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Star(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_UpArrow(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Graph(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Paperclip(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Attachment(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Tag(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
- static void GetGraphics_Foxit(CFX_ByteString& sPathData,
- CFX_PathData& path,
- const CFX_FloatRect& crBBox,
- const PWL_PATH_TYPE type);
};
#endif // FPDFSDK_PDFWINDOW_PWL_UTILS_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 1f13e2ab6c..b10a0854a7 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -619,7 +619,7 @@ void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM& cp) {
scp.pParentWnd = this;
scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR;
scp.eCursorType = FXCT_ARROW;
- scp.nTransparency = PWL_SCROLLBAR_TRANSPARANCY;
+ scp.nTransparency = PWL_SCROLLBAR_TRANSPARENCY;
m_pVScrollBar = new CPWL_ScrollBar(SBT_VSCROLL);
m_pVScrollBar->Create(scp);
@@ -809,7 +809,7 @@ CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const {
CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const {
switch (nBorderStyle) {
case BorderStyle::BEVELED:
- return CPWL_Utils::DevideColor(GetBackgroundColor(), 2);
+ return GetBackgroundColor() / 2.0f;
case BorderStyle::INSET:
return CPWL_Color(COLORTYPE_GRAY, 0.75f);
default:
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
index 9c378f06c5..e6400efd26 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -121,7 +121,7 @@ inline bool operator!=(const CPWL_Color& c1, const CPWL_Color& c2) {
#define PWL_SCROLLBAR_WIDTH 12.0f
#define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f
#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f
-#define PWL_SCROLLBAR_TRANSPARANCY 150
+#define PWL_SCROLLBAR_TRANSPARENCY 150
#define PWL_SCROLLBAR_BKCOLOR \
CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f)
#define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB, 1, 1, 1)
diff --git a/fpdfsdk/pdfwindow/cpwl_color.cpp b/fpdfsdk/pdfwindow/cpwl_color.cpp
new file mode 100644
index 0000000000..9c9ca3eff0
--- /dev/null
+++ b/fpdfsdk/pdfwindow/cpwl_color.cpp
@@ -0,0 +1,179 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/pdfwindow/cpwl_color.h"
+
+#include <algorithm>
+
+namespace {
+
+bool InRange(FX_FLOAT comp) {
+ return comp >= 0.0f && comp <= 1.0f;
+}
+
+CPWL_Color ConvertCMYK2GRAY(FX_FLOAT dC,
+ FX_FLOAT dM,
+ FX_FLOAT dY,
+ FX_FLOAT dK) {
+ if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK))
+ return CPWL_Color(COLORTYPE_GRAY);
+ return CPWL_Color(
+ COLORTYPE_GRAY,
+ 1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK));
+}
+
+CPWL_Color ConvertGRAY2CMYK(FX_FLOAT dGray) {
+ if (!InRange(dGray))
+ return CPWL_Color(COLORTYPE_CMYK);
+ return CPWL_Color(COLORTYPE_CMYK, 0.0f, 0.0f, 0.0f, 1.0f - dGray);
+}
+
+CPWL_Color ConvertGRAY2RGB(FX_FLOAT dGray) {
+ if (!InRange(dGray))
+ return CPWL_Color(COLORTYPE_RGB);
+ return CPWL_Color(COLORTYPE_RGB, dGray, dGray, dGray);
+}
+
+CPWL_Color ConvertRGB2GRAY(FX_FLOAT dR, FX_FLOAT dG, FX_FLOAT dB) {
+ if (!InRange(dR) || !InRange(dG) || !InRange(dB))
+ return CPWL_Color(COLORTYPE_GRAY);
+ return CPWL_Color(COLORTYPE_GRAY, 0.3f * dR + 0.59f * dG + 0.11f * dB);
+}
+
+CPWL_Color ConvertCMYK2RGB(FX_FLOAT dC, FX_FLOAT dM, FX_FLOAT dY, FX_FLOAT dK) {
+ if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK))
+ return CPWL_Color(COLORTYPE_RGB);
+ return CPWL_Color(COLORTYPE_RGB, 1.0f - std::min(1.0f, dC + dK),
+ 1.0f - std::min(1.0f, dM + dK),
+ 1.0f - std::min(1.0f, dY + dK));
+}
+
+CPWL_Color ConvertRGB2CMYK(FX_FLOAT dR, FX_FLOAT dG, FX_FLOAT dB) {
+ if (!InRange(dR) || !InRange(dG) || !InRange(dB))
+ return CPWL_Color(COLORTYPE_CMYK);
+
+ FX_FLOAT c = 1.0f - dR;
+ FX_FLOAT m = 1.0f - dG;
+ FX_FLOAT y = 1.0f - dB;
+ return CPWL_Color(COLORTYPE_CMYK, c, m, y, std::min(c, std::min(m, y)));
+}
+
+} // namespace
+
+CPWL_Color CPWL_Color::ConvertColorType(int32_t nConvertColorType) const {
+ if (nColorType == nConvertColorType)
+ return *this;
+
+ CPWL_Color ret;
+ switch (nColorType) {
+ case COLORTYPE_TRANSPARENT:
+ ret = *this;
+ ret.nColorType = COLORTYPE_TRANSPARENT;
+ break;
+ case COLORTYPE_GRAY:
+ switch (nConvertColorType) {
+ case COLORTYPE_RGB:
+ ret = ConvertGRAY2RGB(fColor1);
+ break;
+ case COLORTYPE_CMYK:
+ ret = ConvertGRAY2CMYK(fColor1);
+ break;
+ }
+ break;
+ case COLORTYPE_RGB:
+ switch (nConvertColorType) {
+ case COLORTYPE_GRAY:
+ ret = ConvertRGB2GRAY(fColor1, fColor2, fColor3);
+ break;
+ case COLORTYPE_CMYK:
+ ret = ConvertRGB2CMYK(fColor1, fColor2, fColor3);
+ break;
+ }
+ break;
+ case COLORTYPE_CMYK:
+ switch (nConvertColorType) {
+ case COLORTYPE_GRAY:
+ ret = ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4);
+ break;
+ case COLORTYPE_RGB:
+ ret = ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4);
+ break;
+ }
+ break;
+ }
+ return ret;
+}
+
+FX_COLORREF CPWL_Color::ToFXColor(int32_t nTransparency) const {
+ CPWL_Color ret;
+ switch (nColorType) {
+ case COLORTYPE_TRANSPARENT: {
+ ret = CPWL_Color(COLORTYPE_TRANSPARENT, 0, 0, 0, 0);
+ break;
+ }
+ case COLORTYPE_GRAY: {
+ ret = ConvertGRAY2RGB(fColor1);
+ ret.fColor4 = nTransparency;
+ break;
+ }
+ case COLORTYPE_RGB: {
+ ret = CPWL_Color(COLORTYPE_RGB, fColor1, fColor2, fColor3);
+ ret.fColor4 = nTransparency;
+ break;
+ }
+ case COLORTYPE_CMYK: {
+ ret = ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4);
+ ret.fColor4 = nTransparency;
+ break;
+ }
+ }
+ return ArgbEncode(ret.fColor4, static_cast<int32_t>(ret.fColor1 * 255),
+ static_cast<int32_t>(ret.fColor2 * 255),
+ static_cast<int32_t>(ret.fColor3 * 255));
+}
+
+CPWL_Color CPWL_Color::operator-(FX_FLOAT fColorSub) const {
+ CPWL_Color sRet(nColorType);
+ switch (nColorType) {
+ case COLORTYPE_TRANSPARENT:
+ sRet.nColorType = COLORTYPE_RGB;
+ sRet.fColor1 = std::max(1.0f - fColorSub, 0.0f);
+ sRet.fColor2 = std::max(1.0f - fColorSub, 0.0f);
+ sRet.fColor3 = std::max(1.0f - fColorSub, 0.0f);
+ break;
+ case COLORTYPE_RGB:
+ case COLORTYPE_GRAY:
+ case COLORTYPE_CMYK:
+ sRet.fColor1 = std::max(fColor1 - fColorSub, 0.0f);
+ sRet.fColor2 = std::max(fColor2 - fColorSub, 0.0f);
+ sRet.fColor3 = std::max(fColor3 - fColorSub, 0.0f);
+ sRet.fColor4 = std::max(fColor4 - fColorSub, 0.0f);
+ break;
+ }
+ return sRet;
+}
+
+CPWL_Color CPWL_Color::operator/(FX_FLOAT fColorDivide) const {
+ CPWL_Color sRet(nColorType);
+ switch (nColorType) {
+ case COLORTYPE_TRANSPARENT:
+ sRet.nColorType = COLORTYPE_RGB;
+ sRet.fColor1 = 1.0f / fColorDivide;
+ sRet.fColor2 = 1.0f / fColorDivide;
+ sRet.fColor3 = 1.0f / fColorDivide;
+ break;
+ case COLORTYPE_RGB:
+ case COLORTYPE_GRAY:
+ case COLORTYPE_CMYK:
+ sRet = *this;
+ sRet.fColor1 /= fColorDivide;
+ sRet.fColor2 /= fColorDivide;
+ sRet.fColor3 /= fColorDivide;
+ sRet.fColor4 /= fColorDivide;
+ break;
+ }
+ return sRet;
+}
diff --git a/fpdfsdk/pdfwindow/cpwl_color.h b/fpdfsdk/pdfwindow/cpwl_color.h
index c1f9e6ea97..f1b34c7eb8 100644
--- a/fpdfsdk/pdfwindow/cpwl_color.h
+++ b/fpdfsdk/pdfwindow/cpwl_color.h
@@ -28,7 +28,12 @@ struct CPWL_Color {
fColor3(b / 255.0f),
fColor4(0) {}
- void ConvertColorType(int32_t other_nColorType);
+ CPWL_Color operator/(FX_FLOAT fColorDivide) const;
+ CPWL_Color operator-(FX_FLOAT fColorSub) const;
+
+ CPWL_Color ConvertColorType(int32_t other_nColorType) const;
+
+ FX_COLORREF ToFXColor(int32_t nTransparency) const;
void Reset() {
nColorType = COLORTYPE_TRANSPARENT;
diff --git a/fpdfsdk/pdfwindow/cpwl_pathdata.cpp b/fpdfsdk/pdfwindow/cpwl_pathdata.cpp
deleted file mode 100644
index 64fcd90820..0000000000
--- a/fpdfsdk/pdfwindow/cpwl_pathdata.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "fpdfsdk/pdfwindow/cpwl_pathdata.h"
-
-CPWL_PathData::CPWL_PathData() : point(), type(PWLPT_UNKNOWN) {}
-
-CPWL_PathData::CPWL_PathData(const CFX_PointF& pt, PWL_PATHDATA_TYPE tp)
- : point(pt), type(tp) {}
-
-CPWL_PathData::CPWL_PathData(const CPWL_PathData&) = default;
-
-CPWL_PathData::~CPWL_PathData() = default;
diff --git a/fpdfsdk/pdfwindow/cpwl_pathdata.h b/fpdfsdk/pdfwindow/cpwl_pathdata.h
deleted file mode 100644
index de969b66ae..0000000000
--- a/fpdfsdk/pdfwindow/cpwl_pathdata.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FPDFSDK_PDFWINDOW_CPWL_PATHDATA_H_
-#define FPDFSDK_PDFWINDOW_CPWL_PATHDATA_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-
-enum PWL_PATHDATA_TYPE {
- PWLPT_MOVETO,
- PWLPT_LINETO,
- PWLPT_BEZIERTO,
- PWLPT_UNKNOWN
-};
-
-class CPWL_PathData {
- public:
- CPWL_PathData();
- CPWL_PathData(const CFX_PointF& pt, PWL_PATHDATA_TYPE tp);
- CPWL_PathData(const CPWL_PathData&);
- ~CPWL_PathData();
-
- CFX_PointF point;
- PWL_PATHDATA_TYPE type;
-};
-
-#endif // FPDFSDK_PDFWINDOW_CPWL_PATHDATA_H_