org.jpedal.parser.shape.N Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer for NetBeans plugin
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* N.java
* ---------------
*/
package org.jpedal.parser.shape;
import java.awt.Shape;
import java.awt.geom.Area;
import org.jpedal.objects.GraphicsState;
import org.jpedal.objects.PdfPageData;
import org.jpedal.objects.PdfShape;
import org.jpedal.parser.Cmd;
import org.jpedal.parser.ParserOptions;
import org.jpedal.render.DynamicVectorRenderer;
public class N {
public static void execute(final PdfShape currentDrawShape, final GraphicsState gs, final int formLevel, final Shape defaultClip, final ParserOptions parserOptions, final DynamicVectorRenderer current, final PdfPageData pageData) {
final boolean useJavaFX = parserOptions.useJavaFX();
final boolean renderPage = parserOptions.isRenderPage();
if (currentDrawShape.isClip()) {
//create clipped shape
currentDrawShape.closeShape();
if (useJavaFX) {
gs.updateClip(currentDrawShape.getPath());
} else {
gs.updateClip(new Area(currentDrawShape.generateShapeFromPath(gs.CTM, 0, Cmd.n)));
}
if (formLevel == 0) {
final int pageNum = parserOptions.getPageNumber();
gs.checkWholePageClip(pageData.getMediaBoxHeight(pageNum) + pageData.getMediaBoxY(pageNum));
}
//always reset flag
currentDrawShape.setClip(false);
//save for later
if (renderPage) {
current.drawClip(gs, defaultClip, false);
}
}
currentDrawShape.resetPath(); // flush all path ops stored
}
}