use of com.tom_roush.pdfbox.pdmodel.graphics.shading.PDShading in project PdfBox-Android by TomRoush.
the class PDResources method getShading.
/**
* Returns the shading resource with the given name, or null if none exists.
*
* @param name Name of the shading resource.
*
* @return the shading resource of the given name.
*
* @throws IOException if something went wrong.
*/
public PDShading getShading(COSName name) throws IOException {
COSObject indirect = getIndirect(COSName.SHADING, name);
if (cache != null && indirect != null) {
PDShading cached = cache.getShading(indirect);
if (cached != null) {
return cached;
}
}
// get the instance
PDShading shading = null;
COSDictionary dict = (COSDictionary) get(COSName.SHADING, name);
if (dict != null) {
shading = PDShading.create(dict);
}
if (cache != null) {
cache.put(indirect, shading);
}
return shading;
}
use of com.tom_roush.pdfbox.pdmodel.graphics.shading.PDShading in project PdfBox-Android by TomRoush.
the class PageDrawer method shadingFill.
@Override
public void shadingFill(COSName shadingName) throws IOException {
PDShading shading = getResources().getShading(shadingName);
if (shading == null) {
Log.e("PdfBox-Android", "shading " + shadingName + " does not exist in resources dictionary");
return;
}
Matrix ctm = getGraphicsState().getCurrentTransformationMatrix();
// Paint paint = shading.toPaint(ctm);
// paint = applySoftMaskToPaint(paint, getGraphicsState().getSoftMask());
// graphics.setComposite(getGraphicsState().getNonStrokingJavaComposite());
// graphics.setPaint(paint);
// graphics.setClip(null);
// lastClip = null;
// get the transformed BBox and intersect with current clipping path
// need to do it here and not in shading getRaster() because it may have been rotated
PDRectangle bbox = shading.getBBox();
if (bbox != null) {
// Area bboxArea = new Area(bbox.transform(ctm));
// bboxArea.intersect(getGraphicsState().getCurrentClippingPath());
// graphics.fill(bboxArea);
} else {
// graphics.fill(getGraphicsState().getCurrentClippingPath());
}
}
Aggregations