30#include <osl/diagnose.h>
37 bool handleGeometricContent(
54 if(aResult == rSource)
64 for(
auto const& rB2DPolygon : aResult)
84 bool handleGradientContent(
101 if(aResult == rSource)
120 bool handleBitmapContent(
134 rPoint.
X(), rPoint.
Y(),
143 if(!aClipOfBitmap.count())
152 const double fBitmapArea(
153 aLogicBitmapRange.getWidth() * aLogicBitmapRange.getWidth() +
154 aLogicBitmapRange.getHeight() * aLogicBitmapRange.getHeight());
155 const double fFactor(fClipArea / fBitmapArea);
169 aVDev->SetOutputSizePixel(aSizePixel);
170 aVDev->EnableMapMode(
false);
171 aVDev->SetFillColor( COL_WHITE);
172 aVDev->SetLineColor();
182 aVDev->SetBackground(
Wallpaper(COL_BLACK));
190 aTransform.
translate(-aLogicBitmapRange.getMinX(), -aLogicBitmapRange.getMinY());
192 static_cast< double >(aSizePixel.Width()) / aLogicBitmapRange.getWidth(),
193 static_cast< double >(aSizePixel.Height()) / aLogicBitmapRange.getHeight());
194 aPixelPoly.transform(aTransform);
205 aSizePixel.Width(), aSizePixel.Height())));
206 aInvertPixelPoly.
append(aPixelPoly);
209 aVDev->DrawPolyPolygon(aInvertPixelPoly);
241 "XPATHSTROKE_SEQ_BEGIN",
254 "XPATHFILL_SEQ_BEGIN",
274 bool bChanged(
false);
275 std::vector< basegfx::B2DPolyPolygon > aClips;
276 std::vector< vcl::PushFlags > aPushFlags;
277 std::vector< MapMode > aMapModes;
280 aClips.emplace_back();
283 aMapModes.emplace_back();
306 aClips.back() = aNewClip;
321 if(!rRect.
IsEmpty() && !aClips.empty() && aClips.back().count())
339 if(!rRegion.
IsEmpty() && !aClips.empty() && aClips.back().count())
358 if((aHorMove || aVerMove) && !aClips.empty() && aClips.back().count())
360 aClips.back().transform(
373 aPushFlags.push_back(nFlags);
377 aClips.push_back(aClips.back());
382 aMapModes.push_back(aMapModes.back());
390 if(!aPushFlags.empty())
393 aPushFlags.pop_back();
397 if(aClips.size() > 1)
403 OSL_ENSURE(
false,
"Wrong POP() in ClipRegions (!)");
409 if(aMapModes.size() > 1)
411 aMapModes.pop_back();
415 OSL_ENSURE(
false,
"Wrong POP() in MapModes (!)");
421 OSL_ENSURE(
false,
"Invalid pop() without push() (!)");
445 if(!aClips.empty() && aClips.back().count())
494 bDone = handleGeometricContent(
514 bDone = handleGeometricContent(
543 double fRadiusX((nHor * 2.0) / (aRange.
getWidth() > 0.0 ? aRange.
getWidth() : 1.0));
544 double fRadiusY((nVer * 2.0) / (aRange.
getHeight() > 0.0 ? aRange.
getHeight() : 1.0));
545 fRadiusX = std::clamp(fRadiusX, 0.0, 1.0);
546 fRadiusY = std::clamp(fRadiusY, 0.0, 1.0);
555 bDone = handleGeometricContent(
577 bDone = handleGeometricContent(
607 bDone = handleGeometricContent(
633 bDone = handleGeometricContent(
659 bDone = handleGeometricContent(
672 bDone = handleGeometricContent(
684 bDone = handleGeometricContent(
697 bDone = handleGeometricContent(
726 bDone = handleBitmapContent(
753 bDone = handleBitmapContent(
766 bDone = handleBitmapContent(
779 bDone = handleBitmapContent(
800 BitmapEx aCroppedBitmapEx(rBitmapEx);
810 aCroppedBitmapEx.
Crop(aCropRectangle);
811 bDone = handleBitmapContent(
834 Bitmap aCroppedBitmap(rBitmap);
844 aCroppedBitmap.
Crop(aCropRectangle);
845 bDone = handleBitmapContent(
863 if(rComment.equalsIgnoreAsciiCase(
"XGRAD_SEQ_BEGIN"))
871 else if(rComment.equalsIgnoreAsciiCase(
"XPATHFILL_SEQ_BEGIN"))
895 if(aResult != aSource)
899 addSvtGraphicFill(aFilling, aTarget);
907 addSvtGraphicFill(aFilling, aTarget);
912 else if(rComment.equalsIgnoreAsciiCase(
"XPATHSTROKE_SEQ_BEGIN"))
939 for(
auto const& rB2DPolygon : aResult)
942 addSvtGraphicStroke(aStroke, aTarget);
952 addSvtGraphicStroke(aStroke, aTarget);
974 bDone = handleGradientContent(
991 bDone = handleGradientContent(
1082MetafileAccessor::~MetafileAccessor()
Bitmap const & GetBitmap() const
static OutputDevice * GetDefaultDevice()
Get the default "device" (in this case the default window).
const AlphaMask & GetAlphaMask() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
const MapMode & GetPrefMapMode() const
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
const Size & GetPrefSize() const
const Size & GetSizePixel() const
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
const MapMode & GetPrefMapMode() const
const Size & GetPrefSize() const
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual sal_uInt64 TellEnd() override
Encapsulates geometry and associated attributes of a filled area.
void getPath(tools::PolyPolygon &) const
Query path to fill.
void setPath(const tools::PolyPolygon &rPath)
Set path to fill.
Encapsulates geometry and associated attributes of a graphical 'pen stroke'.
void getPath(tools::Polygon &) const
Query path to stroke.
void setPath(const tools::Polygon &)
Set path to stroke.
void translate(double fX, double fY)
void scale(double fX, double fY)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
B2DPoint getCenter() const
basegfx::B2DPolyPolygon GetAsB2DPolyPolygon() const
double getArea(const B2DPolygon &rCandidate)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon &rCandidate, const B2DRange &rRange, bool bInside, bool bStroke)
bool isInside(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithBorder)
B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke, size_t *pPointLimit)
B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
B2DPolygon createPolygonFromEllipse(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, sal_uInt32 nStartQuadrant=0)
B2IRange fround(const B2DRange &rRange)