Kaydet (Commit) e49aa930 authored tarafından Bartosz Kosiorek's avatar Bartosz Kosiorek

tdf#77229 tdf#113635 EMF+ Add support for Clip Union, Exclude and Complement

Union: Replaces the existing region with the union of the existing and new regions.
Exclude: Replaces the existing region with the part of itself that is not in the new
region.
Complement: Replaces the existing region with the part of the new region that is not
in the existing region.

Change-Id: Iabbe0ddfa082a332e94dd85b6444b234d1bdee35
Reviewed-on: https://gerrit.libreoffice.org/44380Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBartosz Kosiorek <gang65@poczta.onet.pl>
üst 89bbb27e
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
...@@ -702,30 +703,10 @@ namespace emfplushelper ...@@ -702,30 +703,10 @@ namespace emfplushelper
switch (combineMode) switch (combineMode)
{ {
case EmfPlusCombineModeReplace: case EmfPlusCombineModeReplace:
case EmfPlusCombineModeUnion:
case EmfPlusCombineModeComplement:
{ {
HandleNewClipRegion(polygon, mrTargetHolders, mrPropertyHolders); HandleNewClipRegion(polygon, mrTargetHolders, mrPropertyHolders);
break; break;
} }
case EmfPlusCombineModeXOR:
{
basegfx::B2DPolyPolygon aOriginalPolyPolygon(
mrPropertyHolders.Current().getClipPolyPolygon());
if (!aOriginalPolyPolygon.count())
{
HandleNewClipRegion(polygon, mrTargetHolders, mrPropertyHolders);
}
else
{
aOriginalPolyPolygon.append(polygon);
// use existing tooling from wmfemfhelper
HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
}
break;
}
case EmfPlusCombineModeIntersect: case EmfPlusCombineModeIntersect:
{ {
const basegfx::B2DPolyPolygon aOriginalPolyPolygon( const basegfx::B2DPolyPolygon aOriginalPolyPolygon(
...@@ -734,7 +715,6 @@ namespace emfplushelper ...@@ -734,7 +715,6 @@ namespace emfplushelper
basegfx::B2DPolyPolygon aClippedPolyPolygon; basegfx::B2DPolyPolygon aClippedPolyPolygon;
if (aOriginalPolyPolygon.count()) if (aOriginalPolyPolygon.count())
{ {
aClippedPolyPolygon = basegfx::utils::clipPolyPolygonOnPolyPolygon( aClippedPolyPolygon = basegfx::utils::clipPolyPolygonOnPolyPolygon(
aOriginalPolyPolygon, aOriginalPolyPolygon,
polygon, polygon,
...@@ -742,13 +722,47 @@ namespace emfplushelper ...@@ -742,13 +722,47 @@ namespace emfplushelper
false); false);
} }
// use existing tooling from wmfemfhelper
HandleNewClipRegion(aClippedPolyPolygon, mrTargetHolders, mrPropertyHolders); HandleNewClipRegion(aClippedPolyPolygon, mrTargetHolders, mrPropertyHolders);
break; break;
} }
case EmfPlusCombineModeUnion:
{
basegfx::B2DPolyPolygon aOriginalPolyPolygon(
mrPropertyHolders.Current().getClipPolyPolygon());
aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationOr(aOriginalPolyPolygon, polygon);
HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
break;
}
case EmfPlusCombineModeXOR:
{
basegfx::B2DPolyPolygon aOriginalPolyPolygon(
mrPropertyHolders.Current().getClipPolyPolygon());
aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationXor(aOriginalPolyPolygon, polygon);
HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
break;
}
case EmfPlusCombineModeExclude: case EmfPlusCombineModeExclude:
{ {
// Not doing anything is better then including exactly what we wanted to exclude. // Replaces the existing region with the part of itself that is not in the new region.
basegfx::B2DPolyPolygon aOriginalPolyPolygon(
mrPropertyHolders.Current().getClipPolyPolygon());
aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationDiff(aOriginalPolyPolygon, polygon);
HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
break;
}
case EmfPlusCombineModeComplement:
{
// Replaces the existing region with the part of the new region that is not in the existing region.
basegfx::B2DPolyPolygon aOriginalPolyPolygon(
mrPropertyHolders.Current().getClipPolyPolygon());
aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationDiff(polygon, aOriginalPolyPolygon);
HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
break; break;
} }
} }
...@@ -1507,11 +1521,6 @@ namespace emfplushelper ...@@ -1507,11 +1521,6 @@ namespace emfplushelper
int combineMode = (flags >> 8) & 0xf; int combineMode = (flags >> 8) & 0xf;
SAL_INFO("drawinglayer", "EMF+ SetClipRect combine mode: " << combineMode); SAL_INFO("drawinglayer", "EMF+ SetClipRect combine mode: " << combineMode);
#if OSL_DEBUG_LEVEL > 1
if (combineMode > 1) {
SAL_WARN("drawinglayer", "EMF+ \tSetClipRect TODO combine mode > 1");
}
#endif
float dx, dy, dw, dh; float dx, dy, dw, dh;
ReadRectangle(rMS, dx, dy, dw, dh); ReadRectangle(rMS, dx, dy, dw, dh);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment