PDFPatternShading.java
5.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.cos.CosArray
* com.adobe.internal.pdftoolkit.core.cos.CosObject
* com.adobe.internal.pdftoolkit.core.cos.CosStream
* com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidParameterException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException
* com.adobe.internal.pdftoolkit.core.types.ASName
*/
package com.adobe.internal.pdftoolkit.pdf.graphics.patterns;
import com.adobe.internal.pdftoolkit.core.cos.CosArray;
import com.adobe.internal.pdftoolkit.core.cos.CosObject;
import com.adobe.internal.pdftoolkit.core.cos.CosStream;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidParameterException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
import com.adobe.internal.pdftoolkit.core.types.ASName;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosDictionary;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosObject;
import com.adobe.internal.pdftoolkit.pdf.document.PDFDocument;
import com.adobe.internal.pdftoolkit.pdf.graphics.PDFExtGState;
import com.adobe.internal.pdftoolkit.pdf.graphics.patterns.PDFPattern;
import com.adobe.internal.pdftoolkit.pdf.graphics.shading.PDFShading;
import com.adobe.internal.pdftoolkit.pdf.graphics.shading.PDFShadingFactory;
public class PDFPatternShading
extends PDFCosDictionary
implements PDFPattern {
private PDFPatternShading(CosObject cosStream) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
super(cosStream);
}
private PDFPatternShading(PDFDocument pdfDocument, PDFShading shading) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
super((CosObject)PDFCosObject.newCosDictionary(pdfDocument));
this.setShading(shading);
this.setDictionaryIntValue(ASName.k_PatternType, 2);
}
public static PDFPatternShading newInstance(PDFDocument pdfDocument, PDFShading key_Shading) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
if (key_Shading == null) {
throw new PDFInvalidDocumentException("Shading is required when creating newInstance of PDFPatternShading.");
}
return new PDFPatternShading(pdfDocument, key_Shading);
}
public static PDFPatternShading getInstance(CosObject cosObject) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (PDFCosObject.checkNullCosObject(cosObject) == null) {
return null;
}
PDFPatternShading pdfObject = PDFCosObject.getCachedInstance(cosObject, PDFPatternShading.class);
if (pdfObject == null) {
pdfObject = new PDFPatternShading(cosObject);
}
return pdfObject;
}
public int getPatternType() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getDictionaryIntValue(ASName.k_PatternType);
}
public PDFExtGState getExtGState() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return PDFExtGState.getInstance(this.getDictionaryCosObjectValue(ASName.k_ExtGState));
}
public void setExtGState(PDFExtGState value) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
this.setDictionaryValue(ASName.k_ExtGState, value);
}
public boolean hasExtGState() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.dictionaryContains(ASName.k_ExtGState);
}
public CosArray getMatrix() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return (CosArray)this.getDictionaryValue(ASName.k_Matrix);
}
public void setMatrix(CosArray value) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
this.setDictionaryValue(ASName.k_Matrix, (CosObject)value);
}
public boolean hasMatrix() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.dictionaryContains(ASName.k_Matrix);
}
public PDFShading getShading() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
try {
return PDFShadingFactory.getInstance(this.getDictionaryCosObjectValue(ASName.k_Shading));
}
catch (PDFInvalidParameterException e) {
throw new PDFInvalidDocumentException((Throwable)e);
}
}
public void setShading(PDFShading value) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
if (value == null) {
throw new PDFInvalidParameterException("Shading is a required key therefore cannot be removed.");
}
this.setDictionaryValue(ASName.k_Shading, value.getPDFCosObject());
}
public void setShading(CosStream value) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
if (value == null) {
throw new PDFInvalidParameterException("Shading is a required key therefore cannot be removed.");
}
this.setDictionaryValue(ASName.k_Shading, (CosObject)value);
}
public boolean hasShading() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.dictionaryContains(ASName.k_Shading);
}
public PDFCosDictionary getPDFCosObject() {
return this;
}
}