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