PWL_Utils.cpp revision 4d3acf4ec42bf6e838f9060103aff98fbf170794
1// Copyright 2014 PDFium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7#include "fpdfsdk/pdfwindow/PWL_Utils.h" 8 9#include <algorithm> 10#include <memory> 11 12#include "core/fpdfdoc/cpvt_word.h" 13#include "core/fxge/cfx_graphstatedata.h" 14#include "core/fxge/cfx_pathdata.h" 15#include "core/fxge/cfx_renderdevice.h" 16#include "fpdfsdk/fxedit/fxet_edit.h" 17#include "fpdfsdk/pdfwindow/PWL_Icon.h" 18#include "fpdfsdk/pdfwindow/PWL_Wnd.h" 19 20CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, 21 int32_t nCount) { 22 CFX_ByteTextBuf csAP; 23 24 for (int32_t i = 0; i < nCount; i++) { 25 switch (pPathData[i].type) { 26 case PWLPT_MOVETO: 27 csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " m\n"; 28 break; 29 case PWLPT_LINETO: 30 csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " l\n"; 31 break; 32 case PWLPT_BEZIERTO: 33 csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " " 34 << pPathData[i + 1].point.x << " " << pPathData[i + 1].point.y 35 << " " << pPathData[i + 2].point.x << " " 36 << pPathData[i + 2].point.y << " c\n"; 37 38 i += 2; 39 break; 40 default: 41 break; 42 } 43 } 44 45 return csAP.MakeString(); 46} 47 48void CPWL_Utils::GetPathDataFromArray(CFX_PathData& path, 49 const CPWL_PathData* pPathData, 50 int32_t nCount) { 51 path.SetPointCount(nCount); 52 53 for (int32_t i = 0; i < nCount; i++) { 54 switch (pPathData[i].type) { 55 case PWLPT_MOVETO: 56 path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, 57 FXPT_MOVETO); 58 break; 59 case PWLPT_LINETO: 60 path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, 61 FXPT_LINETO); 62 break; 63 case PWLPT_BEZIERTO: 64 path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, 65 FXPT_BEZIERTO); 66 break; 67 default: 68 break; 69 } 70 } 71} 72 73CFX_FloatRect CPWL_Utils::MaxRect(const CFX_FloatRect& rect1, 74 const CFX_FloatRect& rect2) { 75 CFX_FloatRect rcRet; 76 77 rcRet.left = PWL_MIN(rect1.left, rect2.left); 78 rcRet.bottom = PWL_MIN(rect1.bottom, rect2.bottom); 79 rcRet.right = PWL_MAX(rect1.right, rect2.right); 80 rcRet.top = PWL_MAX(rect1.top, rect2.top); 81 82 return rcRet; 83} 84 85CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect, 86 FX_FLOAT x, 87 FX_FLOAT y) { 88 return CFX_FloatRect(rect.left + x, rect.bottom + y, rect.right + x, 89 rect.top + y); 90} 91 92bool CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, 93 const CFX_FloatRect& rcChild) { 94 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom && 95 rcChild.right <= rcParent.right && rcChild.top <= rcParent.top; 96} 97 98bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, 99 const CFX_FloatRect& rect2) { 100 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; 101 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; 102 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom; 103 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top; 104 105 return left < right && bottom < top; 106} 107 108CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, 109 FX_FLOAT x, 110 FX_FLOAT y) { 111 return CFX_FloatPoint(point.x + x, point.y + y); 112} 113 114CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, 115 const CPVT_WordRange& wr2) { 116 CPVT_WordRange wrRet; 117 118 if (wr2.EndPos.WordCmp(wr1.BeginPos) < 0 || 119 wr2.BeginPos.WordCmp(wr1.EndPos) > 0) 120 return wrRet; 121 if (wr1.EndPos.WordCmp(wr2.BeginPos) < 0 || 122 wr1.BeginPos.WordCmp(wr2.EndPos) > 0) 123 return wrRet; 124 125 if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) { 126 wrRet.BeginPos = wr2.BeginPos; 127 } else { 128 wrRet.BeginPos = wr1.BeginPos; 129 } 130 131 if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) { 132 wrRet.EndPos = wr1.EndPos; 133 } else { 134 wrRet.EndPos = wr2.EndPos; 135 } 136 137 return wrRet; 138} 139 140CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) { 141 const FX_FLOAT fWidth = crBBox.right - crBBox.left; 142 const FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 143 144 CPWL_Point pts[8][3] = {{CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f), 145 CPWL_Point(0.29f, 0.40f)}, 146 {CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f), 147 CPWL_Point(0.31f, 0.28f)}, 148 {CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f), 149 CPWL_Point(0.77f, 0.67f)}, 150 {CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f), 151 CPWL_Point(0.76f, 0.75f)}, 152 {CPWL_Point(0.76f, 0.75f), CPWL_Point(0.73f, 0.80f), 153 CPWL_Point(0.68f, 0.75f)}, 154 {CPWL_Point(0.68f, 0.74f), CPWL_Point(0.68f, 0.74f), 155 CPWL_Point(0.44f, 0.47f)}, 156 {CPWL_Point(0.43f, 0.47f), CPWL_Point(0.40f, 0.47f), 157 CPWL_Point(0.41f, 0.58f)}, 158 {CPWL_Point(0.40f, 0.60f), CPWL_Point(0.28f, 0.66f), 159 CPWL_Point(0.30f, 0.56f)}}; 160 161 for (size_t i = 0; i < FX_ArraySize(pts); ++i) { 162 for (size_t j = 0; j < FX_ArraySize(pts[0]); ++j) { 163 pts[i][j].x = pts[i][j].x * fWidth + crBBox.left; 164 pts[i][j].y *= pts[i][j].y * fHeight + crBBox.bottom; 165 } 166 } 167 168 CFX_ByteTextBuf csAP; 169 csAP << pts[0][0].x << " " << pts[0][0].y << " m\n"; 170 171 for (size_t i = 0; i < FX_ArraySize(pts); ++i) { 172 size_t nNext = i < FX_ArraySize(pts) - 1 ? i + 1 : 0; 173 174 FX_FLOAT px1 = pts[i][1].x - pts[i][0].x; 175 FX_FLOAT py1 = pts[i][1].y - pts[i][0].y; 176 FX_FLOAT px2 = pts[i][2].x - pts[nNext][0].x; 177 FX_FLOAT py2 = pts[i][2].y - pts[nNext][0].y; 178 179 csAP << pts[i][0].x + px1 * FX_BEZIER << " " 180 << pts[i][0].y + py1 * FX_BEZIER << " " 181 << pts[nNext][0].x + px2 * FX_BEZIER << " " 182 << pts[nNext][0].y + py2 * FX_BEZIER << " " << pts[nNext][0].x << " " 183 << pts[nNext][0].y << " c\n"; 184 } 185 186 return csAP.MakeString(); 187} 188 189CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { 190 CFX_ByteTextBuf csAP; 191 192 FX_FLOAT fWidth = crBBox.right - crBBox.left; 193 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 194 195 CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); 196 CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); 197 CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); 198 CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); 199 200 csAP << pt1.x << " " << pt1.y << " m\n"; 201 202 FX_FLOAT px = pt2.x - pt1.x; 203 FX_FLOAT py = pt2.y - pt1.y; 204 205 csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " " 206 << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y 207 << " c\n"; 208 209 px = pt3.x - pt2.x; 210 py = pt2.y - pt3.y; 211 212 csAP << pt2.x + px * FX_BEZIER << " " << pt2.y << " " << pt3.x << " " 213 << pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " c\n"; 214 215 px = pt3.x - pt4.x; 216 py = pt3.y - pt4.y; 217 218 csAP << pt3.x << " " << pt3.y - py * FX_BEZIER << " " 219 << pt4.x + px * FX_BEZIER << " " << pt4.y << " " << pt4.x << " " << pt4.y 220 << " c\n"; 221 222 px = pt4.x - pt1.x; 223 py = pt1.y - pt4.y; 224 225 csAP << pt4.x - px * FX_BEZIER << " " << pt4.y << " " << pt1.x << " " 226 << pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " c\n"; 227 228 return csAP.MakeString(); 229} 230 231CFX_ByteString CPWL_Utils::GetAP_Cross(const CFX_FloatRect& crBBox) { 232 CFX_ByteTextBuf csAP; 233 234 csAP << crBBox.left << " " << crBBox.top << " m\n"; 235 csAP << crBBox.right << " " << crBBox.bottom << " l\n"; 236 csAP << crBBox.left << " " << crBBox.bottom << " m\n"; 237 csAP << crBBox.right << " " << crBBox.top << " l\n"; 238 239 return csAP.MakeString(); 240} 241 242CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { 243 CFX_ByteTextBuf csAP; 244 245 FX_FLOAT fWidth = crBBox.right - crBBox.left; 246 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 247 248 CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); 249 CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); 250 CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); 251 CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); 252 253 csAP << pt1.x << " " << pt1.y << " m\n"; 254 csAP << pt2.x << " " << pt2.y << " l\n"; 255 csAP << pt3.x << " " << pt3.y << " l\n"; 256 csAP << pt4.x << " " << pt4.y << " l\n"; 257 csAP << pt1.x << " " << pt1.y << " l\n"; 258 259 return csAP.MakeString(); 260} 261 262CFX_ByteString CPWL_Utils::GetAP_Square(const CFX_FloatRect& crBBox) { 263 CFX_ByteTextBuf csAP; 264 265 csAP << crBBox.left << " " << crBBox.top << " m\n"; 266 csAP << crBBox.right << " " << crBBox.top << " l\n"; 267 csAP << crBBox.right << " " << crBBox.bottom << " l\n"; 268 csAP << crBBox.left << " " << crBBox.bottom << " l\n"; 269 csAP << crBBox.left << " " << crBBox.top << " l\n"; 270 271 return csAP.MakeString(); 272} 273 274CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { 275 CFX_ByteTextBuf csAP; 276 277 FX_FLOAT fRadius = 278 (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); 279 CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, 280 (crBBox.top + crBBox.bottom) / 2.0f); 281 282 FX_FLOAT px[5], py[5]; 283 284 FX_FLOAT fAngel = FX_PI / 10.0f; 285 286 for (int32_t i = 0; i < 5; i++) { 287 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel); 288 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel); 289 290 fAngel += FX_PI * 2 / 5.0f; 291 } 292 293 csAP << px[0] << " " << py[0] << " m\n"; 294 295 int32_t nNext = 0; 296 for (int32_t j = 0; j < 5; j++) { 297 nNext += 2; 298 if (nNext >= 5) 299 nNext -= 5; 300 csAP << px[nNext] << " " << py[nNext] << " l\n"; 301 } 302 303 return csAP.MakeString(); 304} 305 306CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, 307 FX_FLOAT fRotate) { 308 CFX_ByteTextBuf csAP; 309 310 FX_FLOAT fWidth = crBBox.right - crBBox.left; 311 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 312 313 CFX_FloatPoint pt1(-fWidth / 2, 0); 314 CFX_FloatPoint pt2(0, fHeight / 2); 315 CFX_FloatPoint pt3(fWidth / 2, 0); 316 317 FX_FLOAT px, py; 318 319 csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " " 320 << cos(fRotate) << " " << crBBox.left + fWidth / 2 << " " 321 << crBBox.bottom + fHeight / 2 << " cm\n"; 322 323 csAP << pt1.x << " " << pt1.y << " m\n"; 324 325 px = pt2.x - pt1.x; 326 py = pt2.y - pt1.y; 327 328 csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " " 329 << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y 330 << " c\n"; 331 332 px = pt3.x - pt2.x; 333 py = pt2.y - pt3.y; 334 335 csAP << pt2.x + px * FX_BEZIER << " " << pt2.y << " " << pt3.x << " " 336 << pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " c\n"; 337 338 return csAP.MakeString(); 339} 340 341CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect, 342 FX_FLOAT fSize) { 343 if (rcRect.IsEmpty()) 344 return rcRect; 345 346 CFX_FloatRect rcNew(rcRect.left - fSize, rcRect.bottom - fSize, 347 rcRect.right + fSize, rcRect.top + fSize); 348 rcNew.Normalize(); 349 return rcNew; 350} 351 352CFX_FloatRect CPWL_Utils::DeflateRect(const CFX_FloatRect& rcRect, 353 FX_FLOAT fSize) { 354 if (rcRect.IsEmpty()) 355 return rcRect; 356 357 CFX_FloatRect rcNew(rcRect.left + fSize, rcRect.bottom + fSize, 358 rcRect.right - fSize, rcRect.top - fSize); 359 rcNew.Normalize(); 360 return rcNew; 361} 362 363CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, 364 FX_FLOAT fScale) { 365 FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; 366 FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; 367 368 CFX_FloatPoint ptCenter = CFX_FloatPoint((rcRect.left + rcRect.right) / 2, 369 (rcRect.top + rcRect.bottom) / 2); 370 371 return CFX_FloatRect( 372 ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, 373 ptCenter.x + fHalfWidth * fScale, ptCenter.y + fHalfHeight * fScale); 374} 375 376CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, 377 const CPWL_Color& color) { 378 CFX_ByteTextBuf sAppStream; 379 CFX_ByteString sColor = GetColorAppStream(color, true); 380 if (sColor.GetLength() > 0) { 381 sAppStream << "q\n" << sColor; 382 sAppStream << rect.left << " " << rect.bottom << " " 383 << rect.right - rect.left << " " << rect.top - rect.bottom 384 << " re f\nQ\n"; 385 } 386 387 return sAppStream.MakeString(); 388} 389 390CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, 391 const CPWL_Color& color) { 392 CFX_ByteTextBuf sAppStream; 393 CFX_ByteString sColor = GetColorAppStream(color, true); 394 if (sColor.GetLength() > 0) { 395 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; 396 } 397 return sAppStream.MakeString(); 398} 399 400CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { 401 FX_FLOAT fWidth = rect.right - rect.left; 402 FX_FLOAT fHeight = rect.top - rect.bottom; 403 404 FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f; 405 FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f; 406 407 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; 408 409 return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius, 410 fCenterX + fRadius, fCenterY + fRadius); 411} 412 413CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, 414 const CFX_FloatPoint& ptOffset, 415 const CPVT_WordRange* pRange, 416 bool bContinuous, 417 uint16_t SubWord) { 418 return CFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous, 419 SubWord); 420} 421 422CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit, 423 const CFX_FloatPoint& ptOffset, 424 const CPVT_WordRange* pRange) { 425 return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); 426} 427 428CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, 429 IPVT_FontMap* pFontMap, 430 const CFX_WideString& sText, 431 int32_t nAlignmentH, 432 int32_t nAlignmentV, 433 FX_FLOAT fFontSize, 434 bool bMultiLine, 435 bool bAutoReturn, 436 const CPWL_Color& crText) { 437 CFX_ByteTextBuf sRet; 438 439 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); 440 pEdit->SetFontMap(pFontMap); 441 pEdit->SetPlateRect(rcBBox); 442 pEdit->SetAlignmentH(nAlignmentH, true); 443 pEdit->SetAlignmentV(nAlignmentV, true); 444 pEdit->SetMultiLine(bMultiLine, true); 445 pEdit->SetAutoReturn(bAutoReturn, true); 446 if (IsFloatZero(fFontSize)) 447 pEdit->SetAutoFontSize(true, true); 448 else 449 pEdit->SetFontSize(fFontSize); 450 451 pEdit->Initialize(); 452 pEdit->SetText(sText); 453 454 CFX_ByteString sEdit = 455 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); 456 if (sEdit.GetLength() > 0) 457 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; 458 459 return sRet.MakeString(); 460} 461 462CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, 463 IPVT_FontMap* pFontMap, 464 CPDF_Stream* pIconStream, 465 CPDF_IconFit& IconFit, 466 const CFX_WideString& sLabel, 467 const CPWL_Color& crText, 468 FX_FLOAT fFontSize, 469 int32_t nLayOut) { 470 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; 471 472 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); 473 pEdit->SetFontMap(pFontMap); 474 pEdit->SetAlignmentH(1, true); 475 pEdit->SetAlignmentV(1, true); 476 pEdit->SetMultiLine(false, true); 477 pEdit->SetAutoReturn(false, true); 478 if (IsFloatZero(fFontSize)) 479 pEdit->SetAutoFontSize(true, true); 480 else 481 pEdit->SetFontSize(fFontSize); 482 483 pEdit->Initialize(); 484 pEdit->SetText(sLabel); 485 486 CFX_FloatRect rcLabelContent = pEdit->GetContentRect(); 487 CPWL_Icon Icon; 488 PWL_CREATEPARAM cp; 489 cp.dwFlags = PWS_VISIBLE; 490 Icon.Create(cp); 491 Icon.SetIconFit(&IconFit); 492 Icon.SetPDFStream(pIconStream); 493 494 CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0); 495 CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0); 496 FX_FLOAT fWidth = 0.0f; 497 FX_FLOAT fHeight = 0.0f; 498 499 switch (nLayOut) { 500 case PPBL_LABEL: 501 rcLabel = rcBBox; 502 rcIcon = CFX_FloatRect(0, 0, 0, 0); 503 break; 504 case PPBL_ICON: 505 rcIcon = rcBBox; 506 rcLabel = CFX_FloatRect(0, 0, 0, 0); 507 break; 508 case PPBL_ICONTOPLABELBOTTOM: 509 510 if (pIconStream) { 511 if (IsFloatZero(fFontSize)) { 512 fHeight = rcBBox.top - rcBBox.bottom; 513 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right, 514 rcBBox.bottom + fHeight * fAutoFontScale); 515 rcIcon = 516 CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right, rcBBox.top); 517 } else { 518 fHeight = rcLabelContent.Height(); 519 520 if (rcBBox.bottom + fHeight > rcBBox.top) { 521 rcIcon = CFX_FloatRect(0, 0, 0, 0); 522 rcLabel = rcBBox; 523 } else { 524 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right, 525 rcBBox.bottom + fHeight); 526 rcIcon = CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right, 527 rcBBox.top); 528 } 529 } 530 } else { 531 rcLabel = rcBBox; 532 rcIcon = CFX_FloatRect(0, 0, 0, 0); 533 } 534 535 break; 536 case PPBL_LABELTOPICONBOTTOM: 537 538 if (pIconStream) { 539 if (IsFloatZero(fFontSize)) { 540 fHeight = rcBBox.top - rcBBox.bottom; 541 rcLabel = 542 CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight * fAutoFontScale, 543 rcBBox.right, rcBBox.top); 544 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right, 545 rcLabel.bottom); 546 } else { 547 fHeight = rcLabelContent.Height(); 548 549 if (rcBBox.bottom + fHeight > rcBBox.top) { 550 rcIcon = CFX_FloatRect(0, 0, 0, 0); 551 rcLabel = rcBBox; 552 } else { 553 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight, 554 rcBBox.right, rcBBox.top); 555 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right, 556 rcLabel.bottom); 557 } 558 } 559 } else { 560 rcLabel = rcBBox; 561 rcIcon = CFX_FloatRect(0, 0, 0, 0); 562 } 563 564 break; 565 case PPBL_ICONLEFTLABELRIGHT: 566 567 if (pIconStream) { 568 if (IsFloatZero(fFontSize)) { 569 fWidth = rcBBox.right - rcBBox.left; 570 rcLabel = CFX_FloatRect(rcBBox.right - fWidth * fAutoFontScale, 571 rcBBox.bottom, rcBBox.right, rcBBox.top); 572 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left, 573 rcBBox.top); 574 575 if (rcLabelContent.Width() < fWidth * fAutoFontScale) { 576 } else { 577 if (rcLabelContent.Width() < fWidth) { 578 rcLabel = CFX_FloatRect(rcBBox.right - rcLabelContent.Width(), 579 rcBBox.bottom, rcBBox.right, rcBBox.top); 580 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left, 581 rcBBox.top); 582 } else { 583 rcLabel = rcBBox; 584 rcIcon = CFX_FloatRect(0, 0, 0, 0); 585 } 586 } 587 } else { 588 fWidth = rcLabelContent.Width(); 589 590 if (rcBBox.left + fWidth > rcBBox.right) { 591 rcLabel = rcBBox; 592 rcIcon = CFX_FloatRect(0, 0, 0, 0); 593 } else { 594 rcLabel = CFX_FloatRect(rcBBox.right - fWidth, rcBBox.bottom, 595 rcBBox.right, rcBBox.top); 596 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left, 597 rcBBox.top); 598 } 599 } 600 } else { 601 rcLabel = rcBBox; 602 rcIcon = CFX_FloatRect(0, 0, 0, 0); 603 } 604 605 break; 606 case PPBL_LABELLEFTICONRIGHT: 607 608 if (pIconStream) { 609 if (IsFloatZero(fFontSize)) { 610 fWidth = rcBBox.right - rcBBox.left; 611 rcLabel = 612 CFX_FloatRect(rcBBox.left, rcBBox.bottom, 613 rcBBox.left + fWidth * fAutoFontScale, rcBBox.top); 614 rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right, 615 rcBBox.top); 616 617 if (rcLabelContent.Width() < fWidth * fAutoFontScale) { 618 } else { 619 if (rcLabelContent.Width() < fWidth) { 620 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, 621 rcBBox.left + rcLabelContent.Width(), 622 rcBBox.top); 623 rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right, 624 rcBBox.top); 625 } else { 626 rcLabel = rcBBox; 627 rcIcon = CFX_FloatRect(0, 0, 0, 0); 628 } 629 } 630 } else { 631 fWidth = rcLabelContent.Width(); 632 633 if (rcBBox.left + fWidth > rcBBox.right) { 634 rcLabel = rcBBox; 635 rcIcon = CFX_FloatRect(0, 0, 0, 0); 636 } else { 637 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, 638 rcBBox.left + fWidth, rcBBox.top); 639 rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right, 640 rcBBox.top); 641 } 642 } 643 } else { 644 rcLabel = rcBBox; 645 rcIcon = CFX_FloatRect(0, 0, 0, 0); 646 } 647 648 break; 649 case PPBL_LABELOVERICON: 650 rcLabel = rcBBox; 651 rcIcon = rcBBox; 652 break; 653 } 654 655 CFX_ByteTextBuf sAppStream, sTemp; 656 657 if (!rcIcon.IsEmpty()) { 658 Icon.Move(rcIcon, false, false); 659 sTemp << Icon.GetImageAppStream(); 660 } 661 662 Icon.Destroy(); 663 664 if (!rcLabel.IsEmpty()) { 665 pEdit->SetPlateRect(rcLabel); 666 CFX_ByteString sEdit = 667 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); 668 if (sEdit.GetLength() > 0) { 669 sTemp << "BT\n" 670 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; 671 } 672 } 673 674 if (sTemp.GetSize() > 0) { 675 sAppStream << "q\n" 676 << rcBBox.left << " " << rcBBox.bottom << " " 677 << rcBBox.right - rcBBox.left << " " 678 << rcBBox.top - rcBBox.bottom << " re W n\n"; 679 sAppStream << sTemp << "Q\n"; 680 } 681 return sAppStream.MakeString(); 682} 683 684CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, 685 const bool& bFillOrStroke) { 686 CFX_ByteTextBuf sColorStream; 687 688 switch (color.nColorType) { 689 case COLORTYPE_RGB: 690 sColorStream << color.fColor1 << " " << color.fColor2 << " " 691 << color.fColor3 << " " << (bFillOrStroke ? "rg" : "RG") 692 << "\n"; 693 break; 694 case COLORTYPE_GRAY: 695 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") 696 << "\n"; 697 break; 698 case COLORTYPE_CMYK: 699 sColorStream << color.fColor1 << " " << color.fColor2 << " " 700 << color.fColor3 << " " << color.fColor4 << " " 701 << (bFillOrStroke ? "k" : "K") << "\n"; 702 break; 703 } 704 705 return sColorStream.MakeString(); 706} 707 708CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, 709 FX_FLOAT fWidth, 710 const CPWL_Color& color, 711 const CPWL_Color& crLeftTop, 712 const CPWL_Color& crRightBottom, 713 BorderStyle nStyle, 714 const CPWL_Dash& dash) { 715 CFX_ByteTextBuf sAppStream; 716 CFX_ByteString sColor; 717 718 FX_FLOAT fLeft = rect.left; 719 FX_FLOAT fRight = rect.right; 720 FX_FLOAT fTop = rect.top; 721 FX_FLOAT fBottom = rect.bottom; 722 723 if (fWidth > 0.0f) { 724 FX_FLOAT fHalfWidth = fWidth / 2.0f; 725 726 sAppStream << "q\n"; 727 728 switch (nStyle) { 729 default: 730 case BorderStyle::SOLID: 731 sColor = CPWL_Utils::GetColorAppStream(color, true); 732 if (sColor.GetLength() > 0) { 733 sAppStream << sColor; 734 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " 735 << fTop - fBottom << " re\n"; 736 sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " 737 << fRight - fLeft - fWidth * 2 << " " 738 << fTop - fBottom - fWidth * 2 << " re\n"; 739 sAppStream << "f*\n"; 740 } 741 break; 742 case BorderStyle::DASH: 743 sColor = CPWL_Utils::GetColorAppStream(color, false); 744 if (sColor.GetLength() > 0) { 745 sAppStream << sColor; 746 sAppStream << fWidth << " w" 747 << " [" << dash.nDash << " " << dash.nGap << "] " 748 << dash.nPhase << " d\n"; 749 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 750 << " m\n"; 751 sAppStream << fLeft + fWidth / 2 << " " << fTop - fWidth / 2 752 << " l\n"; 753 sAppStream << fRight - fWidth / 2 << " " << fTop - fWidth / 2 754 << " l\n"; 755 sAppStream << fRight - fWidth / 2 << " " << fBottom + fWidth / 2 756 << " l\n"; 757 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 758 << " l S\n"; 759 } 760 break; 761 case BorderStyle::BEVELED: 762 case BorderStyle::INSET: 763 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, true); 764 if (sColor.GetLength() > 0) { 765 sAppStream << sColor; 766 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth 767 << " m\n"; 768 sAppStream << fLeft + fHalfWidth << " " << fTop - fHalfWidth 769 << " l\n"; 770 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth 771 << " l\n"; 772 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 773 << " l\n"; 774 sAppStream << fLeft + fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 775 << " l\n"; 776 sAppStream << fLeft + fHalfWidth * 2 << " " 777 << fBottom + fHalfWidth * 2 << " l f\n"; 778 } 779 780 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, true); 781 if (sColor.GetLength() > 0) { 782 sAppStream << sColor; 783 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth 784 << " m\n"; 785 sAppStream << fRight - fHalfWidth << " " << fBottom + fHalfWidth 786 << " l\n"; 787 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth 788 << " l\n"; 789 sAppStream << fLeft + fHalfWidth * 2 << " " 790 << fBottom + fHalfWidth * 2 << " l\n"; 791 sAppStream << fRight - fHalfWidth * 2 << " " 792 << fBottom + fHalfWidth * 2 << " l\n"; 793 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 794 << " l f\n"; 795 } 796 797 sColor = CPWL_Utils::GetColorAppStream(color, true); 798 if (sColor.GetLength() > 0) { 799 sAppStream << sColor; 800 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " 801 << fTop - fBottom << " re\n"; 802 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " 803 << fRight - fLeft - fHalfWidth * 2 << " " 804 << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; 805 } 806 break; 807 case BorderStyle::UNDERLINE: 808 sColor = CPWL_Utils::GetColorAppStream(color, false); 809 if (sColor.GetLength() > 0) { 810 sAppStream << sColor; 811 sAppStream << fWidth << " w\n"; 812 sAppStream << fLeft << " " << fBottom + fWidth / 2 << " m\n"; 813 sAppStream << fRight << " " << fBottom + fWidth / 2 << " l S\n"; 814 } 815 break; 816 } 817 818 sAppStream << "Q\n"; 819 } 820 821 return sAppStream.MakeString(); 822} 823 824CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( 825 const CFX_FloatRect& rect, 826 FX_FLOAT fWidth, 827 const CPWL_Color& color, 828 const CPWL_Color& crLeftTop, 829 const CPWL_Color& crRightBottom, 830 BorderStyle nStyle, 831 const CPWL_Dash& dash) { 832 CFX_ByteTextBuf sAppStream; 833 CFX_ByteString sColor; 834 835 if (fWidth > 0.0f) { 836 sAppStream << "q\n"; 837 838 switch (nStyle) { 839 default: 840 case BorderStyle::SOLID: 841 case BorderStyle::UNDERLINE: { 842 sColor = CPWL_Utils::GetColorAppStream(color, false); 843 if (sColor.GetLength() > 0) { 844 sAppStream << "q\n" << fWidth << " w\n" << sColor 845 << CPWL_Utils::GetAP_Circle( 846 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) 847 << " S\nQ\n"; 848 } 849 } break; 850 case BorderStyle::DASH: { 851 sColor = CPWL_Utils::GetColorAppStream(color, false); 852 if (sColor.GetLength() > 0) { 853 sAppStream << "q\n" << fWidth << " w\n" 854 << "[" << dash.nDash << " " << dash.nGap << "] " 855 << dash.nPhase << " d\n" << sColor 856 << CPWL_Utils::GetAP_Circle( 857 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) 858 << " S\nQ\n"; 859 } 860 } break; 861 case BorderStyle::BEVELED: { 862 FX_FLOAT fHalfWidth = fWidth / 2.0f; 863 864 sColor = CPWL_Utils::GetColorAppStream(color, false); 865 if (sColor.GetLength() > 0) { 866 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor 867 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; 868 } 869 870 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); 871 if (sColor.GetLength() > 0) { 872 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor 873 << CPWL_Utils::GetAP_HalfCircle( 874 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), 875 FX_PI / 4.0f) 876 << " S\nQ\n"; 877 } 878 879 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); 880 if (sColor.GetLength() > 0) { 881 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor 882 << CPWL_Utils::GetAP_HalfCircle( 883 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), 884 FX_PI * 5 / 4.0f) 885 << " S\nQ\n"; 886 } 887 } break; 888 case BorderStyle::INSET: { 889 FX_FLOAT fHalfWidth = fWidth / 2.0f; 890 891 sColor = CPWL_Utils::GetColorAppStream(color, false); 892 if (sColor.GetLength() > 0) { 893 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor 894 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; 895 } 896 897 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); 898 if (sColor.GetLength() > 0) { 899 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor 900 << CPWL_Utils::GetAP_HalfCircle( 901 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), 902 FX_PI / 4.0f) 903 << " S\nQ\n"; 904 } 905 906 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); 907 if (sColor.GetLength() > 0) { 908 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor 909 << CPWL_Utils::GetAP_HalfCircle( 910 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), 911 FX_PI * 5 / 4.0f) 912 << " S\nQ\n"; 913 } 914 } break; 915 } 916 917 sAppStream << "Q\n"; 918 } 919 920 return sAppStream.MakeString(); 921} 922 923CPWL_Color CPWL_Utils::SubstractColor(const CPWL_Color& sColor, 924 FX_FLOAT fColorSub) { 925 CPWL_Color sRet; 926 sRet.nColorType = sColor.nColorType; 927 928 switch (sColor.nColorType) { 929 case COLORTYPE_TRANSPARENT: 930 sRet.nColorType = COLORTYPE_RGB; 931 sRet.fColor1 = PWL_MAX(1 - fColorSub, 0.0f); 932 sRet.fColor2 = PWL_MAX(1 - fColorSub, 0.0f); 933 sRet.fColor3 = PWL_MAX(1 - fColorSub, 0.0f); 934 break; 935 case COLORTYPE_RGB: 936 case COLORTYPE_GRAY: 937 case COLORTYPE_CMYK: 938 sRet.fColor1 = PWL_MAX(sColor.fColor1 - fColorSub, 0.0f); 939 sRet.fColor2 = PWL_MAX(sColor.fColor2 - fColorSub, 0.0f); 940 sRet.fColor3 = PWL_MAX(sColor.fColor3 - fColorSub, 0.0f); 941 sRet.fColor4 = PWL_MAX(sColor.fColor4 - fColorSub, 0.0f); 942 break; 943 } 944 945 return sRet; 946} 947 948CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color& sColor, 949 FX_FLOAT fColorDevide) { 950 CPWL_Color sRet; 951 sRet.nColorType = sColor.nColorType; 952 953 switch (sColor.nColorType) { 954 case COLORTYPE_TRANSPARENT: 955 sRet.nColorType = COLORTYPE_RGB; 956 sRet.fColor1 = 1 / fColorDevide; 957 sRet.fColor2 = 1 / fColorDevide; 958 sRet.fColor3 = 1 / fColorDevide; 959 break; 960 case COLORTYPE_RGB: 961 case COLORTYPE_GRAY: 962 case COLORTYPE_CMYK: 963 sRet = sColor; 964 sRet.fColor1 /= fColorDevide; 965 sRet.fColor2 /= fColorDevide; 966 sRet.fColor3 /= fColorDevide; 967 sRet.fColor4 /= fColorDevide; 968 break; 969 } 970 971 return sRet; 972} 973 974CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, 975 const CPWL_Color& crText) { 976 CFX_ByteTextBuf sAP; 977 sAP << "q\n" 978 << CPWL_Utils::GetColorAppStream(crText, true) 979 << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; 980 return sAP.MakeString(); 981} 982 983CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, 984 const CPWL_Color& crText) { 985 CFX_ByteTextBuf sAP; 986 sAP << "q\n" 987 << CPWL_Utils::GetColorAppStream(crText, true) 988 << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; 989 return sAP.MakeString(); 990} 991 992CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, 993 const CPWL_Color& crText) { 994 CFX_ByteTextBuf sAP; 995 sAP << "q\n" 996 << CPWL_Utils::GetColorAppStream(crText, false) 997 << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; 998 return sAP.MakeString(); 999} 1000 1001CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, 1002 const CPWL_Color& crText) { 1003 CFX_ByteTextBuf sAP; 1004 sAP << "q\n1 w\n" 1005 << CPWL_Utils::GetColorAppStream(crText, true) 1006 << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; 1007 return sAP.MakeString(); 1008} 1009 1010CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, 1011 const CPWL_Color& crText) { 1012 CFX_ByteTextBuf sAP; 1013 sAP << "q\n" 1014 << CPWL_Utils::GetColorAppStream(crText, true) 1015 << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; 1016 return sAP.MakeString(); 1017} 1018 1019CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, 1020 const CPWL_Color& crText) { 1021 CFX_ByteTextBuf sAP; 1022 sAP << "q\n" 1023 << CPWL_Utils::GetColorAppStream(crText, true) 1024 << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; 1025 return sAP.MakeString(); 1026} 1027 1028CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, 1029 int32_t nStyle, 1030 const CPWL_Color& crText) { 1031 CFX_FloatRect rcCenter = GetCenterSquare(rcBBox); 1032 switch (nStyle) { 1033 default: 1034 case PCS_CHECK: 1035 return GetAppStream_Check(rcCenter, crText); 1036 case PCS_CIRCLE: 1037 return GetAppStream_Circle(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1038 case PCS_CROSS: 1039 return GetAppStream_Cross(rcCenter, crText); 1040 case PCS_DIAMOND: 1041 return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1042 case PCS_SQUARE: 1043 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1044 case PCS_STAR: 1045 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1046 } 1047} 1048 1049CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CFX_FloatRect& rcBBox, 1050 int32_t nStyle, 1051 const CPWL_Color& crText) { 1052 CFX_FloatRect rcCenter = GetCenterSquare(rcBBox); 1053 switch (nStyle) { 1054 default: 1055 case PCS_CHECK: 1056 return GetAppStream_Check(rcCenter, crText); 1057 case PCS_CIRCLE: 1058 return GetAppStream_Circle(ScaleRect(rcCenter, 1.0f / 2.0f), crText); 1059 case PCS_CROSS: 1060 return GetAppStream_Cross(rcCenter, crText); 1061 case PCS_DIAMOND: 1062 return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1063 case PCS_SQUARE: 1064 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1065 case PCS_STAR: 1066 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1067 } 1068} 1069 1070CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { 1071 CFX_ByteTextBuf sAppStream; 1072 1073 if (!rcBBox.IsEmpty()) { 1074 sAppStream << "q\n" 1075 << CPWL_Utils::GetColorAppStream( 1076 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 1077 220.0f / 255.0f, 220.0f / 255.0f), 1078 true); 1079 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " 1080 << rcBBox.right - rcBBox.left << " " 1081 << rcBBox.top - rcBBox.bottom << " re f\n"; 1082 sAppStream << "Q\n"; 1083 1084 sAppStream << "q\n" 1085 << CPWL_Utils::GetBorderAppStream( 1086 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0), 1087 CPWL_Color(COLORTYPE_GRAY, 1), 1088 CPWL_Color(COLORTYPE_GRAY, 0.5), BorderStyle::BEVELED, 1089 CPWL_Dash(3, 0, 0)) 1090 << "Q\n"; 1091 1092 CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2, 1093 (rcBBox.top + rcBBox.bottom) / 2); 1094 if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && 1095 IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { 1096 sAppStream << "q\n" 1097 << " 0 g\n"; 1098 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " m\n"; 1099 sAppStream << ptCenter.x + 3 << " " << ptCenter.y + 1.5f << " l\n"; 1100 sAppStream << ptCenter.x << " " << ptCenter.y - 1.5f << " l\n"; 1101 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " l f\n"; 1102 sAppStream << "Q\n"; 1103 } 1104 } 1105 1106 return sAppStream.MakeString(); 1107} 1108 1109void CPWL_Utils::ConvertCMYK2GRAY(FX_FLOAT dC, 1110 FX_FLOAT dM, 1111 FX_FLOAT dY, 1112 FX_FLOAT dK, 1113 FX_FLOAT& dGray) { 1114 if (dC < 0 || dC > 1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 || 1115 dK > 1) 1116 return; 1117 dGray = 1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK); 1118} 1119 1120void CPWL_Utils::ConvertGRAY2CMYK(FX_FLOAT dGray, 1121 FX_FLOAT& dC, 1122 FX_FLOAT& dM, 1123 FX_FLOAT& dY, 1124 FX_FLOAT& dK) { 1125 if (dGray < 0 || dGray > 1) 1126 return; 1127 dC = 0.0f; 1128 dM = 0.0f; 1129 dY = 0.0f; 1130 dK = 1.0f - dGray; 1131} 1132 1133void CPWL_Utils::ConvertGRAY2RGB(FX_FLOAT dGray, 1134 FX_FLOAT& dR, 1135 FX_FLOAT& dG, 1136 FX_FLOAT& dB) { 1137 if (dGray < 0 || dGray > 1) 1138 return; 1139 dR = dGray; 1140 dG = dGray; 1141 dB = dGray; 1142} 1143 1144void CPWL_Utils::ConvertRGB2GRAY(FX_FLOAT dR, 1145 FX_FLOAT dG, 1146 FX_FLOAT dB, 1147 FX_FLOAT& dGray) { 1148 if (dR < 0 || dR > 1 || dG < 0 || dG > 0 || dB < 0 || dB > 1) 1149 return; 1150 dGray = 0.3f * dR + 0.59f * dG + 0.11f * dB; 1151} 1152 1153void CPWL_Utils::ConvertCMYK2RGB(FX_FLOAT dC, 1154 FX_FLOAT dM, 1155 FX_FLOAT dY, 1156 FX_FLOAT dK, 1157 FX_FLOAT& dR, 1158 FX_FLOAT& dG, 1159 FX_FLOAT& dB) { 1160 if (dC < 0 || dC > 1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 || 1161 dK > 1) 1162 return; 1163 dR = 1.0f - std::min(1.0f, dC + dK); 1164 dG = 1.0f - std::min(1.0f, dM + dK); 1165 dB = 1.0f - std::min(1.0f, dY + dK); 1166} 1167 1168void CPWL_Utils::ConvertRGB2CMYK(FX_FLOAT dR, 1169 FX_FLOAT dG, 1170 FX_FLOAT dB, 1171 FX_FLOAT& dC, 1172 FX_FLOAT& dM, 1173 FX_FLOAT& dY, 1174 FX_FLOAT& dK) { 1175 if (dR < 0 || dR > 1 || dG < 0 || dG > 1 || dB < 0 || dB > 1) 1176 return; 1177 1178 dC = 1.0f - dR; 1179 dM = 1.0f - dG; 1180 dY = 1.0f - dB; 1181 dK = std::min(dC, std::min(dM, dY)); 1182} 1183 1184void CPWL_Utils::PWLColorToARGB(const CPWL_Color& color, 1185 int32_t& alpha, 1186 FX_FLOAT& red, 1187 FX_FLOAT& green, 1188 FX_FLOAT& blue) { 1189 switch (color.nColorType) { 1190 case COLORTYPE_TRANSPARENT: { 1191 alpha = 0; 1192 } break; 1193 case COLORTYPE_GRAY: { 1194 ConvertGRAY2RGB(color.fColor1, red, green, blue); 1195 } break; 1196 case COLORTYPE_RGB: { 1197 red = color.fColor1; 1198 green = color.fColor2; 1199 blue = color.fColor3; 1200 } break; 1201 case COLORTYPE_CMYK: { 1202 ConvertCMYK2RGB(color.fColor1, color.fColor2, color.fColor3, 1203 color.fColor4, red, green, blue); 1204 } break; 1205 } 1206} 1207 1208FX_COLORREF CPWL_Utils::PWLColorToFXColor(const CPWL_Color& color, 1209 int32_t nTransparancy) { 1210 int32_t nAlpha = nTransparancy; 1211 FX_FLOAT dRed = 0; 1212 FX_FLOAT dGreen = 0; 1213 FX_FLOAT dBlue = 0; 1214 1215 PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue); 1216 1217 return ArgbEncode(nAlpha, (int32_t)(dRed * 255), (int32_t)(dGreen * 255), 1218 (int32_t)(dBlue * 255)); 1219} 1220 1221void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, 1222 CFX_Matrix* pUser2Device, 1223 const CFX_FloatRect& rect, 1224 const FX_COLORREF& color) { 1225 CFX_PathData path; 1226 CFX_FloatRect rcTemp(rect); 1227 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); 1228 pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_WINDING); 1229} 1230 1231void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, 1232 CFX_Matrix* pUser2Device, 1233 const CFX_FloatPoint* pPts, 1234 int32_t nCount, 1235 const FX_COLORREF& color) { 1236 CFX_PathData path; 1237 path.SetPointCount(nCount); 1238 1239 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO); 1240 for (int32_t i = 1; i < nCount; i++) 1241 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO); 1242 1243 pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_ALTERNATE); 1244} 1245 1246void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, 1247 CFX_Matrix* pUser2Device, 1248 const CFX_FloatRect& rect, 1249 const FX_COLORREF& color, 1250 FX_FLOAT fWidth) { 1251 CFX_PathData path; 1252 CFX_FloatRect rcTemp(rect); 1253 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); 1254 1255 CFX_GraphStateData gsd; 1256 gsd.m_LineWidth = fWidth; 1257 1258 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE); 1259} 1260 1261void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, 1262 CFX_Matrix* pUser2Device, 1263 const CFX_FloatPoint& ptMoveTo, 1264 const CFX_FloatPoint& ptLineTo, 1265 const FX_COLORREF& color, 1266 FX_FLOAT fWidth) { 1267 CFX_PathData path; 1268 path.SetPointCount(2); 1269 path.SetPoint(0, ptMoveTo.x, ptMoveTo.y, FXPT_MOVETO); 1270 path.SetPoint(1, ptLineTo.x, ptLineTo.y, FXPT_LINETO); 1271 1272 CFX_GraphStateData gsd; 1273 gsd.m_LineWidth = fWidth; 1274 1275 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE); 1276} 1277 1278void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, 1279 CFX_Matrix* pUser2Device, 1280 const CFX_FloatRect& rect, 1281 const CPWL_Color& color, 1282 int32_t nTransparancy) { 1283 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect, 1284 PWLColorToFXColor(color, nTransparancy)); 1285} 1286 1287void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, 1288 CFX_Matrix* pUser2Device, 1289 bool bVertical, 1290 bool bHorizontal, 1291 CFX_FloatRect rect, 1292 int32_t nTransparancy, 1293 int32_t nStartGray, 1294 int32_t nEndGray) { 1295 FX_FLOAT fStepGray = 1.0f; 1296 1297 if (bVertical) { 1298 fStepGray = (nEndGray - nStartGray) / rect.Height(); 1299 1300 for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { 1301 int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom)); 1302 CPWL_Utils::DrawStrokeLine( 1303 pDevice, pUser2Device, CFX_FloatPoint(rect.left, fy), 1304 CFX_FloatPoint(rect.right, fy), 1305 ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); 1306 } 1307 } 1308 1309 if (bHorizontal) { 1310 fStepGray = (nEndGray - nStartGray) / rect.Width(); 1311 1312 for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { 1313 int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left)); 1314 CPWL_Utils::DrawStrokeLine( 1315 pDevice, pUser2Device, CFX_FloatPoint(fx, rect.bottom), 1316 CFX_FloatPoint(fx, rect.top), 1317 ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); 1318 } 1319 } 1320} 1321 1322void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, 1323 CFX_Matrix* pUser2Device, 1324 const CFX_FloatRect& rect, 1325 FX_FLOAT fWidth, 1326 const CPWL_Color& color, 1327 const CPWL_Color& crLeftTop, 1328 const CPWL_Color& crRightBottom, 1329 BorderStyle nStyle, 1330 int32_t nTransparancy) { 1331 FX_FLOAT fLeft = rect.left; 1332 FX_FLOAT fRight = rect.right; 1333 FX_FLOAT fTop = rect.top; 1334 FX_FLOAT fBottom = rect.bottom; 1335 1336 if (fWidth > 0.0f) { 1337 FX_FLOAT fHalfWidth = fWidth / 2.0f; 1338 1339 switch (nStyle) { 1340 default: 1341 case BorderStyle::SOLID: { 1342 CFX_PathData path; 1343 path.AppendRect(fLeft, fBottom, fRight, fTop); 1344 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, 1345 fTop - fWidth); 1346 pDevice->DrawPath(&path, pUser2Device, nullptr, 1347 PWLColorToFXColor(color, nTransparancy), 0, 1348 FXFILL_ALTERNATE); 1349 break; 1350 } 1351 case BorderStyle::DASH: { 1352 CFX_PathData path; 1353 1354 path.SetPointCount(5); 1355 path.SetPoint(0, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, 1356 FXPT_MOVETO); 1357 path.SetPoint(1, fLeft + fWidth / 2.0f, fTop - fWidth / 2.0f, 1358 FXPT_LINETO); 1359 path.SetPoint(2, fRight - fWidth / 2.0f, fTop - fWidth / 2.0f, 1360 FXPT_LINETO); 1361 path.SetPoint(3, fRight - fWidth / 2.0f, fBottom + fWidth / 2.0f, 1362 FXPT_LINETO); 1363 path.SetPoint(4, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, 1364 FXPT_LINETO); 1365 1366 CFX_GraphStateData gsd; 1367 gsd.SetDashCount(2); 1368 gsd.m_DashArray[0] = 3.0f; 1369 gsd.m_DashArray[1] = 3.0f; 1370 gsd.m_DashPhase = 0; 1371 1372 gsd.m_LineWidth = fWidth; 1373 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, 1374 PWLColorToFXColor(color, nTransparancy), 1375 FXFILL_WINDING); 1376 break; 1377 } 1378 case BorderStyle::BEVELED: 1379 case BorderStyle::INSET: { 1380 CFX_GraphStateData gsd; 1381 gsd.m_LineWidth = fHalfWidth; 1382 1383 CFX_PathData pathLT; 1384 1385 pathLT.SetPointCount(7); 1386 pathLT.SetPoint(0, fLeft + fHalfWidth, fBottom + fHalfWidth, 1387 FXPT_MOVETO); 1388 pathLT.SetPoint(1, fLeft + fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); 1389 pathLT.SetPoint(2, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); 1390 pathLT.SetPoint(3, fRight - fHalfWidth * 2, fTop - fHalfWidth * 2, 1391 FXPT_LINETO); 1392 pathLT.SetPoint(4, fLeft + fHalfWidth * 2, fTop - fHalfWidth * 2, 1393 FXPT_LINETO); 1394 pathLT.SetPoint(5, fLeft + fHalfWidth * 2, fBottom + fHalfWidth * 2, 1395 FXPT_LINETO); 1396 pathLT.SetPoint(6, fLeft + fHalfWidth, fBottom + fHalfWidth, 1397 FXPT_LINETO); 1398 1399 pDevice->DrawPath(&pathLT, pUser2Device, &gsd, 1400 PWLColorToFXColor(crLeftTop, nTransparancy), 0, 1401 FXFILL_ALTERNATE); 1402 1403 CFX_PathData pathRB; 1404 1405 pathRB.SetPointCount(7); 1406 pathRB.SetPoint(0, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_MOVETO); 1407 pathRB.SetPoint(1, fRight - fHalfWidth, fBottom + fHalfWidth, 1408 FXPT_LINETO); 1409 pathRB.SetPoint(2, fLeft + fHalfWidth, fBottom + fHalfWidth, 1410 FXPT_LINETO); 1411 pathRB.SetPoint(3, fLeft + fHalfWidth * 2, fBottom + fHalfWidth * 2, 1412 FXPT_LINETO); 1413 pathRB.SetPoint(4, fRight - fHalfWidth * 2, fBottom + fHalfWidth * 2, 1414 FXPT_LINETO); 1415 pathRB.SetPoint(5, fRight - fHalfWidth * 2, fTop - fHalfWidth * 2, 1416 FXPT_LINETO); 1417 pathRB.SetPoint(6, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); 1418 1419 pDevice->DrawPath(&pathRB, pUser2Device, &gsd, 1420 PWLColorToFXColor(crRightBottom, nTransparancy), 0, 1421 FXFILL_ALTERNATE); 1422 1423 CFX_PathData path; 1424 1425 path.AppendRect(fLeft, fBottom, fRight, fTop); 1426 path.AppendRect(fLeft + fHalfWidth, fBottom + fHalfWidth, 1427 fRight - fHalfWidth, fTop - fHalfWidth); 1428 1429 pDevice->DrawPath(&path, pUser2Device, &gsd, 1430 PWLColorToFXColor(color, nTransparancy), 0, 1431 FXFILL_ALTERNATE); 1432 break; 1433 } 1434 case BorderStyle::UNDERLINE: { 1435 CFX_PathData path; 1436 1437 path.SetPointCount(2); 1438 path.SetPoint(0, fLeft, fBottom + fWidth / 2, FXPT_MOVETO); 1439 path.SetPoint(1, fRight, fBottom + fWidth / 2, FXPT_LINETO); 1440 1441 CFX_GraphStateData gsd; 1442 gsd.m_LineWidth = fWidth; 1443 1444 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, 1445 PWLColorToFXColor(color, nTransparancy), 1446 FXFILL_ALTERNATE); 1447 break; 1448 } 1449 } 1450 } 1451} 1452 1453bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { 1454 switch (color.nColorType) { 1455 case COLORTYPE_TRANSPARENT: 1456 return false; 1457 case COLORTYPE_GRAY: 1458 return color.fColor1 < 0.5f; 1459 case COLORTYPE_RGB: 1460 return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f; 1461 case COLORTYPE_CMYK: 1462 return color.fColor1 + color.fColor2 + color.fColor3 + color.fColor4 > 1463 2.0f; 1464 } 1465 1466 return true; 1467} 1468 1469CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) { 1470 CPWL_Color crRet = color; 1471 1472 switch (color.nColorType) { 1473 case COLORTYPE_GRAY: 1474 crRet.fColor1 = 1.0f - crRet.fColor1; 1475 break; 1476 case COLORTYPE_RGB: 1477 crRet.fColor1 = 1.0f - crRet.fColor1; 1478 crRet.fColor2 = 1.0f - crRet.fColor2; 1479 crRet.fColor3 = 1.0f - crRet.fColor3; 1480 break; 1481 case COLORTYPE_CMYK: 1482 crRet.fColor1 = 1.0f - crRet.fColor1; 1483 crRet.fColor2 = 1.0f - crRet.fColor2; 1484 crRet.fColor3 = 1.0f - crRet.fColor3; 1485 crRet.fColor4 = 1.0f - crRet.fColor4; 1486 break; 1487 } 1488 1489 return crRet; 1490} 1491 1492CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, 1493 const CFX_FloatRect& rect, 1494 const CPWL_Color& crFill, 1495 const CPWL_Color& crStroke) { 1496 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, false); 1497 sAppStream += CPWL_Utils::GetColorAppStream(crFill, true); 1498 1499 CFX_ByteString sPath; 1500 CFX_PathData path; 1501 1502 switch (nType) { 1503 case PWL_ICONTYPE_CHECKMARK: 1504 GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); 1505 break; 1506 case PWL_ICONTYPE_CIRCLE: 1507 GetGraphics_Circle(sPath, path, rect, PWLPT_STREAM); 1508 break; 1509 case PWL_ICONTYPE_COMMENT: 1510 GetGraphics_Comment(sPath, path, rect, PWLPT_STREAM); 1511 break; 1512 case PWL_ICONTYPE_CROSS: 1513 GetGraphics_Cross(sPath, path, rect, PWLPT_STREAM); 1514 break; 1515 case PWL_ICONTYPE_HELP: 1516 GetGraphics_Help(sPath, path, rect, PWLPT_STREAM); 1517 break; 1518 case PWL_ICONTYPE_INSERTTEXT: 1519 GetGraphics_InsertText(sPath, path, rect, PWLPT_STREAM); 1520 break; 1521 case PWL_ICONTYPE_KEY: 1522 GetGraphics_Key(sPath, path, rect, PWLPT_STREAM); 1523 break; 1524 case PWL_ICONTYPE_NEWPARAGRAPH: 1525 GetGraphics_NewParagraph(sPath, path, rect, PWLPT_STREAM); 1526 break; 1527 case PWL_ICONTYPE_TEXTNOTE: 1528 GetGraphics_TextNote(sPath, path, rect, PWLPT_STREAM); 1529 break; 1530 case PWL_ICONTYPE_PARAGRAPH: 1531 GetGraphics_Paragraph(sPath, path, rect, PWLPT_STREAM); 1532 break; 1533 case PWL_ICONTYPE_RIGHTARROW: 1534 GetGraphics_RightArrow(sPath, path, rect, PWLPT_STREAM); 1535 break; 1536 case PWL_ICONTYPE_RIGHTPOINTER: 1537 GetGraphics_RightPointer(sPath, path, rect, PWLPT_STREAM); 1538 break; 1539 case PWL_ICONTYPE_STAR: 1540 GetGraphics_Star(sPath, path, rect, PWLPT_STREAM); 1541 break; 1542 case PWL_ICONTYPE_UPARROW: 1543 GetGraphics_UpArrow(sPath, path, rect, PWLPT_STREAM); 1544 break; 1545 case PWL_ICONTYPE_UPLEFTARROW: 1546 GetGraphics_UpLeftArrow(sPath, path, rect, PWLPT_STREAM); 1547 break; 1548 case PWL_ICONTYPE_GRAPH: 1549 GetGraphics_Graph(sPath, path, rect, PWLPT_STREAM); 1550 break; 1551 case PWL_ICONTYPE_PAPERCLIP: 1552 GetGraphics_Paperclip(sPath, path, rect, PWLPT_STREAM); 1553 break; 1554 case PWL_ICONTYPE_ATTACHMENT: 1555 GetGraphics_Attachment(sPath, path, rect, PWLPT_STREAM); 1556 break; 1557 case PWL_ICONTYPE_TAG: 1558 GetGraphics_Tag(sPath, path, rect, PWLPT_STREAM); 1559 break; 1560 case PWL_ICONTYPE_FOXIT: 1561 GetGraphics_Foxit(sPath, path, rect, PWLPT_STREAM); 1562 break; 1563 } 1564 1565 sAppStream += sPath; 1566 if (crStroke.nColorType != COLORTYPE_TRANSPARENT) 1567 sAppStream += "B*\n"; 1568 else 1569 sAppStream += "f*\n"; 1570 1571 return sAppStream; 1572} 1573 1574void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, 1575 CFX_Matrix* pUser2Device, 1576 int32_t nType, 1577 const CFX_FloatRect& rect, 1578 const CPWL_Color& crFill, 1579 const CPWL_Color& crStroke, 1580 const int32_t nTransparancy) { 1581 CFX_GraphStateData gsd; 1582 gsd.m_LineWidth = 1.0f; 1583 1584 CFX_ByteString sPath; 1585 CFX_PathData path; 1586 1587 switch (nType) { 1588 case PWL_ICONTYPE_CHECKMARK: 1589 GetGraphics_Checkmark(sPath, path, rect, PWLPT_PATHDATA); 1590 break; 1591 case PWL_ICONTYPE_CIRCLE: 1592 GetGraphics_Circle(sPath, path, rect, PWLPT_PATHDATA); 1593 break; 1594 case PWL_ICONTYPE_COMMENT: 1595 GetGraphics_Comment(sPath, path, rect, PWLPT_PATHDATA); 1596 break; 1597 case PWL_ICONTYPE_CROSS: 1598 GetGraphics_Cross(sPath, path, rect, PWLPT_PATHDATA); 1599 break; 1600 case PWL_ICONTYPE_HELP: 1601 GetGraphics_Help(sPath, path, rect, PWLPT_PATHDATA); 1602 break; 1603 case PWL_ICONTYPE_INSERTTEXT: 1604 GetGraphics_InsertText(sPath, path, rect, PWLPT_PATHDATA); 1605 break; 1606 case PWL_ICONTYPE_KEY: 1607 GetGraphics_Key(sPath, path, rect, PWLPT_PATHDATA); 1608 break; 1609 case PWL_ICONTYPE_NEWPARAGRAPH: 1610 GetGraphics_NewParagraph(sPath, path, rect, PWLPT_PATHDATA); 1611 break; 1612 case PWL_ICONTYPE_TEXTNOTE: 1613 GetGraphics_TextNote(sPath, path, rect, PWLPT_PATHDATA); 1614 break; 1615 case PWL_ICONTYPE_PARAGRAPH: 1616 GetGraphics_Paragraph(sPath, path, rect, PWLPT_PATHDATA); 1617 break; 1618 case PWL_ICONTYPE_RIGHTARROW: 1619 GetGraphics_RightArrow(sPath, path, rect, PWLPT_PATHDATA); 1620 break; 1621 case PWL_ICONTYPE_RIGHTPOINTER: 1622 GetGraphics_RightPointer(sPath, path, rect, PWLPT_PATHDATA); 1623 break; 1624 case PWL_ICONTYPE_STAR: 1625 GetGraphics_Star(sPath, path, rect, PWLPT_PATHDATA); 1626 break; 1627 case PWL_ICONTYPE_UPARROW: 1628 GetGraphics_UpArrow(sPath, path, rect, PWLPT_PATHDATA); 1629 break; 1630 case PWL_ICONTYPE_UPLEFTARROW: 1631 GetGraphics_UpLeftArrow(sPath, path, rect, PWLPT_PATHDATA); 1632 break; 1633 case PWL_ICONTYPE_GRAPH: 1634 GetGraphics_Graph(sPath, path, rect, PWLPT_PATHDATA); 1635 break; 1636 case PWL_ICONTYPE_PAPERCLIP: 1637 GetGraphics_Paperclip(sPath, path, rect, PWLPT_PATHDATA); 1638 break; 1639 case PWL_ICONTYPE_ATTACHMENT: 1640 GetGraphics_Attachment(sPath, path, rect, PWLPT_PATHDATA); 1641 break; 1642 case PWL_ICONTYPE_TAG: 1643 GetGraphics_Tag(sPath, path, rect, PWLPT_PATHDATA); 1644 break; 1645 case PWL_ICONTYPE_FOXIT: 1646 GetGraphics_Foxit(sPath, path, rect, PWLPT_PATHDATA); 1647 break; 1648 default: 1649 return; 1650 } 1651 1652 pDevice->DrawPath( 1653 &path, pUser2Device, &gsd, PWLColorToFXColor(crFill, nTransparancy), 1654 PWLColorToFXColor(crStroke, nTransparancy), FXFILL_ALTERNATE); 1655} 1656 1657void CPWL_Utils::GetGraphics_Checkmark(CFX_ByteString& sPathData, 1658 CFX_PathData& path, 1659 const CFX_FloatRect& crBBox, 1660 const PWL_PATH_TYPE type) { 1661 FX_FLOAT fWidth = crBBox.right - crBBox.left; 1662 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 1663 1664 CPWL_PathData PathArray[] = { 1665 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1666 crBBox.bottom + fHeight * 2 / 5.0f), 1667 PWLPT_MOVETO), 1668 CPWL_PathData( 1669 CPWL_Point(crBBox.left + fWidth / 15.0f + 1670 FX_BEZIER * (fWidth / 7.0f - fWidth / 15.0f), 1671 crBBox.bottom + fHeight * 2 / 5.0f + 1672 FX_BEZIER * (fHeight * 2 / 7.0f - fHeight * 2 / 5.0f)), 1673 PWLPT_BEZIERTO), 1674 CPWL_PathData( 1675 CPWL_Point(crBBox.left + fWidth / 4.5f + 1676 FX_BEZIER * (fWidth / 5.0f - fWidth / 4.5f), 1677 crBBox.bottom + fHeight / 16.0f + 1678 FX_BEZIER * (fHeight / 5.0f - fHeight / 16.0f)), 1679 PWLPT_BEZIERTO), 1680 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 4.5f, 1681 crBBox.bottom + fHeight / 16.0f), 1682 PWLPT_BEZIERTO), 1683 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 4.5f + 1684 FX_BEZIER * (fWidth / 4.4f - fWidth / 4.5f), 1685 crBBox.bottom + fHeight / 16.0f - 1686 FX_BEZIER * fHeight / 16.0f), 1687 PWLPT_BEZIERTO), 1688 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.0f + 1689 FX_BEZIER * (fWidth / 4.0f - fWidth / 3.0f), 1690 crBBox.bottom), 1691 PWLPT_BEZIERTO), 1692 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.0f, crBBox.bottom), 1693 PWLPT_BEZIERTO), 1694 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.0f + 1695 FX_BEZIER * fWidth * (1 / 7.0f + 2 / 15.0f), 1696 crBBox.bottom + FX_BEZIER * fHeight * 4 / 5.0f), 1697 PWLPT_BEZIERTO), 1698 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 14 / 15.0f + 1699 FX_BEZIER * fWidth * (1 / 7.0f - 7 / 15.0f), 1700 crBBox.bottom + fHeight * 15 / 16.0f + 1701 FX_BEZIER * (fHeight * 4 / 5.0f - 1702 fHeight * 15 / 16.0f)), 1703 PWLPT_BEZIERTO), 1704 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 14 / 15.0f, 1705 crBBox.bottom + fHeight * 15 / 16.0f), 1706 PWLPT_BEZIERTO), 1707 CPWL_PathData( 1708 CPWL_Point( 1709 crBBox.left + fWidth * 14 / 15.0f + 1710 FX_BEZIER * (fWidth * 7 / 15.0f - fWidth * 14 / 15.0f), 1711 crBBox.bottom + fHeight * 15 / 16.0f + 1712 FX_BEZIER * (fHeight * 8 / 7.0f - fHeight * 15 / 16.0f)), 1713 PWLPT_BEZIERTO), 1714 CPWL_PathData( 1715 CPWL_Point(crBBox.left + fWidth / 3.6f + 1716 FX_BEZIER * (fWidth / 3.4f - fWidth / 3.6f), 1717 crBBox.bottom + fHeight / 3.5f + 1718 FX_BEZIER * (fHeight / 3.5f - fHeight / 3.5f)), 1719 PWLPT_BEZIERTO), 1720 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.6f, 1721 crBBox.bottom + fHeight / 3.5f), 1722 PWLPT_BEZIERTO), 1723 CPWL_PathData( 1724 CPWL_Point(crBBox.left + fWidth / 3.6f, 1725 crBBox.bottom + fHeight / 3.5f + 1726 FX_BEZIER * (fHeight / 4.0f - fHeight / 3.5f)), 1727 PWLPT_BEZIERTO), 1728 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f + 1729 FX_BEZIER * (fWidth / 3.5f - fWidth / 15.0f), 1730 crBBox.bottom + fHeight * 2 / 5.0f + 1731 FX_BEZIER * (fHeight * 3.5f / 5.0f - 1732 fHeight * 2 / 5.0f)), 1733 PWLPT_BEZIERTO), 1734 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1735 crBBox.bottom + fHeight * 2 / 5.0f), 1736 PWLPT_BEZIERTO)}; 1737 1738 if (type == PWLPT_STREAM) 1739 sPathData = GetAppStreamFromArray(PathArray, 16); 1740 else 1741 GetPathDataFromArray(path, PathArray, 16); 1742} 1743 1744void CPWL_Utils::GetGraphics_Circle(CFX_ByteString& sPathData, 1745 CFX_PathData& path, 1746 const CFX_FloatRect& crBBox, 1747 const PWL_PATH_TYPE type) { 1748 FX_FLOAT fWidth = crBBox.right - crBBox.left; 1749 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 1750 1751 CPWL_PathData PathArray[] = { 1752 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1753 crBBox.bottom + fHeight / 2.0f), 1754 PWLPT_MOVETO), 1755 CPWL_PathData( 1756 CPWL_Point(crBBox.left + fWidth / 15.0f, 1757 crBBox.bottom + fHeight / 2.0f + 1758 FX_BEZIER * (fHeight * 14 / 15.0f - fHeight / 2.0f)), 1759 PWLPT_BEZIERTO), 1760 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f - 1761 FX_BEZIER * (fWidth / 2.0f - fWidth / 15.0f), 1762 crBBox.top - fHeight / 15.0f), 1763 PWLPT_BEZIERTO), 1764 CPWL_PathData( 1765 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 1766 PWLPT_BEZIERTO), 1767 CPWL_PathData( 1768 CPWL_Point(crBBox.left + fWidth / 2.0f + 1769 FX_BEZIER * (fWidth * 14 / 15.0f - fWidth / 2.0f), 1770 crBBox.top - fHeight / 15.0f), 1771 PWLPT_BEZIERTO), 1772 CPWL_PathData( 1773 CPWL_Point(crBBox.right - fWidth / 15.0f, 1774 crBBox.bottom + fHeight / 2.0f + 1775 FX_BEZIER * (fHeight * 14 / 15.0f - fHeight / 2.0f)), 1776 PWLPT_BEZIERTO), 1777 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 1778 crBBox.bottom + fHeight / 2.0f), 1779 PWLPT_BEZIERTO), 1780 CPWL_PathData( 1781 CPWL_Point(crBBox.right - fWidth / 15.0f, 1782 crBBox.bottom + fHeight / 2.0f - 1783 FX_BEZIER * (fHeight / 2.0f - fHeight / 15.0f)), 1784 PWLPT_BEZIERTO), 1785 CPWL_PathData( 1786 CPWL_Point(crBBox.left + fWidth / 2.0f + 1787 FX_BEZIER * (fWidth * 14 / 15.0f - fWidth / 2.0f), 1788 crBBox.bottom + fHeight / 15.0f), 1789 PWLPT_BEZIERTO), 1790 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 1791 crBBox.bottom + fHeight / 15.0f), 1792 PWLPT_BEZIERTO), 1793 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f - 1794 FX_BEZIER * (fWidth / 2.0f - fWidth / 15.0f), 1795 crBBox.bottom + fHeight / 15.0f), 1796 PWLPT_BEZIERTO), 1797 CPWL_PathData( 1798 CPWL_Point(crBBox.left + fWidth / 15.0f, 1799 crBBox.bottom + fHeight / 2.0f - 1800 FX_BEZIER * (fHeight / 2.0f - fHeight / 15.0f)), 1801 PWLPT_BEZIERTO), 1802 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1803 crBBox.bottom + fHeight / 2.0f), 1804 PWLPT_BEZIERTO), 1805 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 3 / 15.0f, 1806 crBBox.bottom + fHeight / 2.0f), 1807 PWLPT_MOVETO), 1808 CPWL_PathData( 1809 CPWL_Point(crBBox.left + fWidth * 3 / 15.0f, 1810 crBBox.bottom + fHeight / 2.0f + 1811 FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)), 1812 PWLPT_BEZIERTO), 1813 CPWL_PathData( 1814 CPWL_Point(crBBox.left + fWidth / 2.0f - 1815 FX_BEZIER * (fWidth / 2.0f - fWidth * 3 / 15.0f), 1816 crBBox.top - fHeight * 3 / 15.0f), 1817 PWLPT_BEZIERTO), 1818 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 1819 crBBox.top - fHeight * 3 / 15.0f), 1820 PWLPT_BEZIERTO), 1821 CPWL_PathData( 1822 CPWL_Point(crBBox.left + fWidth / 2.0f + 1823 FX_BEZIER * (fWidth * 4 / 5.0f - fWidth / 2.0f), 1824 crBBox.top - fHeight * 3 / 15.0f), 1825 PWLPT_BEZIERTO), 1826 CPWL_PathData( 1827 CPWL_Point(crBBox.right - fWidth * 3 / 15.0f, 1828 crBBox.bottom + fHeight / 2.0f + 1829 FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)), 1830 PWLPT_BEZIERTO), 1831 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 15.0f, 1832 crBBox.bottom + fHeight / 2.0f), 1833 PWLPT_BEZIERTO), 1834 CPWL_PathData( 1835 CPWL_Point(crBBox.right - fWidth * 3 / 15.0f, 1836 crBBox.bottom + fHeight / 2.0f - 1837 FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)), 1838 PWLPT_BEZIERTO), 1839 CPWL_PathData( 1840 CPWL_Point(crBBox.left + fWidth / 2.0f + 1841 FX_BEZIER * (fWidth * 4 / 5.0f - fWidth / 2.0f), 1842 crBBox.bottom + fHeight * 3 / 15.0f), 1843 PWLPT_BEZIERTO), 1844 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 1845 crBBox.bottom + fHeight * 3 / 15.0f), 1846 PWLPT_BEZIERTO), 1847 CPWL_PathData( 1848 CPWL_Point(crBBox.left + fWidth / 2.0f - 1849 FX_BEZIER * (fWidth * 4 / 5.0f - fWidth / 2.0f), 1850 crBBox.bottom + fHeight * 3 / 15.0f), 1851 PWLPT_BEZIERTO), 1852 CPWL_PathData( 1853 CPWL_Point(crBBox.left + fWidth * 3 / 15.0f, 1854 crBBox.bottom + fHeight / 2.0f - 1855 FX_BEZIER * (fHeight * 4 / 5.0f - fHeight / 2.0f)), 1856 PWLPT_BEZIERTO), 1857 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 3 / 15.0f, 1858 crBBox.bottom + fHeight / 2.0f), 1859 PWLPT_BEZIERTO)}; 1860 1861 if (type == PWLPT_STREAM) 1862 sPathData = GetAppStreamFromArray(PathArray, 26); 1863 else 1864 GetPathDataFromArray(path, PathArray, 26); 1865} 1866 1867void CPWL_Utils::GetGraphics_Comment(CFX_ByteString& sPathData, 1868 CFX_PathData& path, 1869 const CFX_FloatRect& crBBox, 1870 const PWL_PATH_TYPE type) { 1871 FX_FLOAT fWidth = crBBox.right - crBBox.left; 1872 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 1873 1874 CPWL_PathData PathArray[] = { 1875 CPWL_PathData( 1876 CPWL_Point(crBBox.left + fWidth / 15.0f, crBBox.top - fHeight / 6.0f), 1877 PWLPT_MOVETO), 1878 CPWL_PathData( 1879 CPWL_Point(crBBox.left + fWidth / 15.0f, 1880 crBBox.top - fHeight / 6.0f + 1881 FX_BEZIER * (fHeight / 6.0f - fHeight / 10.0f)), 1882 PWLPT_BEZIERTO), 1883 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15.0f - 1884 FX_BEZIER * fWidth / 15.0f, 1885 crBBox.top - fHeight / 10.0f), 1886 PWLPT_BEZIERTO), 1887 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15.0f, 1888 crBBox.top - fHeight / 10.0f), 1889 PWLPT_BEZIERTO), 1890 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 2 / 15.0f, 1891 crBBox.top - fHeight / 10.0f), 1892 PWLPT_LINETO), 1893 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 2 / 15.0f + 1894 FX_BEZIER * fWidth / 15.0f, 1895 crBBox.top - fHeight / 10.0f), 1896 PWLPT_BEZIERTO), 1897 CPWL_PathData( 1898 CPWL_Point(crBBox.right - fWidth / 15.0f, 1899 crBBox.top - fHeight / 6 + 1900 FX_BEZIER * (fHeight / 6.0f - fHeight / 10.0f)), 1901 PWLPT_BEZIERTO), 1902 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 1903 crBBox.top - fHeight / 6.0f), 1904 PWLPT_BEZIERTO), 1905 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 1906 crBBox.bottom + fHeight / 3.0f), 1907 PWLPT_LINETO), 1908 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 1909 crBBox.bottom + fHeight * 4 / 15.0f + 1910 FX_BEZIER * fHeight / 15.0f), 1911 PWLPT_BEZIERTO), 1912 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 2 / 15.0f + 1913 FX_BEZIER * fWidth / 15.0f, 1914 crBBox.bottom + fHeight * 4 / 15.0f), 1915 PWLPT_BEZIERTO), 1916 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 2 / 15.0f, 1917 crBBox.bottom + fHeight * 4 / 15.0f), 1918 PWLPT_BEZIERTO), 1919 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 5 / 15.0f, 1920 crBBox.bottom + fHeight * 4 / 15.0f), 1921 PWLPT_LINETO), 1922 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 5 / 15.0f, 1923 crBBox.bottom + fHeight * 2 / 15 + 1924 FX_BEZIER * fHeight * 2 / 15.0f), 1925 PWLPT_BEZIERTO), 1926 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 5 / 15.0f - 1927 FX_BEZIER * fWidth * 2 / 15.0f, 1928 crBBox.bottom + fHeight * 2 / 15.0f), 1929 PWLPT_BEZIERTO), 1930 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 6 / 30.0f, 1931 crBBox.bottom + fHeight * 2 / 15.0f), 1932 PWLPT_BEZIERTO), 1933 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 7 / 30.0f + 1934 FX_BEZIER * fWidth / 30.0f, 1935 crBBox.bottom + fHeight * 2 / 15.0f), 1936 PWLPT_BEZIERTO), 1937 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 7 / 30.0f, 1938 crBBox.bottom + fHeight * 2 / 15.0f + 1939 FX_BEZIER * fHeight * 2 / 15.0f), 1940 PWLPT_BEZIERTO), 1941 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 7 / 30.0f, 1942 crBBox.bottom + fHeight * 4 / 15.0f), 1943 PWLPT_BEZIERTO), 1944 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15.0f, 1945 crBBox.bottom + fHeight * 4 / 15.0f), 1946 PWLPT_LINETO), 1947 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15.0f - 1948 FX_BEZIER * fWidth / 15.0f, 1949 crBBox.bottom + fHeight * 4 / 15.0f), 1950 PWLPT_BEZIERTO), 1951 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1952 crBBox.bottom + fHeight / 3.0f - 1953 FX_BEZIER * fHeight / 15.0f), 1954 PWLPT_BEZIERTO), 1955 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1956 crBBox.bottom + fHeight / 3.0f), 1957 PWLPT_BEZIERTO), 1958 CPWL_PathData( 1959 CPWL_Point(crBBox.left + fWidth / 15.0f, crBBox.top - fHeight / 6.0f), 1960 PWLPT_LINETO), 1961 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15.0f, 1962 crBBox.top - fHeight * 8 / 30.0f), 1963 PWLPT_MOVETO), 1964 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 2 / 15.0f, 1965 crBBox.top - fHeight * 8 / 30.0f), 1966 PWLPT_LINETO), 1967 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15, 1968 crBBox.top - fHeight * 25 / 60.0f), 1969 PWLPT_MOVETO), 1970 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 2 / 15.0f, 1971 crBBox.top - fHeight * 25 / 60.0f), 1972 PWLPT_LINETO), 1973 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 2 / 15.0f, 1974 crBBox.top - fHeight * 17 / 30.0f), 1975 PWLPT_MOVETO), 1976 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 4 / 15.0f, 1977 crBBox.top - fHeight * 17 / 30.0f), 1978 PWLPT_LINETO)}; 1979 1980 if (type == PWLPT_STREAM) 1981 sPathData = GetAppStreamFromArray(PathArray, 30); 1982 else 1983 GetPathDataFromArray(path, PathArray, 30); 1984} 1985 1986void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData, 1987 CFX_PathData& path, 1988 const CFX_FloatRect& crBBox, 1989 const PWL_PATH_TYPE type) { 1990 FX_FLOAT fWidth = crBBox.right - crBBox.left; 1991 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 1992 CPWL_Point center_point(crBBox.left + fWidth / 2, 1993 crBBox.bottom + fHeight / 2); 1994 1995 CPWL_PathData PathArray[] = { 1996 CPWL_PathData( 1997 CPWL_Point(center_point.x, center_point.y + fHeight / 10.0f), 1998 PWLPT_MOVETO), 1999 CPWL_PathData( 2000 CPWL_Point(center_point.x + fWidth * 0.3f, 2001 center_point.y + fHeight / 10.0f + fWidth * 0.3f), 2002 PWLPT_LINETO), 2003 CPWL_PathData(CPWL_Point(center_point.x + fWidth / 10.0f + fWidth * 0.3f, 2004 center_point.y + fHeight * 0.3f), 2005 PWLPT_LINETO), 2006 CPWL_PathData(CPWL_Point(center_point.x + fWidth / 10.0f, center_point.y), 2007 PWLPT_LINETO), 2008 CPWL_PathData(CPWL_Point(center_point.x + fWidth / 10.0f + fWidth * 0.3f, 2009 center_point.y - fHeight * 0.3f), 2010 PWLPT_LINETO), 2011 CPWL_PathData( 2012 CPWL_Point(center_point.x + fWidth * 0.3f, 2013 center_point.y - fHeight / 10.0f - fHeight * 0.3f), 2014 PWLPT_LINETO), 2015 CPWL_PathData( 2016 CPWL_Point(center_point.x, center_point.y - fHeight / 10.0f), 2017 PWLPT_LINETO), 2018 CPWL_PathData(CPWL_Point(center_point.x - fWidth * 0.3f, 2019 center_point.y - fHeight / 10 - fHeight * 0.3f), 2020 PWLPT_LINETO), 2021 CPWL_PathData(CPWL_Point(center_point.x - fWidth / 10.0f - fWidth * 0.3f, 2022 center_point.y - fHeight * 0.3f), 2023 PWLPT_LINETO), 2024 CPWL_PathData(CPWL_Point(center_point.x - fWidth / 10, center_point.y), 2025 PWLPT_LINETO), 2026 CPWL_PathData(CPWL_Point(center_point.x - fWidth / 10 - fWidth * 0.3f, 2027 center_point.y + fHeight * 0.3f), 2028 PWLPT_LINETO), 2029 CPWL_PathData( 2030 CPWL_Point(center_point.x - fWidth * 0.3f, 2031 center_point.y + fHeight / 10.0f + fHeight * 0.3f), 2032 PWLPT_LINETO), 2033 CPWL_PathData( 2034 CPWL_Point(center_point.x, center_point.y + fHeight / 10.0f), 2035 PWLPT_LINETO)}; 2036 2037 if (type == PWLPT_STREAM) 2038 sPathData = GetAppStreamFromArray(PathArray, 13); 2039 else 2040 GetPathDataFromArray(path, PathArray, 13); 2041} 2042 2043void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData, 2044 CFX_PathData& path, 2045 const CFX_FloatRect& crBBox, 2046 const PWL_PATH_TYPE type) { 2047 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2048 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2049 2050 CPWL_PathData PathArray[] = { 2051 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60.0f, 2052 crBBox.bottom + fHeight / 2.0f), 2053 PWLPT_MOVETO), 2054 CPWL_PathData( 2055 CPWL_Point(crBBox.left + fWidth / 60.0f, 2056 crBBox.bottom + fHeight / 2.0f + 2057 FX_BEZIER * (fHeight / 60.0f - fHeight / 2.0f)), 2058 PWLPT_BEZIERTO), 2059 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f - 2060 FX_BEZIER * (fWidth / 2.0f - fWidth / 60.0f), 2061 crBBox.bottom + fHeight / 60.0f), 2062 PWLPT_BEZIERTO), 2063 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 2064 crBBox.bottom + fHeight / 60.0f), 2065 PWLPT_BEZIERTO), 2066 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f + 2067 FX_BEZIER * fWidth * 29 / 60.0f, 2068 crBBox.bottom + fHeight / 60.0f), 2069 PWLPT_BEZIERTO), 2070 CPWL_PathData( 2071 CPWL_Point(crBBox.right - fWidth / 60.0f, 2072 crBBox.bottom + fHeight / 2.0f + 2073 FX_BEZIER * (fHeight / 60.0f - fHeight / 2.0f)), 2074 PWLPT_BEZIERTO), 2075 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 60.0f, 2076 crBBox.bottom + fHeight / 2.0f), 2077 PWLPT_BEZIERTO), 2078 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 60.0f, 2079 crBBox.bottom + fHeight / 2.0f + 2080 FX_BEZIER * fHeight * 29 / 60.0f), 2081 PWLPT_BEZIERTO), 2082 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f + 2083 FX_BEZIER * fWidth * 29 / 60.0f, 2084 crBBox.top - fHeight / 60.0f), 2085 PWLPT_BEZIERTO), 2086 CPWL_PathData( 2087 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 60.0f), 2088 PWLPT_BEZIERTO), 2089 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f - 2090 FX_BEZIER * fWidth * 29 / 60.0f, 2091 crBBox.top - fHeight / 60.0f), 2092 PWLPT_BEZIERTO), 2093 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60.0f, 2094 crBBox.bottom + fHeight / 2.0f + 2095 FX_BEZIER * fHeight * 29 / 60.0f), 2096 PWLPT_BEZIERTO), 2097 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60.0f, 2098 crBBox.bottom + fHeight / 2.0f), 2099 PWLPT_BEZIERTO), 2100 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.27f, 2101 crBBox.top - fHeight * 0.36f), 2102 PWLPT_MOVETO), 2103 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.27f, 2104 crBBox.top - fHeight * 0.36f + 2105 FX_BEZIER * fHeight * 0.23f), 2106 PWLPT_BEZIERTO), 2107 CPWL_PathData( 2108 CPWL_Point(crBBox.left + fWidth * 0.5f - FX_BEZIER * fWidth * 0.23f, 2109 crBBox.bottom + fHeight * 0.87f), 2110 PWLPT_BEZIERTO), 2111 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.5f, 2112 crBBox.bottom + fHeight * 0.87f), 2113 PWLPT_BEZIERTO), 2114 CPWL_PathData( 2115 CPWL_Point(crBBox.left + fWidth * 0.5f + FX_BEZIER * fWidth * 0.23f, 2116 crBBox.bottom + fHeight * 0.87f), 2117 PWLPT_BEZIERTO), 2118 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.27f, 2119 crBBox.top - fHeight * 0.36f + 2120 FX_BEZIER * fHeight * 0.23f), 2121 PWLPT_BEZIERTO), 2122 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.27f, 2123 crBBox.top - fHeight * 0.36f), 2124 PWLPT_BEZIERTO), 2125 CPWL_PathData( 2126 CPWL_Point(crBBox.right - fWidth * 0.27f - fWidth * 0.08f * 0.2f, 2127 crBBox.top - fHeight * 0.36f - fHeight * 0.15f * 0.7f), 2128 PWLPT_BEZIERTO), 2129 CPWL_PathData( 2130 CPWL_Point(crBBox.right - fWidth * 0.35f + fWidth * 0.08f * 0.2f, 2131 crBBox.top - fHeight * 0.51f + fHeight * 0.15f * 0.2f), 2132 PWLPT_BEZIERTO), 2133 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.35f, 2134 crBBox.top - fHeight * 0.51f), 2135 PWLPT_BEZIERTO), 2136 CPWL_PathData( 2137 CPWL_Point(crBBox.right - fWidth * 0.35f - fWidth * 0.1f * 0.5f, 2138 crBBox.top - fHeight * 0.51f - fHeight * 0.15f * 0.3f), 2139 PWLPT_BEZIERTO), 2140 CPWL_PathData( 2141 CPWL_Point(crBBox.right - fWidth * 0.45f - fWidth * 0.1f * 0.5f, 2142 crBBox.top - fHeight * 0.68f + fHeight * 0.15f * 0.5f), 2143 PWLPT_BEZIERTO), 2144 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.45f, 2145 crBBox.top - fHeight * 0.68f), 2146 PWLPT_BEZIERTO), 2147 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.45f, 2148 crBBox.bottom + fHeight * 0.30f), 2149 PWLPT_LINETO), 2150 CPWL_PathData( 2151 CPWL_Point(crBBox.right - fWidth * 0.45f, 2152 crBBox.bottom + fHeight * 0.30f - fWidth * 0.1f * 0.7f), 2153 PWLPT_BEZIERTO), 2154 CPWL_PathData( 2155 CPWL_Point(crBBox.right - fWidth * 0.55f, 2156 crBBox.bottom + fHeight * 0.30f - fWidth * 0.1f * 0.7f), 2157 PWLPT_BEZIERTO), 2158 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.55f, 2159 crBBox.bottom + fHeight * 0.30f), 2160 PWLPT_BEZIERTO), 2161 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.55f, 2162 crBBox.top - fHeight * 0.66f), 2163 PWLPT_LINETO), 2164 CPWL_PathData( 2165 CPWL_Point(crBBox.right - fWidth * 0.55f - fWidth * 0.1f * 0.05f, 2166 crBBox.top - fHeight * 0.66f + fHeight * 0.18f * 0.5f), 2167 PWLPT_BEZIERTO), 2168 CPWL_PathData( 2169 CPWL_Point(crBBox.right - fWidth * 0.45f - fWidth * 0.1f * 0.05f, 2170 crBBox.top - fHeight * 0.48f - fHeight * 0.18f * 0.3f), 2171 PWLPT_BEZIERTO), 2172 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.45f, 2173 crBBox.top - fHeight * 0.48f), 2174 PWLPT_BEZIERTO), 2175 CPWL_PathData( 2176 CPWL_Point(crBBox.right - fWidth * 0.45f + fWidth * 0.08f * 0.2f, 2177 crBBox.top - fHeight * 0.48f + fHeight * 0.18f * 0.2f), 2178 PWLPT_BEZIERTO), 2179 CPWL_PathData( 2180 CPWL_Point(crBBox.right - fWidth * 0.37f - fWidth * 0.08f * 0.2f, 2181 crBBox.top - fHeight * 0.36f - fHeight * 0.18f * 0.7f), 2182 PWLPT_BEZIERTO), 2183 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.37f, 2184 crBBox.top - fHeight * 0.36f), 2185 PWLPT_BEZIERTO), 2186 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.37f, 2187 crBBox.top - fHeight * 0.36f + 2188 FX_BEZIER * fHeight * 0.13f), 2189 PWLPT_BEZIERTO), 2190 CPWL_PathData( 2191 CPWL_Point(crBBox.left + fWidth * 0.5f + FX_BEZIER * fWidth * 0.13f, 2192 crBBox.bottom + fHeight * 0.77f), 2193 PWLPT_BEZIERTO), 2194 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.5f, 2195 crBBox.bottom + fHeight * 0.77f), 2196 PWLPT_BEZIERTO), 2197 CPWL_PathData( 2198 CPWL_Point(crBBox.left + fWidth * 0.5f - FX_BEZIER * fWidth * 0.13f, 2199 crBBox.bottom + fHeight * 0.77f), 2200 PWLPT_BEZIERTO), 2201 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.37f, 2202 crBBox.top - fHeight * 0.36f + 2203 FX_BEZIER * fHeight * 0.13f), 2204 PWLPT_BEZIERTO), 2205 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.37f, 2206 crBBox.top - fHeight * 0.36f), 2207 PWLPT_BEZIERTO), 2208 CPWL_PathData( 2209 CPWL_Point(crBBox.left + fWidth * 0.37f, 2210 crBBox.top - fHeight * 0.36f - fWidth * 0.1f * 0.6f), 2211 PWLPT_BEZIERTO), 2212 CPWL_PathData( 2213 CPWL_Point(crBBox.left + fWidth * 0.27f, 2214 crBBox.top - fHeight * 0.36f - fWidth * 0.1f * 0.6f), 2215 PWLPT_BEZIERTO), 2216 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.27f, 2217 crBBox.top - fHeight * 0.36f), 2218 PWLPT_BEZIERTO), 2219 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.56f, 2220 crBBox.bottom + fHeight * 0.13f), 2221 PWLPT_MOVETO), 2222 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.56f, 2223 crBBox.bottom + fHeight * 0.13f + 2224 FX_BEZIER * fHeight * 0.055f), 2225 PWLPT_BEZIERTO), 2226 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.505f - 2227 FX_BEZIER * fWidth * 0.095f, 2228 crBBox.bottom + fHeight * 0.185f), 2229 PWLPT_BEZIERTO), 2230 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.505f, 2231 crBBox.bottom + fHeight * 0.185f), 2232 PWLPT_BEZIERTO), 2233 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.505f + 2234 FX_BEZIER * fWidth * 0.065f, 2235 crBBox.bottom + fHeight * 0.185f), 2236 PWLPT_BEZIERTO), 2237 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.44f, 2238 crBBox.bottom + fHeight * 0.13f + 2239 FX_BEZIER * fHeight * 0.055f), 2240 PWLPT_BEZIERTO), 2241 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.44f, 2242 crBBox.bottom + fHeight * 0.13f), 2243 PWLPT_BEZIERTO), 2244 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.44f, 2245 crBBox.bottom + fHeight * 0.13f - 2246 FX_BEZIER * fHeight * 0.055f), 2247 PWLPT_BEZIERTO), 2248 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.505f + 2249 FX_BEZIER * fWidth * 0.065f, 2250 crBBox.bottom + fHeight * 0.075f), 2251 PWLPT_BEZIERTO), 2252 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.505f, 2253 crBBox.bottom + fHeight * 0.075f), 2254 PWLPT_BEZIERTO), 2255 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.505f - 2256 FX_BEZIER * fWidth * 0.065f, 2257 crBBox.bottom + fHeight * 0.075f), 2258 PWLPT_BEZIERTO), 2259 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.56f, 2260 crBBox.bottom + fHeight * 0.13f - 2261 FX_BEZIER * fHeight * 0.055f), 2262 PWLPT_BEZIERTO), 2263 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.56f, 2264 crBBox.bottom + fHeight * 0.13f), 2265 PWLPT_BEZIERTO)}; 2266 2267 if (type == PWLPT_STREAM) 2268 sPathData = GetAppStreamFromArray(PathArray, 59); 2269 else 2270 GetPathDataFromArray(path, PathArray, 59); 2271} 2272 2273void CPWL_Utils::GetGraphics_InsertText(CFX_ByteString& sPathData, 2274 CFX_PathData& path, 2275 const CFX_FloatRect& crBBox, 2276 const PWL_PATH_TYPE type) { 2277 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2278 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2279 2280 CPWL_PathData PathArray[] = { 2281 CPWL_PathData( 2282 CPWL_Point(crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10), 2283 PWLPT_MOVETO), 2284 CPWL_PathData( 2285 CPWL_Point(crBBox.left + fWidth / 2, crBBox.top - fHeight * 2 / 15), 2286 PWLPT_LINETO), 2287 CPWL_PathData( 2288 CPWL_Point(crBBox.right - fWidth / 10, crBBox.bottom + fHeight / 10), 2289 PWLPT_LINETO), 2290 CPWL_PathData( 2291 CPWL_Point(crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10), 2292 PWLPT_LINETO)}; 2293 2294 if (type == PWLPT_STREAM) 2295 sPathData = GetAppStreamFromArray(PathArray, 4); 2296 else 2297 GetPathDataFromArray(path, PathArray, 4); 2298} 2299 2300void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData, 2301 CFX_PathData& path, 2302 const CFX_FloatRect& crBBox, 2303 const PWL_PATH_TYPE type) { 2304 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2305 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2306 FX_FLOAT k = -fHeight / fWidth; 2307 CPWL_Point tail; 2308 CPWL_Point CicleCenter; 2309 tail.x = crBBox.left + fWidth * 0.9f; 2310 tail.y = k * (tail.x - crBBox.right) + crBBox.bottom; 2311 CicleCenter.x = crBBox.left + fWidth * 0.15f; 2312 CicleCenter.y = k * (CicleCenter.x - crBBox.right) + crBBox.bottom; 2313 2314 CPWL_PathData PathArray[] = { 2315 CPWL_PathData( 2316 CPWL_Point(tail.x + fWidth / 30.0f, -fWidth / 30.0f / k + tail.y), 2317 PWLPT_MOVETO), 2318 CPWL_PathData(CPWL_Point(tail.x + fWidth / 30.0f - fWidth * 0.18f, 2319 -k * fWidth * 0.18f - fWidth / 30 / k + tail.y), 2320 PWLPT_LINETO), 2321 CPWL_PathData( 2322 CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.18f + fWidth * 0.07f, 2323 -fWidth * 0.07f / k - k * fWidth * 0.18f - 2324 fWidth / 30 / k + tail.y), 2325 PWLPT_LINETO), 2326 CPWL_PathData( 2327 CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 + 2328 fWidth * 0.07f, 2329 -fWidth * 0.07f / k - k * fWidth / 20 - 2330 k * fWidth * 0.18f - fWidth / 30 / k + tail.y), 2331 PWLPT_LINETO), 2332 CPWL_PathData( 2333 CPWL_Point( 2334 tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20, 2335 -k * fWidth / 20 - k * fWidth * 0.18f - fWidth / 30 / k + tail.y), 2336 PWLPT_LINETO), 2337 CPWL_PathData( 2338 CPWL_Point( 2339 tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - fWidth / 15, 2340 -k * fWidth / 15 - k * fWidth / 20 - k * fWidth * 0.18f - 2341 fWidth / 30 / k + tail.y), 2342 PWLPT_LINETO), 2343 CPWL_PathData( 2344 CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - 2345 fWidth / 15 + fWidth * 0.07f, 2346 -fWidth * 0.07f / k - k * fWidth / 15 - k * fWidth / 20 - 2347 k * fWidth * 0.18f - fWidth / 30 / k + tail.y), 2348 PWLPT_LINETO), 2349 CPWL_PathData( 2350 CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - 2351 fWidth / 15 - fWidth / 20 + fWidth * 0.07f, 2352 -fWidth * 0.07f / k + -k * fWidth / 20 + -k * fWidth / 15 - 2353 k * fWidth / 20 - k * fWidth * 0.18f - 2354 fWidth / 30 / k + tail.y), 2355 PWLPT_LINETO), 2356 CPWL_PathData( 2357 CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.18f - fWidth / 20 - 2358 fWidth / 15 - fWidth / 20, 2359 -k * fWidth / 20 + -k * fWidth / 15 - k * fWidth / 20 - 2360 k * fWidth * 0.18f - fWidth / 30 / k + tail.y), 2361 PWLPT_LINETO), 2362 CPWL_PathData(CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.45f, 2363 -k * fWidth * 0.45f - fWidth / 30 / k + tail.y), 2364 PWLPT_LINETO), 2365 CPWL_PathData( 2366 CPWL_Point(tail.x + fWidth / 30 - fWidth * 0.45f + fWidth * 0.2f, 2367 -fWidth * 0.4f / k - k * fWidth * 0.45f - fWidth / 30 / k + 2368 tail.y), 2369 PWLPT_BEZIERTO), 2370 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth * 0.2f, 2371 -fWidth * 0.1f / k + CicleCenter.y), 2372 PWLPT_BEZIERTO), 2373 CPWL_PathData(CPWL_Point(CicleCenter.x, CicleCenter.y), PWLPT_BEZIERTO), 2374 CPWL_PathData(CPWL_Point(CicleCenter.x - fWidth / 60.0f, 2375 -k * fWidth / 60 + CicleCenter.y), 2376 PWLPT_BEZIERTO), 2377 CPWL_PathData(CPWL_Point(CicleCenter.x - fWidth / 60, 2378 -k * fWidth / 60 + CicleCenter.y), 2379 PWLPT_BEZIERTO), 2380 CPWL_PathData(CPWL_Point(CicleCenter.x, CicleCenter.y), PWLPT_BEZIERTO), 2381 CPWL_PathData( 2382 CPWL_Point(CicleCenter.x - fWidth * 0.22f, 2383 fWidth * 0.35f / k + CicleCenter.y - fHeight * 0.05f), 2384 PWLPT_BEZIERTO), 2385 CPWL_PathData( 2386 CPWL_Point(tail.x - fWidth / 30 - fWidth * 0.45f - fWidth * 0.18f, 2387 fWidth * 0.05f / k - k * fWidth * 0.45f + fWidth / 30 / k + 2388 tail.y - fHeight * 0.05f), 2389 PWLPT_BEZIERTO), 2390 CPWL_PathData( 2391 CPWL_Point(tail.x - fWidth / 30.0f - fWidth * 0.45f, 2392 -k * fWidth * 0.45f + fWidth / 30.0f / k + tail.y), 2393 PWLPT_BEZIERTO), 2394 CPWL_PathData( 2395 CPWL_Point(tail.x - fWidth / 30.0f, fWidth / 30.0f / k + tail.y), 2396 PWLPT_LINETO), 2397 CPWL_PathData(CPWL_Point(tail.x + fWidth / 30, -fWidth / 30 / k + tail.y), 2398 PWLPT_LINETO), 2399 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth * 0.08f, 2400 k * fWidth * 0.08f + CicleCenter.y), 2401 PWLPT_MOVETO), 2402 CPWL_PathData( 2403 CPWL_Point(CicleCenter.x + fWidth * 0.08f + fWidth * 0.1f, 2404 -fWidth * 0.1f / k + k * fWidth * 0.08f + CicleCenter.y), 2405 PWLPT_BEZIERTO), 2406 CPWL_PathData( 2407 CPWL_Point(CicleCenter.x + fWidth * 0.22f + fWidth * 0.1f, 2408 k * fWidth * 0.22f + CicleCenter.y - fWidth * 0.1f / k), 2409 PWLPT_BEZIERTO), 2410 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth * 0.22f, 2411 k * fWidth * 0.22f + CicleCenter.y), 2412 PWLPT_BEZIERTO), 2413 CPWL_PathData( 2414 CPWL_Point(CicleCenter.x + fWidth * 0.22f - fWidth * 0.1f, 2415 fWidth * 0.1f / k + k * fWidth * 0.22f + CicleCenter.y), 2416 PWLPT_BEZIERTO), 2417 CPWL_PathData( 2418 CPWL_Point(CicleCenter.x + fWidth * 0.08f - fWidth * 0.1f, 2419 fWidth * 0.1f / k + k * fWidth * 0.08f + CicleCenter.y), 2420 PWLPT_BEZIERTO), 2421 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth * 0.08f, 2422 k * fWidth * 0.08f + CicleCenter.y), 2423 PWLPT_BEZIERTO)}; 2424 2425 if (type == PWLPT_STREAM) 2426 sPathData = GetAppStreamFromArray(PathArray, 28); 2427 else 2428 GetPathDataFromArray(path, PathArray, 28); 2429} 2430 2431void CPWL_Utils::GetGraphics_NewParagraph(CFX_ByteString& sPathData, 2432 CFX_PathData& path, 2433 const CFX_FloatRect& crBBox, 2434 const PWL_PATH_TYPE type) { 2435 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2436 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2437 2438 CPWL_PathData PathArray[] = { 2439 CPWL_PathData( 2440 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 20.0f), 2441 PWLPT_MOVETO), 2442 CPWL_PathData( 2443 CPWL_Point(crBBox.left + fWidth / 10.0f, crBBox.top - fHeight / 2.0f), 2444 PWLPT_LINETO), 2445 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 2446 crBBox.top - fHeight / 2.0f), 2447 PWLPT_LINETO), 2448 CPWL_PathData( 2449 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 20.0f), 2450 PWLPT_LINETO), 2451 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.12f, 2452 crBBox.top - fHeight * 17 / 30.0f), 2453 PWLPT_MOVETO), 2454 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.12f, 2455 crBBox.bottom + fHeight / 10.0f), 2456 PWLPT_LINETO), 2457 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.22f, 2458 crBBox.bottom + fHeight / 10.0f), 2459 PWLPT_LINETO), 2460 CPWL_PathData( 2461 CPWL_Point(crBBox.left + fWidth * 0.22f, 2462 crBBox.top - fHeight * 17 / 30.0f - fWidth * 0.14f), 2463 PWLPT_LINETO), 2464 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.38f, 2465 crBBox.bottom + fHeight / 10.0f), 2466 PWLPT_LINETO), 2467 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.48f, 2468 crBBox.bottom + fHeight / 10.0f), 2469 PWLPT_LINETO), 2470 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.48f, 2471 crBBox.top - fHeight * 17 / 30.0f), 2472 PWLPT_LINETO), 2473 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.38f, 2474 crBBox.top - fHeight * 17 / 30.0f), 2475 PWLPT_LINETO), 2476 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.38f, 2477 crBBox.bottom + fWidth * 0.24f), 2478 PWLPT_LINETO), 2479 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.22f, 2480 crBBox.top - fHeight * 17 / 30.0f), 2481 PWLPT_LINETO), 2482 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.12f, 2483 crBBox.top - fHeight * 17 / 30.0f), 2484 PWLPT_LINETO), 2485 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 2486 crBBox.bottom + fHeight / 10.0f), 2487 PWLPT_MOVETO), 2488 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.7f, 2489 crBBox.bottom + fHeight / 10.0f), 2490 PWLPT_LINETO), 2491 CPWL_PathData( 2492 CPWL_Point(crBBox.left + fWidth * 0.7f, 2493 crBBox.bottom + fHeight / 10.0f + fHeight / 7.0f), 2494 PWLPT_LINETO), 2495 CPWL_PathData( 2496 CPWL_Point(crBBox.left + fWidth * 0.97f, 2497 crBBox.bottom + fHeight / 10.0f + fHeight / 7.0f), 2498 PWLPT_BEZIERTO), 2499 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.97f, 2500 crBBox.top - fHeight * 17 / 30.0f), 2501 PWLPT_BEZIERTO), 2502 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.7f, 2503 crBBox.top - fHeight * 17 / 30.0f), 2504 PWLPT_BEZIERTO), 2505 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 2506 crBBox.top - fHeight * 17 / 30.0f), 2507 PWLPT_LINETO), 2508 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 2509 crBBox.bottom + fHeight / 10.0f), 2510 PWLPT_LINETO), 2511 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.7f, 2512 crBBox.bottom + fHeight / 7 + fHeight * 0.18f), 2513 PWLPT_MOVETO), 2514 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.85f, 2515 crBBox.bottom + fHeight / 7 + fHeight * 0.18f), 2516 PWLPT_BEZIERTO), 2517 CPWL_PathData( 2518 CPWL_Point(crBBox.left + fWidth * 0.85f, 2519 crBBox.top - fHeight * 17 / 30.0f - fHeight * 0.08f), 2520 PWLPT_BEZIERTO), 2521 CPWL_PathData( 2522 CPWL_Point(crBBox.left + fWidth * 0.7f, 2523 crBBox.top - fHeight * 17 / 30.0f - fHeight * 0.08f), 2524 PWLPT_BEZIERTO), 2525 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.7f, 2526 crBBox.bottom + fHeight / 7 + fHeight * 0.18f), 2527 PWLPT_LINETO)}; 2528 2529 if (type == PWLPT_STREAM) 2530 sPathData = GetAppStreamFromArray(PathArray, 28); 2531 else 2532 GetPathDataFromArray(path, PathArray, 28); 2533} 2534 2535void CPWL_Utils::GetGraphics_TextNote(CFX_ByteString& sPathData, 2536 CFX_PathData& path, 2537 const CFX_FloatRect& crBBox, 2538 const PWL_PATH_TYPE type) { 2539 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2540 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2541 2542 CPWL_PathData PathArray[] = { 2543 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f, 2544 crBBox.bottom + fHeight / 15.0f), 2545 PWLPT_MOVETO), 2546 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 7 / 10.0f, 2547 crBBox.bottom + fHeight * 4 / 15.0f), 2548 PWLPT_LINETO), 2549 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 2550 crBBox.bottom + fHeight * 4 / 15.0f), 2551 PWLPT_LINETO), 2552 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 2553 crBBox.top - fHeight / 15.0f), 2554 PWLPT_LINETO), 2555 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 10.0f, 2556 crBBox.top - fHeight / 15.0f), 2557 PWLPT_LINETO), 2558 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 10.0f, 2559 crBBox.bottom + fHeight / 15.0f), 2560 PWLPT_LINETO), 2561 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f, 2562 crBBox.bottom + fHeight / 15.0f), 2563 PWLPT_LINETO), 2564 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 2565 crBBox.bottom + fHeight * 4 / 15.0f), 2566 PWLPT_LINETO), 2567 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f, 2568 crBBox.bottom + fHeight / 15.0f), 2569 PWLPT_LINETO), 2570 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f, 2571 crBBox.bottom + fHeight * 4 / 15.0f), 2572 PWLPT_LINETO), 2573 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 2574 crBBox.bottom + fHeight * 4 / 15.0f), 2575 PWLPT_LINETO), 2576 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 5.0f, 2577 crBBox.top - fHeight * 4 / 15.0f), 2578 PWLPT_MOVETO), 2579 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 5.0f, 2580 crBBox.top - fHeight * 4 / 15.0f), 2581 PWLPT_LINETO), 2582 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 5.0f, 2583 crBBox.top - fHeight * 7 / 15.0f), 2584 PWLPT_MOVETO), 2585 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 5.0f, 2586 crBBox.top - fHeight * 7 / 15.0f), 2587 PWLPT_LINETO), 2588 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 5.0f, 2589 crBBox.top - fHeight * 10 / 15.0f), 2590 PWLPT_MOVETO), 2591 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f, 2592 crBBox.top - fHeight * 10 / 15.0f), 2593 PWLPT_LINETO)}; 2594 2595 if (type == PWLPT_STREAM) 2596 sPathData = GetAppStreamFromArray(PathArray, 17); 2597 else 2598 GetPathDataFromArray(path, PathArray, 17); 2599} 2600 2601void CPWL_Utils::GetGraphics_Paragraph(CFX_ByteString& sPathData, 2602 CFX_PathData& path, 2603 const CFX_FloatRect& crBBox, 2604 const PWL_PATH_TYPE type) { 2605 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2606 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2607 2608 CPWL_PathData PathArray[] = { 2609 CPWL_PathData( 2610 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 2611 PWLPT_MOVETO), 2612 CPWL_PathData( 2613 CPWL_Point(crBBox.left + fWidth * 0.7f, crBBox.top - fHeight / 15.0f), 2614 PWLPT_LINETO), 2615 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.7f, 2616 crBBox.bottom + fHeight / 15.0f), 2617 PWLPT_LINETO), 2618 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.634f, 2619 crBBox.bottom + fHeight / 15.0f), 2620 PWLPT_LINETO), 2621 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.634f, 2622 crBBox.top - fHeight * 2 / 15.0f), 2623 PWLPT_LINETO), 2624 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.566f, 2625 crBBox.top - fHeight * 2 / 15.0f), 2626 PWLPT_LINETO), 2627 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.566f, 2628 crBBox.bottom + fHeight / 15.0f), 2629 PWLPT_LINETO), 2630 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 2631 crBBox.bottom + fHeight / 15.0f), 2632 PWLPT_LINETO), 2633 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 2634 crBBox.top - fHeight / 15.0f - fHeight * 0.4f), 2635 PWLPT_LINETO), 2636 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.2f, 2637 crBBox.top - fHeight / 15.0f - fHeight * 0.4f), 2638 PWLPT_BEZIERTO), 2639 CPWL_PathData( 2640 CPWL_Point(crBBox.left + fWidth * 0.2f, crBBox.top - fHeight / 15.0f), 2641 PWLPT_BEZIERTO), 2642 CPWL_PathData( 2643 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 2644 PWLPT_BEZIERTO)}; 2645 2646 if (type == PWLPT_STREAM) 2647 sPathData = GetAppStreamFromArray(PathArray, 12); 2648 else 2649 GetPathDataFromArray(path, PathArray, 12); 2650} 2651 2652void CPWL_Utils::GetGraphics_RightArrow(CFX_ByteString& sPathData, 2653 CFX_PathData& path, 2654 const CFX_FloatRect& crBBox, 2655 const PWL_PATH_TYPE type) { 2656 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2657 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2658 2659 CPWL_PathData PathArray[] = { 2660 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 2661 crBBox.top - fHeight / 2.0f), 2662 PWLPT_MOVETO), 2663 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f + fWidth / 8.0f, 2664 crBBox.bottom + fHeight / 5.0f), 2665 PWLPT_LINETO), 2666 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f, 2667 crBBox.bottom + fHeight / 5.0f), 2668 PWLPT_LINETO), 2669 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f - fWidth * 0.15f, 2670 crBBox.top - fHeight / 2.0f - fWidth / 25.0f), 2671 PWLPT_LINETO), 2672 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.1f, 2673 crBBox.top - fHeight / 2.0f - fWidth / 25.0f), 2674 PWLPT_LINETO), 2675 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.1f, 2676 crBBox.top - fHeight / 2.0f + fWidth / 25.0f), 2677 PWLPT_LINETO), 2678 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f - fWidth * 0.15f, 2679 crBBox.top - fHeight / 2.0f + fWidth / 25.0f), 2680 PWLPT_LINETO), 2681 CPWL_PathData( 2682 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 5.0f), 2683 PWLPT_LINETO), 2684 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f + fWidth / 8.0f, 2685 crBBox.top - fHeight / 5.0f), 2686 PWLPT_LINETO), 2687 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 2688 crBBox.top - fHeight / 2.0f), 2689 PWLPT_LINETO)}; 2690 2691 if (type == PWLPT_STREAM) 2692 sPathData = GetAppStreamFromArray(PathArray, 10); 2693 else 2694 GetPathDataFromArray(path, PathArray, 10); 2695} 2696 2697void CPWL_Utils::GetGraphics_RightPointer(CFX_ByteString& sPathData, 2698 CFX_PathData& path, 2699 const CFX_FloatRect& crBBox, 2700 const PWL_PATH_TYPE type) { 2701 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2702 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2703 2704 CPWL_PathData PathArray[] = { 2705 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30.0f, 2706 crBBox.top - fHeight / 2.0f), 2707 PWLPT_MOVETO), 2708 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 30.0f, 2709 crBBox.bottom + fHeight / 6.0f), 2710 PWLPT_LINETO), 2711 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 4 / 15.0f, 2712 crBBox.top - fHeight / 2.0f), 2713 PWLPT_LINETO), 2714 CPWL_PathData( 2715 CPWL_Point(crBBox.left + fWidth / 30.0f, crBBox.top - fHeight / 6.0f), 2716 PWLPT_LINETO), 2717 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30.0f, 2718 crBBox.top - fHeight / 2.0f), 2719 PWLPT_LINETO)}; 2720 2721 if (type == PWLPT_STREAM) 2722 sPathData = GetAppStreamFromArray(PathArray, 5); 2723 else 2724 GetPathDataFromArray(path, PathArray, 5); 2725} 2726 2727void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, 2728 CFX_PathData& path, 2729 const CFX_FloatRect& crBBox, 2730 const PWL_PATH_TYPE type) { 2731 FX_FLOAT fLongRadius = 2732 (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); 2733 fLongRadius = fLongRadius * 0.7f; 2734 FX_FLOAT fShortRadius = fLongRadius * 0.55f; 2735 CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, 2736 (crBBox.top + crBBox.bottom) / 2.0f); 2737 2738 FX_FLOAT px1[5], py1[5]; 2739 FX_FLOAT px2[5], py2[5]; 2740 2741 FX_FLOAT fAngel = FX_PI / 10.0f; 2742 2743 for (int32_t i = 0; i < 5; i++) { 2744 px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel); 2745 py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel); 2746 2747 fAngel += FX_PI * 2 / 5.0f; 2748 } 2749 2750 fAngel = FX_PI / 5.0f + FX_PI / 10.0f; 2751 2752 for (int32_t j = 0; j < 5; j++) { 2753 px2[j] = ptCenter.x + fShortRadius * (FX_FLOAT)cos(fAngel); 2754 py2[j] = ptCenter.y + fShortRadius * (FX_FLOAT)sin(fAngel); 2755 2756 fAngel += FX_PI * 2 / 5.0f; 2757 } 2758 2759 CPWL_PathData PathArray[11]; 2760 PathArray[0] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_MOVETO); 2761 PathArray[1] = CPWL_PathData(CPWL_Point(px2[0], py2[0]), PWLPT_LINETO); 2762 2763 for (int32_t k = 0; k < 4; k++) { 2764 PathArray[(k + 1) * 2] = 2765 CPWL_PathData(CPWL_Point(px1[k + 1], py1[k + 1]), PWLPT_LINETO); 2766 PathArray[(k + 1) * 2 + 1] = 2767 CPWL_PathData(CPWL_Point(px2[k + 1], py2[k + 1]), PWLPT_LINETO); 2768 } 2769 2770 PathArray[10] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_LINETO); 2771 2772 if (type == PWLPT_STREAM) 2773 sPathData = GetAppStreamFromArray(PathArray, 11); 2774 else 2775 GetPathDataFromArray(path, PathArray, 11); 2776} 2777 2778void CPWL_Utils::GetGraphics_UpArrow(CFX_ByteString& sPathData, 2779 CFX_PathData& path, 2780 const CFX_FloatRect& crBBox, 2781 const PWL_PATH_TYPE type) { 2782 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2783 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2784 2785 CPWL_PathData PathArray[] = { 2786 CPWL_PathData( 2787 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 2788 PWLPT_MOVETO), 2789 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 2790 crBBox.top - fWidth * 3 / 5.0f), 2791 PWLPT_LINETO), 2792 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 2793 crBBox.top - fWidth * 3 / 5.0f), 2794 PWLPT_LINETO), 2795 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 2796 crBBox.bottom + fHeight / 15.0f), 2797 PWLPT_LINETO), 2798 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.4f, 2799 crBBox.bottom + fHeight / 15.0f), 2800 PWLPT_LINETO), 2801 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.4f, 2802 crBBox.top - fWidth * 3 / 5.0f), 2803 PWLPT_LINETO), 2804 CPWL_PathData( 2805 CPWL_Point(crBBox.left + fWidth / 10, crBBox.top - fWidth * 3 / 5.0f), 2806 PWLPT_LINETO), 2807 CPWL_PathData( 2808 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 2809 PWLPT_LINETO)}; 2810 2811 if (type == PWLPT_STREAM) 2812 sPathData = GetAppStreamFromArray(PathArray, 8); 2813 else 2814 GetPathDataFromArray(path, PathArray, 8); 2815} 2816 2817void CPWL_Utils::GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, 2818 CFX_PathData& path, 2819 const CFX_FloatRect& crBBox, 2820 const PWL_PATH_TYPE type) { 2821 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2822 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2823 CPWL_Point leftup(crBBox.left, crBBox.top); 2824 CPWL_Point rightdown(crBBox.right, crBBox.bottom); 2825 FX_FLOAT k = -fHeight / fWidth; 2826 CPWL_Point tail; 2827 tail.x = crBBox.left + fWidth * 4 / 5.0f; 2828 tail.y = k * (tail.x - crBBox.right) + rightdown.y; 2829 2830 CPWL_PathData PathArray[] = { 2831 CPWL_PathData( 2832 CPWL_Point( 2833 crBBox.left + fWidth / 20.0f, 2834 k * (crBBox.left + fWidth / 20.0f - rightdown.x) + rightdown.y), 2835 PWLPT_MOVETO), 2836 CPWL_PathData(CPWL_Point(fHeight * 17 / 60.0f / k + tail.x + 2837 fWidth / 10.0f + fWidth / 5.0f, 2838 -fWidth / 5.0f / k + tail.y - 2839 fWidth / 10.0f / k + fHeight * 17 / 60.0f), 2840 PWLPT_LINETO), 2841 CPWL_PathData( 2842 CPWL_Point(fHeight * 17 / 60.0f / k + tail.x + fWidth / 10.0f, 2843 tail.y - fWidth / 10.0f / k + fHeight * 17 / 60.0f), 2844 PWLPT_LINETO), 2845 CPWL_PathData( 2846 CPWL_Point(tail.x + fWidth / 10.0f, tail.y - fWidth / 10.0f / k), 2847 PWLPT_LINETO), 2848 CPWL_PathData( 2849 CPWL_Point(tail.x - fWidth / 10.0f, tail.y + fWidth / 10.0f / k), 2850 PWLPT_LINETO), 2851 CPWL_PathData( 2852 CPWL_Point(fHeight * 17 / 60.0f / k + tail.x - fWidth / 10.0f, 2853 tail.y + fWidth / 10.0f / k + fHeight * 17 / 60.0f), 2854 PWLPT_LINETO), 2855 CPWL_PathData(CPWL_Point(fHeight * 17 / 60.0f / k + tail.x - 2856 fWidth / 10.0f - fWidth / 5.0f, 2857 fWidth / 5.0f / k + tail.y + fWidth / 10.0f / k + 2858 fHeight * 17 / 60.0f), 2859 PWLPT_LINETO), 2860 CPWL_PathData( 2861 CPWL_Point( 2862 crBBox.left + fWidth / 20.0f, 2863 k * (crBBox.left + fWidth / 20.0f - rightdown.x) + rightdown.y), 2864 PWLPT_LINETO)}; 2865 2866 if (type == PWLPT_STREAM) 2867 sPathData = GetAppStreamFromArray(PathArray, 8); 2868 else 2869 GetPathDataFromArray(path, PathArray, 8); 2870} 2871 2872void CPWL_Utils::GetGraphics_Graph(CFX_ByteString& sPathData, 2873 CFX_PathData& path, 2874 const CFX_FloatRect& crBBox, 2875 const PWL_PATH_TYPE type) { 2876 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2877 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2878 2879 CPWL_PathData PathArray[] = { 2880 CPWL_PathData( 2881 CPWL_Point(crBBox.left + fWidth * 0.05f, crBBox.top - fWidth * 0.15f), 2882 PWLPT_MOVETO), 2883 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.25f, 2884 crBBox.top - fHeight * 0.15f), 2885 PWLPT_LINETO), 2886 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.275f, 2887 crBBox.bottom + fHeight * 0.08f), 2888 PWLPT_LINETO), 2889 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.05f, 2890 crBBox.bottom + fHeight * 0.08f), 2891 PWLPT_LINETO), 2892 CPWL_PathData( 2893 CPWL_Point(crBBox.left + fWidth * 0.05f, crBBox.top - fWidth * 0.15f), 2894 PWLPT_LINETO), 2895 2896 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.275f, 2897 crBBox.top - fWidth * 0.45f), 2898 PWLPT_MOVETO), 2899 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.475f, 2900 crBBox.top - fWidth * 0.45f), 2901 PWLPT_LINETO), 2902 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.475f, 2903 crBBox.bottom + fHeight * 0.08f), 2904 PWLPT_LINETO), 2905 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.275f, 2906 crBBox.bottom + fHeight * 0.08f), 2907 PWLPT_LINETO), 2908 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.275f, 2909 crBBox.top - fWidth * 0.45f), 2910 PWLPT_LINETO), 2911 2912 CPWL_PathData( 2913 CPWL_Point(crBBox.left + fWidth * 0.5f, crBBox.top - fHeight * 0.05f), 2914 PWLPT_MOVETO), 2915 CPWL_PathData( 2916 CPWL_Point(crBBox.left + fWidth * 0.7f, crBBox.top - fHeight * 0.05f), 2917 PWLPT_LINETO), 2918 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.7f, 2919 crBBox.bottom + fHeight * 0.08f), 2920 PWLPT_LINETO), 2921 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.5f, 2922 crBBox.bottom + fHeight * 0.08f), 2923 PWLPT_LINETO), 2924 CPWL_PathData( 2925 CPWL_Point(crBBox.left + fWidth * 0.5f, crBBox.top - fHeight * 0.05f), 2926 PWLPT_LINETO), 2927 2928 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.725f, 2929 crBBox.top - fWidth * 0.35f), 2930 PWLPT_MOVETO), 2931 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.925f, 2932 crBBox.top - fWidth * 0.35f), 2933 PWLPT_LINETO), 2934 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.925f, 2935 crBBox.bottom + fHeight * 0.08f), 2936 PWLPT_LINETO), 2937 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.725f, 2938 crBBox.bottom + fHeight * 0.08f), 2939 PWLPT_LINETO), 2940 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.725f, 2941 crBBox.top - fWidth * 0.35f), 2942 PWLPT_LINETO)}; 2943 2944 if (type == PWLPT_STREAM) 2945 sPathData = GetAppStreamFromArray(PathArray, 20); 2946 else 2947 GetPathDataFromArray(path, PathArray, 20); 2948} 2949 2950void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData, 2951 CFX_PathData& path, 2952 const CFX_FloatRect& crBBox, 2953 const PWL_PATH_TYPE type) { 2954 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2955 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2956 2957 CPWL_PathData PathArray[] = { 2958 CPWL_PathData( 2959 CPWL_Point(crBBox.left + fWidth / 60, crBBox.top - fHeight * 0.25f), 2960 PWLPT_MOVETO), 2961 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60, 2962 crBBox.bottom + fHeight * 0.25f), 2963 PWLPT_LINETO), 2964 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60, 2965 crBBox.bottom + fHeight * 0.25f - 2966 fWidth * 57 / 60.0f * 0.35f), 2967 PWLPT_BEZIERTO), 2968 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30, 2969 crBBox.bottom + fHeight * 0.25f - 2970 fWidth * 57 / 60.0f * 0.35f), 2971 PWLPT_BEZIERTO), 2972 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30, 2973 crBBox.bottom + fHeight * 0.25f), 2974 PWLPT_BEZIERTO), 2975 2976 CPWL_PathData( 2977 CPWL_Point(crBBox.right - fWidth / 30, crBBox.top - fHeight * 0.33f), 2978 PWLPT_LINETO), 2979 CPWL_PathData( 2980 CPWL_Point(crBBox.right - fWidth / 30, 2981 crBBox.top - fHeight * 0.33f + fHeight / 15 * 0.5f), 2982 PWLPT_BEZIERTO), 2983 CPWL_PathData( 2984 CPWL_Point(crBBox.right - fWidth / 30 - fWidth * 0.12f, 2985 crBBox.top - fHeight * 0.33f + fHeight / 15 * 0.5f), 2986 PWLPT_BEZIERTO), 2987 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30 - fWidth * 0.12f, 2988 crBBox.top - fHeight * 0.33f), 2989 PWLPT_BEZIERTO), 2990 2991 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30 - fWidth * 0.12f, 2992 crBBox.bottom + fHeight * 0.2f), 2993 PWLPT_LINETO), 2994 CPWL_PathData( 2995 CPWL_Point(crBBox.right - fWidth / 30 - fWidth * 0.12f, 2996 crBBox.bottom + fHeight * 0.2f - 2997 (fWidth * 57 / 60.0f - fWidth * 0.24f) * 0.25f), 2998 PWLPT_BEZIERTO), 2999 CPWL_PathData( 3000 CPWL_Point(crBBox.left + fWidth / 60 + fWidth * 0.12f, 3001 crBBox.bottom + fHeight * 0.2f - 3002 (fWidth * 57 / 60.0f - fWidth * 0.24f) * 0.25f), 3003 PWLPT_BEZIERTO), 3004 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60 + fWidth * 0.12f, 3005 crBBox.bottom + fHeight * 0.2f), 3006 PWLPT_BEZIERTO), 3007 3008 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60 + fWidth * 0.12f, 3009 crBBox.top - fHeight * 0.2f), 3010 PWLPT_LINETO), 3011 CPWL_PathData( 3012 CPWL_Point(crBBox.left + fWidth / 60 + fWidth * 0.12f, 3013 crBBox.top - fHeight * 0.2f + 3014 (fWidth * 11 / 12.0f - fWidth * 0.36f) * 0.25f), 3015 PWLPT_BEZIERTO), 3016 CPWL_PathData( 3017 CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.24f, 3018 crBBox.top - fHeight * 0.2f + 3019 (fWidth * 11 / 12.0f - fWidth * 0.36f) * 0.25f), 3020 PWLPT_BEZIERTO), 3021 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.24f, 3022 crBBox.top - fHeight * 0.2f), 3023 PWLPT_BEZIERTO), 3024 3025 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.24f, 3026 crBBox.bottom + fHeight * 0.25f), 3027 PWLPT_LINETO), 3028 CPWL_PathData( 3029 CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.24f, 3030 crBBox.bottom + fHeight * 0.25f - 3031 (fWidth * 14 / 15.0f - fWidth * 0.53f) * 0.25f), 3032 PWLPT_BEZIERTO), 3033 CPWL_PathData( 3034 CPWL_Point(crBBox.left + fWidth * 0.29f, 3035 crBBox.bottom + fHeight * 0.25f - 3036 (fWidth * 14 / 15.0f - fWidth * 0.53f) * 0.25f), 3037 PWLPT_BEZIERTO), 3038 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.29f, 3039 crBBox.bottom + fHeight * 0.25f), 3040 PWLPT_BEZIERTO), 3041 3042 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.29f, 3043 crBBox.top - fHeight * 0.33f), 3044 PWLPT_LINETO), 3045 CPWL_PathData( 3046 CPWL_Point(crBBox.left + fWidth * 0.29f, 3047 crBBox.top - fHeight * 0.33f + fWidth * 0.12f * 0.35f), 3048 PWLPT_BEZIERTO), 3049 CPWL_PathData( 3050 CPWL_Point(crBBox.left + fWidth * 0.17f, 3051 crBBox.top - fHeight * 0.33f + fWidth * 0.12f * 0.35f), 3052 PWLPT_BEZIERTO), 3053 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.17f, 3054 crBBox.top - fHeight * 0.33f), 3055 PWLPT_BEZIERTO), 3056 3057 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.17f, 3058 crBBox.bottom + fHeight * 0.3f), 3059 PWLPT_LINETO), 3060 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.17f, 3061 crBBox.bottom + fHeight * 0.3f - 3062 fWidth * (14 / 15.0f - 0.29f) * 0.35f), 3063 PWLPT_BEZIERTO), 3064 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.12f, 3065 crBBox.bottom + fHeight * 0.3f - 3066 fWidth * (14 / 15.0f - 0.29f) * 0.35f), 3067 PWLPT_BEZIERTO), 3068 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.12f, 3069 crBBox.bottom + fHeight * 0.3f), 3070 PWLPT_BEZIERTO), 3071 3072 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.12f, 3073 crBBox.top - fHeight * 0.25f), 3074 PWLPT_LINETO), 3075 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15 - fWidth * 0.12f, 3076 crBBox.top - fHeight * 0.25f + 3077 fWidth * 0.35f * (11 / 12.0f - 0.12f)), 3078 PWLPT_BEZIERTO), 3079 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60, 3080 crBBox.top - fHeight * 0.25f + 3081 fWidth * 0.35f * (11 / 12.0f - 0.12f)), 3082 PWLPT_BEZIERTO), 3083 CPWL_PathData( 3084 CPWL_Point(crBBox.left + fWidth / 60, crBBox.top - fHeight * 0.25f), 3085 PWLPT_BEZIERTO)}; 3086 3087 if (type == PWLPT_STREAM) 3088 sPathData = GetAppStreamFromArray(PathArray, 33); 3089 else 3090 GetPathDataFromArray(path, PathArray, 33); 3091} 3092 3093void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData, 3094 CFX_PathData& path, 3095 const CFX_FloatRect& crBBox, 3096 const PWL_PATH_TYPE type) { 3097 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3098 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3099 3100 CPWL_PathData PathArray[] = { 3101 CPWL_PathData( 3102 CPWL_Point(crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.1f), 3103 PWLPT_MOVETO), 3104 CPWL_PathData( 3105 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.23f), 3106 PWLPT_LINETO), 3107 CPWL_PathData( 3108 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f), 3109 PWLPT_LINETO), 3110 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.4f, 3111 crBBox.top - fHeight * 0.5f + fWidth * 0.04f), 3112 PWLPT_BEZIERTO), 3113 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 3114 crBBox.top - fHeight * 0.5f + fWidth * 0.04f), 3115 PWLPT_BEZIERTO), 3116 CPWL_PathData( 3117 CPWL_Point(crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.5f), 3118 PWLPT_BEZIERTO), 3119 3120 CPWL_PathData( 3121 CPWL_Point(crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.23f), 3122 PWLPT_LINETO), 3123 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.25f, 3124 crBBox.top - fHeight * 0.1f), 3125 PWLPT_LINETO), 3126 CPWL_PathData( 3127 CPWL_Point(crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.1f), 3128 PWLPT_LINETO), 3129 CPWL_PathData( 3130 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.23f), 3131 PWLPT_LINETO), 3132 CPWL_PathData( 3133 CPWL_Point(crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.23f), 3134 PWLPT_LINETO), 3135 3136 CPWL_PathData( 3137 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f), 3138 PWLPT_MOVETO), 3139 CPWL_PathData( 3140 CPWL_Point(crBBox.left + fWidth * 0.4f - fWidth * 0.25f * 0.4f, 3141 crBBox.top - fHeight * 0.5f), 3142 PWLPT_BEZIERTO), 3143 CPWL_PathData( 3144 CPWL_Point(crBBox.left + fWidth * 0.15f, 3145 crBBox.top - fHeight * 0.65f + fHeight * 0.15f * 0.4f), 3146 PWLPT_BEZIERTO), 3147 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.15f, 3148 crBBox.top - fHeight * 0.65f), 3149 PWLPT_BEZIERTO), 3150 3151 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.15f, 3152 crBBox.top - fHeight * 0.65f), 3153 PWLPT_LINETO), 3154 CPWL_PathData( 3155 CPWL_Point(crBBox.right - fWidth * 0.15f, 3156 crBBox.top - fHeight * 0.65f + fHeight * 0.15f * 0.4f), 3157 PWLPT_BEZIERTO), 3158 CPWL_PathData( 3159 CPWL_Point(crBBox.left + fWidth * 0.6f + fWidth * 0.25f * 0.4f, 3160 crBBox.top - fHeight * 0.5f), 3161 PWLPT_BEZIERTO), 3162 CPWL_PathData( 3163 CPWL_Point(crBBox.left + fWidth * 0.6f, crBBox.top - fHeight * 0.5f), 3164 PWLPT_BEZIERTO), 3165 3166 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.6f, 3167 crBBox.top - fHeight * 0.5f + fWidth * 0.04f), 3168 PWLPT_BEZIERTO), 3169 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.4f, 3170 crBBox.top - fHeight * 0.5f + fWidth * 0.04f), 3171 PWLPT_BEZIERTO), 3172 CPWL_PathData( 3173 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f), 3174 PWLPT_BEZIERTO), 3175 3176 CPWL_PathData( 3177 CPWL_Point(crBBox.left + fWidth * 0.5f, crBBox.top - fHeight * 0.65f), 3178 PWLPT_MOVETO), 3179 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.5f, 3180 crBBox.bottom + fHeight * 0.1f), 3181 PWLPT_LINETO)}; 3182 3183 if (type == PWLPT_STREAM) 3184 sPathData = GetAppStreamFromArray(PathArray, 24); 3185 else 3186 GetPathDataFromArray(path, PathArray, 24); 3187} 3188 3189void CPWL_Utils::GetGraphics_Tag(CFX_ByteString& sPathData, 3190 CFX_PathData& path, 3191 const CFX_FloatRect& crBBox, 3192 const PWL_PATH_TYPE type) { 3193 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3194 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3195 3196 CPWL_PathData PathArray[] = { 3197 CPWL_PathData( 3198 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.1f), 3199 PWLPT_MOVETO), 3200 CPWL_PathData( 3201 CPWL_Point(crBBox.left + fWidth * 0.1f, crBBox.top - fHeight * 0.5f), 3202 PWLPT_LINETO), 3203 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.3f, 3204 crBBox.bottom + fHeight * 0.1f), 3205 PWLPT_LINETO), 3206 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 0.1f, 3207 crBBox.bottom + fHeight * 0.1f), 3208 PWLPT_LINETO), 3209 CPWL_PathData( 3210 CPWL_Point(crBBox.right - fWidth * 0.1f, crBBox.top - fHeight * 0.1f), 3211 PWLPT_LINETO), 3212 CPWL_PathData( 3213 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.1f), 3214 PWLPT_LINETO), 3215 CPWL_PathData( 3216 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.3f), 3217 PWLPT_MOVETO), 3218 CPWL_PathData( 3219 CPWL_Point(crBBox.right - fWidth * 0.2f, crBBox.top - fHeight * 0.3f), 3220 PWLPT_LINETO), 3221 CPWL_PathData( 3222 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.5f), 3223 PWLPT_MOVETO), 3224 CPWL_PathData( 3225 CPWL_Point(crBBox.right - fWidth * 0.2f, crBBox.top - fHeight * 0.5f), 3226 PWLPT_LINETO), 3227 CPWL_PathData( 3228 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.7f), 3229 PWLPT_MOVETO), 3230 CPWL_PathData( 3231 CPWL_Point(crBBox.right - fWidth * 0.2f, crBBox.top - fHeight * 0.7f), 3232 PWLPT_LINETO)}; 3233 3234 if (type == PWLPT_STREAM) 3235 sPathData = GetAppStreamFromArray(PathArray, 12); 3236 else 3237 GetPathDataFromArray(path, PathArray, 12); 3238} 3239 3240void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, 3241 CFX_PathData& path, 3242 const CFX_FloatRect& crBBox, 3243 const PWL_PATH_TYPE type) { 3244 FX_FLOAT fOutWidth = crBBox.right - crBBox.left; 3245 FX_FLOAT fOutHeight = crBBox.top - crBBox.bottom; 3246 3247 CFX_FloatRect crInBox = crBBox; 3248 crInBox.left = crBBox.left + fOutWidth * 0.08f; 3249 crInBox.right = crBBox.right - fOutWidth * 0.08f; 3250 crInBox.top = crBBox.top - fOutHeight * 0.08f; 3251 crInBox.bottom = crBBox.bottom + fOutHeight * 0.08f; 3252 3253 FX_FLOAT fWidth = crInBox.right - crInBox.left; 3254 FX_FLOAT fHeight = crInBox.top - crInBox.bottom; 3255 3256 CPWL_PathData PathArray[] = { 3257 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_MOVETO), 3258 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.45f, crInBox.top), 3259 PWLPT_LINETO), 3260 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.45f, 3261 crInBox.top - FX_BEZIER * fHeight * 0.4f), 3262 PWLPT_BEZIERTO), 3263 CPWL_PathData( 3264 CPWL_Point(crInBox.left + fWidth * 0.45f - FX_BEZIER * fWidth * 0.45f, 3265 crInBox.top - fHeight * 0.4f), 3266 PWLPT_BEZIERTO), 3267 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight * 0.4f), 3268 PWLPT_BEZIERTO), 3269 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_LINETO), 3270 3271 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.60f, crInBox.top), 3272 PWLPT_MOVETO), 3273 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.75f, crInBox.top), 3274 PWLPT_LINETO), 3275 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.75f, 3276 crInBox.top - FX_BEZIER * fHeight * 0.7f), 3277 PWLPT_BEZIERTO), 3278 CPWL_PathData( 3279 CPWL_Point(crInBox.left + fWidth * 0.75f - FX_BEZIER * fWidth * 0.75f, 3280 crInBox.top - fHeight * 0.7f), 3281 PWLPT_BEZIERTO), 3282 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight * 0.7f), 3283 PWLPT_BEZIERTO), 3284 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight * 0.55f), 3285 PWLPT_LINETO), 3286 CPWL_PathData(CPWL_Point(crInBox.left + FX_BEZIER * fWidth * 0.60f, 3287 crInBox.top - fHeight * 0.55f), 3288 PWLPT_BEZIERTO), 3289 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.60f, 3290 crInBox.top - FX_BEZIER * fHeight * 0.55f), 3291 PWLPT_BEZIERTO), 3292 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.60f, crInBox.top), 3293 PWLPT_BEZIERTO), 3294 3295 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.90f, crInBox.top), 3296 PWLPT_MOVETO), 3297 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.90f, 3298 crInBox.top - FX_BEZIER * fHeight * 0.85f), 3299 PWLPT_BEZIERTO), 3300 CPWL_PathData( 3301 CPWL_Point(crInBox.left + fWidth * 0.90f - FX_BEZIER * fWidth * 0.90f, 3302 crInBox.top - fHeight * 0.85f), 3303 PWLPT_BEZIERTO), 3304 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight * 0.85f), 3305 PWLPT_BEZIERTO), 3306 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.bottom), PWLPT_LINETO), 3307 CPWL_PathData(CPWL_Point(crInBox.right, crInBox.bottom), PWLPT_LINETO), 3308 CPWL_PathData(CPWL_Point(crInBox.right, crInBox.top), PWLPT_LINETO), 3309 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.90f, crInBox.top), 3310 PWLPT_LINETO), 3311 }; 3312 3313 if (type == PWLPT_STREAM) 3314 sPathData = GetAppStreamFromArray(PathArray, 23); 3315 else 3316 GetPathDataFromArray(path, PathArray, 23); 3317} 3318 3319void CPWL_Color::ConvertColorType(int32_t nConvertColorType) { 3320 if (nColorType == nConvertColorType) 3321 return; 3322 3323 switch (nColorType) { 3324 case COLORTYPE_TRANSPARENT: 3325 break; 3326 case COLORTYPE_GRAY: 3327 switch (nConvertColorType) { 3328 case COLORTYPE_RGB: 3329 CPWL_Utils::ConvertGRAY2RGB(fColor1, fColor1, fColor2, fColor3); 3330 break; 3331 case COLORTYPE_CMYK: 3332 CPWL_Utils::ConvertGRAY2CMYK(fColor1, fColor1, fColor2, fColor3, 3333 fColor4); 3334 break; 3335 } 3336 break; 3337 case COLORTYPE_RGB: 3338 switch (nConvertColorType) { 3339 case COLORTYPE_GRAY: 3340 CPWL_Utils::ConvertRGB2GRAY(fColor1, fColor2, fColor3, fColor1); 3341 break; 3342 case COLORTYPE_CMYK: 3343 CPWL_Utils::ConvertRGB2CMYK(fColor1, fColor2, fColor3, fColor1, 3344 fColor2, fColor3, fColor4); 3345 break; 3346 } 3347 break; 3348 case COLORTYPE_CMYK: 3349 switch (nConvertColorType) { 3350 case COLORTYPE_GRAY: 3351 CPWL_Utils::ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4, 3352 fColor1); 3353 break; 3354 case COLORTYPE_RGB: 3355 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, 3356 fColor1, fColor2, fColor3); 3357 break; 3358 } 3359 break; 3360 } 3361 nColorType = nConvertColorType; 3362} 3363