145 switch (nPixelOffset)
217 return (!((flags >> 15) & 0x0001));
223 return "EmfPlusBrush ID: " + OUString::number(brushid);
225 return "ARGB: 0x" + OUString::number(brushid, 16);
253 SAL_WARN(
"drawinglayer.emf",
"EMF+\t Converting to World/Display.");
257 SAL_WARN(
"drawinglayer.emf",
"EMF+\tTODO Unimplemented support of Unit Type: 0x" << std::hex << aUnitType);
264 sal_uInt16 objecttype = flags & 0x7f00;
265 sal_uInt16
index = flags & 0xff;
267 SAL_INFO(
"drawinglayer.emf",
"EMF+\tObject slot: " <<
index);
268 SAL_INFO(
"drawinglayer.emf",
"EMF+\tFlags: " << (flags & 0xff00));
276 brush->
Read(rObjectStream, *
this);
283 pen->
Read(rObjectStream, *
this);
289 sal_uInt32 aVersion, aPathPointCount, aPathPointFlags;
292 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\tVersion: 0x" << std::hex << aVersion);
293 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\tNumber of points: " << std::dec << aPathPointCount);
294 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\tPath point flags: 0x" << std::hex << aPathPointFlags << std::dec);
297 path->
Read(rObjectStream, aPathPointFlags);
316 image->
Read(rObjectStream, dataSize, bUseWholeStream);
326 font->
Read(rObjectStream);
336 stringFormat->
Read(rObjectStream);
343 imageAttributes->
Read(rObjectStream);
348 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO Object type 'custom line cap' not yet implemented");
353 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO Object unhandled flags: 0x" << std::hex << (flags & 0xff00) << std::dec);
365 SAL_WARN(
"drawinglayer.emf",
"EMF+\t\t TODO Relative coordinates bit detected. Implement parse EMFPlusPointR");
387 sal_Int16 ix, iy, iw, ih;
406 if (
sizeof(
float) != 4)
408 OSL_FAIL(
"EnhWMFReader::sizeof( float ) != 4");
432 SAL_WARN(
"drawinglayer.emf",
"dimensions in pixels is 0");
466 (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff);
475 SAL_WARN(
"drawinglayer.emf",
"EMF+\t\t TODO Brush other than solid color is not supported");
483 GraphicStateMap::iterator iter =
map.find(
index );
485 if ( iter !=
map.end() )
488 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\tStack index: " <<
index <<
" found and erased");
499 GraphicStateMap::iterator iter =
map.find(
index);
501 if (iter !=
map.end())
509 "EMF+\t Restore clipping region to saved in index: " <<
index);
515 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Disable clipping");
521 "EMF+\t\tStack index: " <<
index
533 { {-1.0, -1.0}, {1.0, -1.0}, {1.0, 1.0}, {-1.0, 1.0} });
541 { {-1.0, 1.0}, {1.0, 1.0}, {1.0, 0.0}, {0.9236, -0.3827},
542 {0.7071, -0.7071}, {0.3827, -0.9236}, {0.0, -1.0}, {-0.3827, -0.9236},
543 {-0.7071, -0.7071}, {-0.9236, -0.3827}, {-1.0, 0.0} });
551 { {-1.0, 1.0}, {1.0, 1.0}, {1.0, 0.0}, {0.0, -1.0}, {-1.0, 0.0} });
559 { {-1.0, -1.0}, {1.0, -1.0}, {1.0, 1.0}, {-1.0, 1.0} });
574 {0.5, 1.0}, {-0.5, 1.0}, {-0.5, 0.5},
594 SAL_WARN_IF(!pen,
"drawinglayer.emf",
"emf+ missing pen");
596 if (!(pen && polygon.count()))
602 css::drawing::LineCap_BUTT,
640 aContainer.resize(polygon.count());
641 for (sal_uInt32
i = 0;
i < polygon.count();
i++)
644 polygon.getB2DPolygon(
i), lineAttribute,
658 for (sal_uInt32
i = 0;
i < polygon.count();
i++)
662 polygon.getB2DPolygon(
i), lineAttribute,
673 if (
color.GetAlpha() == 0)
676 if (!
color.IsTransparent())
694 (255 -
color.GetAlpha()) / 255.0));
700 if (!polygon.count())
705 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\t Fill polygon, ARGB color: 0x" << std::hex << brushIndexOrColor << std::dec);
709 const Color color(
ColorAlpha, (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff);
719 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\t Fill polygon, brush slot: " << brushIndexOrColor <<
" (brush type: " << (brush ? brush->
GetType() : -1) <<
")");
738 bool isHatchBlend =
true;
739 double blendFactor = 0.0;
756 isHatchBlend =
false;
778 SAL_WARN(
"drawinglayer.emf",
"EMF+\tTODO: implement BrushTypeTextureFill brush");
785 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO Implement displaying BrushTypePathGradient with Boundary: ");
795 aInvertedMapTrasform.
invert();
796 aTextureTransformation =
maMapTransform * aTextureTransformation * aInvertedMapTrasform;
806 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\tUse blend");
817 aVector.emplace_back(aBlendPoint, aColor, aAlpha / 255.0);
822 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\tUse color blend");
829 aVector.emplace_back(aBlendPoint, aColor, brush->
colorblendColors[
i].GetAlpha() / 255.0);
844 aPolygonTransformation.
invert();
850 aStartPoint = aPolygonTransformation * aStartPoint;
852 aEndPoint = aPolygonTransformation * aEndPoint;
877 aTextureTransformation,
888 aCenterPoint = aPolygonTransformation * aCenterPoint;
893 aTextureTransformation,
915 mbSetTextContrast(false),
927 mdExtractedXScale(1.0),
928 mdExtractedYScale(1.0),
929 mrTargetHolders(rTargetHolders),
930 mrPropertyHolders(rPropertyHolders),
931 bIsGetDCProcessing(false)
953 aClippedPolyPolygon = rightPolygon;
959 leftPolygon, rightPolygon,
true,
false);
964 aClippedPolyPolygon = ::basegfx::utils::solvePolygonOperationOr(leftPolygon, rightPolygon);
969 aClippedPolyPolygon = ::basegfx::utils::solvePolygonOperationXor(leftPolygon, rightPolygon);
975 aClippedPolyPolygon = ::basegfx::utils::solvePolygonOperationDiff(leftPolygon, rightPolygon);
981 aClippedPolyPolygon = ::basegfx::utils::solvePolygonOperationDiff(rightPolygon, leftPolygon);
985 return aClippedPolyPolygon;
995 SAL_WARN(
"drawinglayer.emf",
"length is less than required header size");
1000 sal_uInt16
type, flags;
1001 sal_uInt32
size, dataSize;
1010 SAL_WARN(
"drawinglayer.emf",
"Size field is less than 12 bytes");
1015 SAL_WARN(
"drawinglayer.emf",
"Size field is greater than bytes left");
1019 if (dataSize > (
size - 12))
1021 SAL_WARN(
"drawinglayer.emf",
"DataSize field is greater than Size-12");
1026 SAL_INFO(
"drawinglayer.emf",
"EMF+\t record size: " <<
size);
1027 SAL_INFO(
"drawinglayer.emf",
"EMF+\t flags: 0x" << std::hex << flags << std::dec);
1028 SAL_INFO(
"drawinglayer.emf",
"EMF+\t data size: " << dataSize);
1034 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Restore region to GetDC saved");
1040 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Disable clipping");
1055 OSL_ENSURE(dataSize >= 4,
"No room for TotalObjectSize in EmfPlusContinuedObjectRecord");
1059 SAL_INFO(
"drawinglayer.emf",
"EMF+ read next object part size: " <<
size <<
" type: " <<
type <<
" flags: " << flags <<
" data size: " << dataSize);
1065 SAL_INFO(
"drawinglayer.emf",
"EMF+ multipart record flags: " <<
mMFlags);
1079 sal_uInt32
header, version;
1082 SAL_INFO(
"drawinglayer.emf",
"EMF+\tHeader: 0x" << std::hex <<
header);
1083 SAL_INFO(
"drawinglayer.emf",
"EMF+\tVersion: " << std::dec << version);
1084 SAL_INFO(
"drawinglayer.emf",
"EMF+\tHorizontal DPI: " <<
mnHDPI);
1086 SAL_INFO(
"drawinglayer.emf",
"EMF+\tDual: " << ((flags & 1) ?
"true" :
"false"));
1095#if OSL_DEBUG_LEVEL > 1
1099 SAL_INFO(
"drawinglayer.emf",
"EMF+\tDatasize: 0x" << std::hex << dataSize << std::dec);
1101 for (sal_uInt32
i=0;
i<dataSize;
i++)
1109 if ((data & 0xF0) == 0)
1112 hexdata +=
"0x" + padding + OUString::number(data, 16) +
" ";
1115 SAL_INFO(
"drawinglayer.emf",
"EMF+\t" << hexdata);
1123 SAL_INFO(
"drawinglayer.emf",
"EMF+\tAlready used in svtools wmf/emf filter parser");
1135 float startAngle, sweepAngle;
1138 sal_uInt32 brushIndexOrColor = 999;
1143 SAL_INFO(
"drawinglayer.emf",
"EMF+\t FillPie colorOrIndex: " << brushIndexOrColor);
1147 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawPie");
1151 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawArc");
1155 float dx, dy, dw, dh;
1157 SAL_INFO(
"drawinglayer.emf",
"EMF+\t RectData: " << dx <<
"," << dy <<
" " << dw <<
"x" << dh);
1160 float endAngle = startAngle + sweepAngle;
1161 startAngle = fmodf(startAngle,
static_cast<float>(M_PI * 2));
1163 if (startAngle < 0.0)
1165 startAngle +=
static_cast<float>(M_PI * 2.0);
1167 endAngle = fmodf(endAngle,
static_cast<float>(M_PI * 2.0));
1171 endAngle +=
static_cast<float>(M_PI * 2.0);
1175 std::swap(endAngle, startAngle);
1178 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Adjusted angles: start " <<
1180 " startAngle: " << startAngle <<
" sweepAngle: " << sweepAngle);
1181 const ::basegfx::B2DPoint centerPoint(dx + 0.5 * dw, dy + 0.5 * dh);
1183 ::basegfx::utils::createPolygonFromEllipseSegment(centerPoint,
1185 startAngle, endAngle));
1188 polygon.
append(centerPoint);
1201 sal_uInt32
index = flags & 0xff;
1202 sal_uInt32 brushIndexOrColor;
1204 SAL_INFO(
"drawinglayer.emf",
"EMF+ FillPath slot: " <<
index);
1210 SAL_WARN(
"drawinglayer.emf",
"EMF+\tEmfPlusRecordTypeFillPath missing path");
1215 sal_uInt32
index = flags & 0xff;
1216 sal_uInt32 brushIndexOrColor;
1218 SAL_INFO(
"drawinglayer.emf",
"EMF+\t FillRegion slot: " <<
index);
1224 SAL_WARN(
"drawinglayer.emf",
"EMF+\tEmfPlusRecordTypeFillRegion missing region");
1233 sal_uInt32 brushIndexOrColor = 1234567;
1241 float dx, dy, dw, dh;
1243 SAL_INFO(
"drawinglayer.emf",
"EMF+\t RectData: " << dx <<
"," << dy <<
" " << dw <<
"x" << dh);
1245 ::basegfx::utils::createPolygonFromEllipse(
::basegfx::B2DPoint(dx + 0.5 * dw, dy + 0.5 * dh),
1246 0.5 * dw, 0.5 * dh));
1258 sal_uInt32 brushIndexOrColor = 999;
1260 sal_uInt32 rectangles;
1261 float x,
y, width, height;
1262 const bool isColor = (flags & 0x8000);
1267 SAL_INFO(
"drawinglayer.emf",
"EMF+\t FillRects");
1269 SAL_INFO(
"drawinglayer.emf",
"EMF+\t" << (
isColor ?
"color" :
"brush index") <<
": 0x" << std::hex << brushIndexOrColor << std::dec);
1273 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawRects");
1277 for (sal_uInt32
i = 0;
i < rectangles;
i++)
1287 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\t rectangle: " <<
x <<
", "<<
y <<
" " << width <<
"x" << height);
1288 polyPolygon.
append(polygon);
1298 sal_uInt32 brushIndexOrColor, points;
1302 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Points: " << points);
1303 SAL_INFO(
"drawinglayer.emf",
"EMF+\t " << ((flags & 0x8000) ?
"Color" :
"Brush index") <<
" : 0x" << std::hex << brushIndexOrColor << std::dec);
1306 path.
Read(rMS, flags);
1315 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Points: " << points);
1317 path.
Read(rMS, flags);
1327 sal_uInt32 penIndex;
1329 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Pen: " << penIndex);
1335 SAL_WARN(
"drawinglayer.emf",
"\t\tEmfPlusRecordTypeDrawPath missing path");
1342 float x1, y1, x2, y2, x3, y3, x4, y4;
1345 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawBeziers slot: " << (flags & 0xff));
1346 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Number of points: " << aCount);
1347 SAL_WARN_IF((aCount - 1) % 3 != 0,
"drawinglayer.emf",
1348 "EMF+\t Bezier Draw not support number of points other than 4, 7, "
1353 SAL_WARN(
"drawinglayer.emf",
"EMF+\t Bezier Draw does not support less "
1354 "than 4 points. Number of points: "
1363 "EMF+\t Bezier starting point: " << x1 <<
"," << y1);
1364 for (sal_uInt32
i = 4;
i <= aCount;
i += 3)
1371 "EMF+\t Bezier points: " << x2 <<
"," << y2 <<
" " << x3 <<
","
1372 << y3 <<
" " << x4 <<
"," << y4);
1380 sal_uInt32 aOffset, aNumSegments, points;
1387 "EMF+\t Tension: " << aTension <<
" Offset: " << aOffset
1388 <<
" NumSegments: " << aNumSegments
1389 <<
" Points: " << points);
1392 path.
Read(rMS, flags);
1399 SAL_WARN(
"drawinglayer.emf",
"Not enough number of points");
1406 sal_uInt32 brushIndexOrColor = 999, points;
1413 "EMF+\t Fill Mode: " << (flags & 0x2000 ?
"Winding" :
"Alternate"));
1418 "EMF+\t Tension: " << aTension <<
" Points: " << points);
1420 "EMF+\t " << (flags & 0x8000 ?
"Color" :
"Brush index") <<
" : 0x"
1421 << std::hex << brushIndexOrColor << std::dec);
1424 SAL_WARN(
"drawinglayer.emf",
"Not enough number of points");
1428 path.
Read(rMS, flags);
1431 flags & 0x8000, brushIndexOrColor);
1440 sal_uInt32 imageAttributesId;
1441 sal_Int32 sourceUnit;
1445 :
"DrawImagePoints")
1446 <<
" image attributes Id: " << imageAttributesId
1447 <<
" source unit: " << sourceUnit);
1448 SAL_INFO(
"drawinglayer.emf",
"EMF+\t TODO: use image attributes");
1455 float sx, sy,
sw, sh;
1462 :
"DrawImagePoints")
1463 <<
" source rectangle: " << sx <<
"," << sy <<
" " <<
sw <<
"x"
1466 float dx(0.), dy(0.), dw(0.), dh(0.);
1467 double fShearX = 0.0;
1468 double fShearY = 0.0;
1477 SAL_WARN(
"drawinglayer.emf",
"EMF+\t Wrong EMF+ file. Expected "
1478 "3 points, received: "
1482 float x1, y1, x2, y2, x3, y3;
1488 SAL_INFO(
"drawinglayer.emf",
"EMF+\t destination points: "
1489 << x1 <<
"," << y1 <<
" " << x2 <<
","
1490 << y2 <<
" " << x3 <<
"," << y3);
1502 "EMF+\t Rectangle: " << dx <<
"," << dy <<
" " << dw <<
"x" << dh);
1506 aSize = image->graphic.GetBitmapEx().GetSizePixel();
1507 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Bitmap size: " << aSize.
Width()
1513 dx = dx + ((-sx) /
sw) * dw;
1515 dw = ((
sw + sx) /
sw) * dw;
1517 dw = (aSize.
Width() /
sw) * dw;
1519 else if (sx +
sw > aSize.
Width())
1521 dw = ((aSize.
Width() - sx) /
sw) * dw;
1525 dy = dy + ((-sy) / sh) * dh;
1526 if (sy + sh <= aSize.
Height())
1527 dh = ((sh + sy) / sh) * dh;
1529 dh = (aSize.
Height() / sh) * dh;
1531 else if (sy + sh > aSize.
Height())
1532 dh = ((aSize.
Height() - sy) / sh) * dh;
1537 "EMF+\t TODO: Add support for SrcRect to ImageDataTypeMetafile");
1538 const ::basegfx::B2DPoint aDstPoint(dx, dy);
1539 const ::basegfx::B2DSize aDstSize(dw, dh);
1544 aDstSize.getWidth(),
1548 aDstSize.getHeight(),
1553 BitmapEx aBmp(image->graphic.GetBitmapEx());
1560 aBmp, aTransformMatrix));
1563 SAL_WARN(
"drawinglayer.emf",
"EMF+\t warning: empty bitmap");
1567 GDIMetaFile aGDI(image->graphic.GetGDIMetaFile());
1577 "EMF+\tDrawImage(Points) Wrong EMF+ file. Only Unit Type Pixel is "
1578 "support by EMF+ specification for DrawImage(Points)");
1584 sal_uInt32 brushId, formatId, stringLength;
1586 SAL_INFO(
"drawinglayer.emf",
"EMF+\t FontId: " << OUString::number(flags & 0xFF));
1588 SAL_INFO(
"drawinglayer.emf",
"EMF+\t FormatId: " << formatId);
1589 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Length: " << stringLength);
1592 float lx, ly, lw, lh;
1595 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawString layoutRect: " << lx <<
"," << ly <<
" - " << lw <<
"x" << lh);
1598 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawString string: " <<
text);
1612 font->
Bold() ? 8u : 1u,
1613 font->
family ==
"SYMBOL",
1621 css::lang::Locale locale;
1622 double stringAlignmentHorizontalOffset = 0.0;
1623 double stringAlignmentVerticalOffset = font->
emSize;
1635 "EMF+\t DrawString Alignment TODO For a right-to-left layout rectangle, the origin should be at the upper right.");
1644 stringAlignmentHorizontalOffset = lw - stringFormat->
trailingMargin * font->
emSize - fTextWidth;
1647 stringAlignmentVerticalOffset = font->
emSize;
1649 stringAlignmentVerticalOffset = 0.5 * lh + 0.5 * font->
emSize;
1651 stringAlignmentVerticalOffset = lh;
1657 stringAlignmentHorizontalOffset = 16.0;
1666 ly + stringAlignmentVerticalOffset));
1674 const basegfx::BColorModifier_gamma gamma(gammaVal);
1678 alpha = std::clamp(std::pow(
alpha, 1.0 / gammaVal), 0.0, 1.0) * 255;
1688 color = uncorrectedColor;
1694 if (
color.GetAlpha() > 0)
1696 std::vector<double> emptyVector;
1705 std::move(emptyVector),
1725 std::move(emptyVector),
1732 if (
color.IsTransparent())
1736 (255 -
color.GetAlpha()) / 255.0);
1753 SAL_WARN(
"drawinglayer.emf",
"EMF+\t file error. UnitTypeDisplay and UnitTypeWorld are not supported by SetPageTransform in EMF+ specification.");
1771 const sal_uInt16 LOWERGAMMA = 1000;
1772 const sal_uInt16 UPPERGAMMA = 2200;
1777 "drawinglayer.emf",
"EMF+\t Gamma value is not with bounds 1000 to 2200, value is " <<
mnTextContrast);
1785 sal_uInt8 nTextRenderingHint = (flags & 0xFF) >> 1;
1787 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO SetTextRenderingHint");
1792 bool bUseAntiAlias = (flags & 0x0001);
1793 sal_uInt8 nSmoothingMode = (flags & 0xFE00) >> 1;
1794 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Antialiasing: " << (bUseAntiAlias ?
"enabled" :
"disabled"));
1796 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO SetAntiAliasMode");
1801 sal_uInt16 nInterpolationMode = flags & 0xFF;
1803 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO InterpolationMode");
1809 SAL_WARN(
"drawinglayer.emf",
"EMF+\t TODO SetPixelOffsetMode");
1814 SAL_INFO(
"drawinglayer.emf",
"EMF+\t TODO SetCompositingQuality");
1819 sal_uInt32 stackIndex;
1821 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Save stack index: " << stackIndex);
1829 sal_uInt32 stackIndex;
1831 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Restore stack index: " << stackIndex);
1838 float dx, dy, dw, dh;
1840 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Dest RectData: " << dx <<
"," << dy <<
" " << dw <<
"x" << dh);
1842 float sx, sy,
sw, sh;
1844 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Source RectData: " << sx <<
"," << sy <<
" " <<
sw <<
"x" << sh);
1846 sal_uInt32 stackIndex;
1848 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Begin Container stack index: " << stackIndex <<
", PageUnit: " << flags);
1852 SAL_WARN(
"drawinglayer.emf",
"EMF+\t file error. UnitTypeDisplay and UnitTypeWorld are not supported by BeginContainer in EMF+ specification.");
1859 aPageScaleX * ( dw /
sw ), aPageScaleY * ( dh / sh ),
1860 aPageScaleX * ( dx - sx ), aPageScaleY * ( dy - sy) );
1867 sal_uInt32 stackIndex;
1869 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Begin Container No Params stack index: " << stackIndex);
1876 sal_uInt32 stackIndex;
1878 SAL_INFO(
"drawinglayer.emf",
"EMF+\t End Container stack index: " << stackIndex);
1885 SAL_INFO(
"drawinglayer.emf",
"EMF+\t SetWorldTransform, Post multiply: " <<
bool(flags & 0x2000));
1900 SAL_INFO(
"drawinglayer.emf",
"EMF+\t MultiplyWorldTransform, post multiply: " <<
bool(flags & 0x2000));
1905 "EMF+\t Transform matrix: " << transform);
1927 SAL_INFO(
"drawinglayer.emf",
"EMF+\t TranslateWorldTransform, Post multiply: " <<
bool(flags & 0x2000));
1932 transform.
set(0, 2, eDx);
1933 transform.
set(1, 2, eDy);
1936 "EMF+\t Translate matrix: " << transform);
1961 transform.
set(0, 0, eSx);
1962 transform.
set(1, 1, eSy);
1964 SAL_INFO(
"drawinglayer.emf",
"EMF+\t ScaleWorldTransform Sx: " << eSx <<
1965 " Sy: " << eSy <<
", Post multiply:" <<
bool(flags & 0x2000));
1993 SAL_INFO(
"drawinglayer.emf",
"EMF+\t RotateWorldTransform Angle: " << eAngle <<
1994 ", post multiply: " <<
bool(flags & 0x2000));
2006 SAL_INFO(
"drawinglayer.emf",
"EMF+ ResetClip");
2018 int combineMode = (flags >> 8) & 0xf;
2022 SAL_INFO(
"drawinglayer.emf",
"EMF+\t SetClipRect");
2024 float dx, dy, dw, dh;
2027 "EMF+\t RectData: " << dx <<
"," << dy <<
" " << dw <<
"x" << dh);
2034 mappedPoint2.
getX(), mappedPoint2.
getY())));
2038 SAL_INFO(
"drawinglayer.emf",
"EMF+\tSetClipPath " << (flags & 0xff));
2044 "EMF+\t TODO Unable to find path in slot: " << (flags & 0xff));
2051 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Region in slot: " << (flags & 0xff));
2058 "EMF+\t TODO Unable to find region in slot: " << (flags & 0xff));
2063 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Combine mode: " << combineMode);
2069 combineMode, polyPolygon);
2074 switch (combineMode)
2079 aClippedPolyPolygon = polyPolygon;
2092 aClippedPolyPolygon = polyPolygon;
2110 SAL_INFO(
"drawinglayer.emf",
"EMF+\tOffset x:" << dx <<
", y:" << dy);
2116 "EMF+\t PolyPolygon before translate: " << aPolyPolygon);
2120 transformMatrix.
set(0, 2, aOffset.
getX());
2121 transformMatrix.
set(1, 2, aOffset.
getY());
2122 aPolyPolygon.
transform(transformMatrix);
2125 "EMF+\t PolyPolygon after translate: " << aPolyPolygon <<
2126 ", mapped offset x" << aOffset.
getX() <<
", mapped offset y" << aOffset.
getY());
2132 sal_uInt32 brushIndexOrColor;
2133 sal_uInt32 optionFlags;
2134 sal_uInt32 hasMatrix;
2135 sal_uInt32 glyphsCount;
2137 SAL_INFO(
"drawinglayer.emf",
"EMF+\t " << ((flags & 0x8000) ?
"Color" :
"Brush index") <<
": 0x" << std::hex << brushIndexOrColor << std::dec);
2138 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Option flags: 0x" << std::hex << optionFlags << std::dec);
2139 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Has matrix: " << hasMatrix);
2140 SAL_INFO(
"drawinglayer.emf",
"EMF+\t Glyphs: " << glyphsCount);
2142 if ((optionFlags & 1) && glyphsCount > 0)
2144 std::unique_ptr<float[]> charsPosX(
new float[glyphsCount]);
2145 std::unique_ptr<float[]> charsPosY(
new float[glyphsCount]);
2147 SAL_INFO(
"drawinglayer.emf",
"EMF+\t DrawDriverString string: " <<
text);
2149 for (sal_uInt32
i = 0;
i<glyphsCount;
i++)
2152 SAL_INFO(
"drawinglayer.emf",
"EMF+\t\t glyphPosition[" <<
i <<
"]: " << charsPosX[
i] <<
"," << charsPosY[
i]);
2160 SAL_INFO(
"drawinglayer.emf",
"EMF+\tmatrix: " << transform);
2174 font->
Bold() ? 8u : 1u,
2175 font->
family ==
"SYMBOL",
2188 while (
pos < glyphsCount)
2191 sal_uInt32 aLength = 1;
2192 while (
pos + aLength < glyphsCount && std::abs( charsPosY[
pos + aLength] - charsPosY[
pos] ) < std::numeric_limits< float >::epsilon())
2196 std::vector<double> aDXArray;
2197 for (
size_t i = 0;
i < aLength - 1;
i++)
2199 aDXArray.push_back(charsPosX[
pos +
i + 1] - charsPosX[
pos]);
2202 aDXArray.push_back(0);
2208 transformMatrix *= transform;
2209 if (
color.GetAlpha() > 0)
2219 std::move(aDXArray),
2239 std::move(aDXArray),
2246 if (
color.IsTransparent())
2250 (255 -
color.GetAlpha()) / 255.0);
2264 SAL_WARN(
"drawinglayer.emf",
"EMF+\tTODO: fonts (non-unicode glyphs chars)");
2270 SAL_WARN(
"drawinglayer.emf",
"EMF+ TODO unhandled record type: 0x" << std::hex <<
type << std::dec);
2283 SAL_WARN(
"drawinglayer.emf",
"ImplRenderer::processEMFPlus: "
constexpr sal_Int8 header[]
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
bool Crop(const tools::Rectangle &rRectPixel)
const Size & GetSizePixel() const
basegfx::BColor getBColor() const
void Merge(const Color &rMergeColor, sal_uInt8 cTransparency)
sal_uInt8 GetAlpha() const
bool IsTransparent() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvStream & ReadInt16(sal_Int16 &rInt16)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & ReadFloat(float &rFloat)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadInt32(sal_Int32 &rInt32)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
SvStream & ReadUChar(unsigned char &rChar)
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
void rotate(double fRadiant)
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
void setBlue(double fNew)
void setGreen(double fNew)
PolyPolygonColorPrimitive2D class.
PolyPolygonStrokePrimitive2D class.
PolygonStrokeArrowPrimitive2D class.
void append(const Primitive2DReference &)
the basic linear gradient primitive
the basic radial gradient primitive
TextDecoratedPortionPrimitive2D class.
TextLayouterDevice class.
void setFontAttribute(const attribute::FontAttribute &rFontAttribute, double fFontScaleX, double fFontScaleY, const css::lang::Locale &rLocale)
double getTextWidth(const OUString &rText, sal_uInt32 nIndex, sal_uInt32 nLength) const
TextSimplePortionPrimitive2D class.
UnifiedTransparencePrimitive2D class.
::basegfx::B2DPolyPolygon & GetClosedCardinalSpline(EmfPlusHelperData const &rR, float fTension)
::basegfx::B2DPolyPolygon & GetPolygon(EmfPlusHelperData const &rR, bool bMapIt=true, bool bAddLineToCloseShape=false)
::basegfx::B2DPolyPolygon & GetCardinalSpline(EmfPlusHelperData const &rR, float fTension, sal_uInt32 aOffset, sal_uInt32 aNumSegments)
void Read(SvStream &s, sal_uInt32 pathFlags)
helper class for graphic context
void setFont(const vcl::Font &rFont)
const basegfx::B2DHomMatrix & getTransformation() const
read/write accesses
const basegfx::B2DPolyPolygon & getClipPolyPolygon() const
void setLineColorActive(bool bNew)
void setTransformation(const basegfx::B2DHomMatrix &rNew)
void setFillColorActive(bool bNew)
void setFillColor(const basegfx::BColor &rNew)
void setLineColor(const basegfx::BColor &rNew)
void setTextColor(const basegfx::BColor &rNew)
bool getClipPolyPolygonActive() const
void setTextColorActive(bool bNew)
PropertyHolder & Current()
void append(const rtl::Reference< drawinglayer::primitive2d::BasePrimitive2D > &pCandidate)
Helper class which builds a stack on the TargetHolder class.
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define EmfPlusRecordTypeSetPageTransform
#define EmfPlusRecordTypeSetTextContrast
#define EmfPlusRecordTypeDrawPie
#define EmfPlusRecordTypeDrawArc
#define EmfPlusRecordTypeDrawDriverString
#define EmfPlusRecordTypeDrawImage
#define EmfPlusRecordTypeDrawLines
#define EmfPlusRecordTypeFillRects
#define EmfPlusRecordTypeSetRenderingOrigin
#define EmfPlusObjectTypePath
#define EmfPlusRecordTypeSave
#define EmfPlusRecordTypeGetDC
#define EmfPlusObjectTypeFont
#define EmfPlusRecordTypeBeginContainerNoParams
#define EmfPlusRecordTypeEndContainer
#define EmfPlusRecordTypeSetClipRegion
#define EmfPlusRecordTypeScaleWorldTransform
#define EmfPlusRecordTypeSetWorldTransform
#define EmfPlusRecordTypeDrawCurve
#define EmfPlusRecordTypeDrawImagePoints
#define EmfPlusRecordTypeSetClipRect
#define EmfPlusRecordTypeDrawClosedCurve
#define EmfPlusObjectTypeCustomLineCap
#define EmfPlusRecordTypeSetCompositingQuality
#define EmfPlusObjectTypeBrush
#define EmfPlusRecordTypeFillEllipse
#define EmfPlusRecordTypeDrawRects
#define EmfPlusRecordTypeFillPath
#define EmfPlusRecordTypeDrawString
#define EmfPlusRecordTypeRestore
#define EmfPlusRecordTypeDrawBeziers
#define EmfPlusRecordTypeEndOfFile
#define EmfPlusRecordTypeObject
#define EmfPlusRecordTypeSetClipPath
#define EmfPlusRecordTypeFillRegion
#define EmfPlusRecordTypeBeginContainer
#define EmfPlusRecordTypeSetAntiAliasMode
#define EmfPlusRecordTypeDrawPath
#define EmfPlusObjectTypeImageAttributes
#define EmfPlusRecordTypeTranslateWorldTransform
#define EmfPlusRecordTypeHeader
#define EmfPlusRecordTypeResetWorldTransform
#define EmfPlusRecordTypeRotateWorldTransform
#define EmfPlusObjectTypeStringFormat
#define EmfPlusObjectTypePen
#define EmfPlusObjectTypeImage
#define EmfPlusRecordTypeSetPixelOffsetMode
#define EmfPlusRecordTypeResetClip
#define EmfPlusRecordTypeFillClosedCurve
#define EmfPlusRecordTypeDrawEllipse
#define EmfPlusRecordTypeFillPie
#define EmfPlusRecordTypeSetInterpolationMode
#define EmfPlusRecordTypeSetTextRenderingHint
#define EmfPlusRecordTypeMultiplyWorldTransform
#define EmfPlusObjectTypeRegion
#define EmfPlusRecordTypeComment
#define EmfPlusRecordTypeFillPolygon
#define EmfPlusRecordTypeOffsetClip
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke, size_t *pPointLimit)
constexpr double rad2deg(double v)
constexpr double deg2rad(double v)
::std::vector< SvgGradientEntry > SvgGradientEntryVector
static bool IsBrush(sal_uInt16 flags)
static OUString emfObjectToName(sal_uInt16 type)
static OUString SmoothingModeToString(sal_uInt16 nSmoothMode)
@ TextRenderingHintAntialiasGridFit
@ TextRenderingHintSingleBitPerPixel
@ TextRenderingHintClearTypeGridFit
@ TextRenderingHintSingleBitPerPixelGridFit
@ TextRenderingHintSystemDefault
@ TextRenderingHintAntialias
OUString UnitTypeToString(sal_uInt16 nType)
const sal_uInt32 EmfPlusPenDataCustomStartCap
const char * emfTypeToName(sal_uInt16 type)
const sal_uInt32 EmfPlusPenDataEndCap
static OUString TextRenderingHintToString(sal_uInt16 nHint)
@ PixelOffsetModeHighQuality
@ PixelOffsetModeHighSpeed
@ LineCapTypeSquareAnchor
@ LineCapTypeDiamondAnchor
std::map< int, wmfemfhelper::PropertyHolder > GraphicStateMap
constexpr double alpha[nDetails]
const sal_uInt32 EmfPlusPenDataStartCap
@ SmoothingModeAntiAlias8x8
@ SmoothingModeAntiAlias8x4
@ SmoothingModeHighQuality
@ InterpolationModeDefault
@ InterpolationModeBicubic
@ InterpolationModeLowQuality
@ InterpolationModeHighQualityBicubic
@ InterpolationModeHighQuality
@ InterpolationModeNearestNeighbor
@ InterpolationModeBilinear
@ InterpolationModeHighQualityBilinear
@ BrushTypeLinearGradient
const sal_uInt32 EmfPlusPenDataCustomEndCap
static OUString BrushIDToString(sal_uInt16 flags, sal_uInt32 brushid)
@ EmfPlusCombineModeExclude
@ EmfPlusCombineModeComplement
@ EmfPlusCombineModeIntersect
@ EmfPlusCombineModeUnion
@ EmfPlusCombineModeReplace
static OUString PixelOffsetModeToString(sal_uInt16 nPixelOffset)
static OUString InterpolationModeToString(sal_uInt16 nMode)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void HandleNewClipRegion(const basegfx::B2DPolyPolygon &rClipPolyPolygon, TargetHolders &rTargetHolders, PropertyHolders &rPropertyHolders)
helper to take needed action on ClipRegion change.
std::map< OUString, rtl::Reference< Entity > > map
TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream &rStrm, std::size_t nUnits)
sal_uInt32 colorblendPoints
std::unique_ptr< float[]> blendPositions
const ::Color & GetColor() const
void Read(SvStream &s, EmfPlusHelperData const &rR)
sal_uInt32 GetType() const
sal_uInt32 additionalFlags
std::unique_ptr< float[]> colorblendPositions
basegfx::B2DHomMatrix brush_transformation
std::unique_ptr<::Color[]> colorblendColors
EmfPlusHatchStyle hatchStyle
void Read(SvMemoryStream &s)
void Read(SvMemoryStream &s, sal_uInt32 dataSize, bool bUseWholeStream)
double fMiterMinimumAngle
basegfx::B2DLineJoin maLineJoin
std::unique_ptr< EMFPCustomLineCap > customEndCap
std::unique_ptr< EMFPCustomLineCap > customStartCap
void Read(SvStream &s, EmfPlusHelperData const &rR)
drawinglayer::attribute::StrokeAttribute GetStrokeAttribute(const double aTransformation) const
::basegfx::B2DPolyPolygon regionPolyPolygon
void ReadRegion(SvStream &s, EmfPlusHelperData &rR)
void GraphicStatePush(GraphicStateMap &map, sal_Int32 index)
basegfx::B2DHomMatrix maBaseTransform
static bool readXForm(SvStream &rIn, basegfx::B2DHomMatrix &rTarget)
sal_uInt16 mnTextContrast
GraphicStateMap mGSContainerStack
void GraphicStatePop(GraphicStateMap &map, sal_Int32 index)
::basegfx::B2DPoint Map(double ix, double iy) const
void EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon &polygon, sal_uInt32 penIndex)
EmfPlusHelperData(SvMemoryStream &rMS, wmfemfhelper::TargetHolders &rTargetHolders, wmfemfhelper::PropertyHolders &rPropertyHolders)
basegfx::B2DHomMatrix maWorldTransform
void EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon &polygon, const bool isColor, const sal_uInt32 brushIndexOrColor)
void processEmfPlusData(SvMemoryStream &rMS, const drawinglayer::geometry::ViewInformation2D &rViewInformation)
wmfemfhelper::PropertyHolders & mrPropertyHolders
void EMFPPlusFillPolygonSolidColor(const ::basegfx::B2DPolyPolygon &polygon, Color const &color)
basegfx::B2DHomMatrix maMapTransform
static void ReadRectangle(SvStream &s, float &x, float &y, float &width, float &height, bool bCompressed=false)
std::unique_ptr< EMFPObject > maEMFPObjects[256]
static void ReadPoint(SvStream &s, float &x, float &y, sal_uInt32 flags)
wmfemfhelper::TargetHolders & mrTargetHolders
data holders
::basegfx::B2DPolyPolygon combineClip(::basegfx::B2DPolyPolygon const &leftPolygon, int combineMode, ::basegfx::B2DPolyPolygon const &rightPolygon)
void processObjectRecord(SvMemoryStream &rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream=false)
Color EMFPGetBrushColorOrARGBColor(const sal_uInt16 flags, const sal_uInt32 brushIndexOrColor) const
static float getUnitToPixelMultiplier(const UnitType aUnitType, const sal_uInt32 aDPI)
wmfemfhelper::PropertyHolder aGetDCState
drawinglayer::attribute::LineStartEndAttribute CreateLineEnd(const sal_Int32 aCap, const float aPenWidth) const