use of com.tom_roush.pdfbox.pdmodel.graphics.pattern.PDAbstractPattern in project PdfBox-Android by TomRoush.
the class PDResources method getPattern.
/**
* Returns the pattern resource with the given name, or null if none exists.
*
* @param name Name of the pattern resource.
*
* @return the pattern resource of the given name.
*
* @throws IOException if something went wrong.
*/
public PDAbstractPattern getPattern(COSName name) throws IOException {
COSObject indirect = getIndirect(COSName.PATTERN, name);
if (cache != null && indirect != null) {
PDAbstractPattern cached = cache.getPattern(indirect);
if (cached != null) {
return cached;
}
}
// get the instance
PDAbstractPattern pattern = null;
COSDictionary dict = (COSDictionary) get(COSName.PATTERN, name);
if (dict != null) {
pattern = PDAbstractPattern.create(dict);
}
if (cache != null) {
cache.put(indirect, pattern);
}
return pattern;
}
Aggregations