Merge branch 'documine' into 'master'
DM-305: fix isTextRenderedVisibly See merge request redactmanager/commons/pdftron-logic-commons!3
This commit is contained in:
commit
ab3d274c8f
@ -252,7 +252,7 @@ public class InvisibleElementRemovalService {
|
|||||||
PathData pathData = pathElement.getPathData();
|
PathData pathData = pathElement.getPathData();
|
||||||
|
|
||||||
if (pathData.getOperators().length == 0 && pathData.getPoints().length == 0 || pathElement.getBBox() == null) {
|
if (pathData.getOperators().length == 0 && pathData.getPoints().length == 0 || pathElement.getBBox() == null) {
|
||||||
writer.writeElement(pathElement);
|
writer.writeGStateChanges(pathElement);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,16 +387,18 @@ public class InvisibleElementRemovalService {
|
|||||||
|
|
||||||
private boolean isTextRenderedVisibly(GState gState, Rect textBBox, InvisibleElementRemovalContext context) throws PDFNetException {
|
private boolean isTextRenderedVisibly(GState gState, Rect textBBox, InvisibleElementRemovalContext context) throws PDFNetException {
|
||||||
|
|
||||||
return gState.getTextRenderMode() != GState.e_invisible_text && //
|
return switch (gState.getTextRenderMode()) {
|
||||||
!(gState.getTextRenderMode() == GState.e_fill_text && fillIsVisible(gState, textBBox, context)) && //
|
case GState.e_invisible_text -> false;
|
||||||
!(gState.getTextRenderMode() == GState.e_stroke_text && strokeIsVisible(gState, textBBox, context)) && //
|
case GState.e_fill_text -> fillIsVisible(gState, textBBox, context);
|
||||||
!(gState.getTextRenderMode() == GState.e_fill_stroke_text && (fillIsVisible(gState, textBBox, context) || strokeIsVisible(gState, textBBox, context)));
|
case GState.e_stroke_text -> strokeIsVisible(gState, textBBox, context);
|
||||||
|
default -> fillIsVisible(gState, textBBox, context) || strokeIsVisible(gState, textBBox, context);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean strokeIsVisible(GState gState, Rect textBBox, InvisibleElementRemovalContext context) throws PDFNetException {
|
private boolean strokeIsVisible(GState gState, Rect textBBox, InvisibleElementRemovalContext context) throws PDFNetException {
|
||||||
|
|
||||||
return gState.getStrokeOpacity() == 0 && differentColorThanBackgroundColor(Converter.convertColor(gState.getStrokeColorSpace(), gState.getStrokeColor()),
|
return gState.getStrokeOpacity() != 0 && differentColorThanBackgroundColor(Converter.convertColor(gState.getStrokeColorSpace(), gState.getStrokeColor()),
|
||||||
textBBox,
|
textBBox,
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
@ -404,7 +406,7 @@ public class InvisibleElementRemovalService {
|
|||||||
|
|
||||||
private boolean fillIsVisible(GState gState, Rect textBBox, InvisibleElementRemovalContext context) throws PDFNetException {
|
private boolean fillIsVisible(GState gState, Rect textBBox, InvisibleElementRemovalContext context) throws PDFNetException {
|
||||||
|
|
||||||
return gState.getFillOpacity() == 0 && differentColorThanBackgroundColor(Converter.convertColor(gState.getFillColorSpace(), gState.getFillColor()), textBBox, context);
|
return gState.getFillOpacity() != 0 && differentColorThanBackgroundColor(Converter.convertColor(gState.getFillColorSpace(), gState.getFillColor()), textBBox, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user