use of com.tom_roush.pdfbox.cos.COSNumber in project PdfBox-Android by TomRoush.
the class FDFField method getWidgetFieldFlags.
/**
* This will get the F entry of the cos dictionary. If it it not present then this method will return null.
*
* @return The widget field flags.
*/
public Integer getWidgetFieldFlags() {
Integer retval = null;
COSNumber f = (COSNumber) field.getDictionaryObject("F");
if (f != null) {
retval = f.intValue();
}
return retval;
}
use of com.tom_roush.pdfbox.cos.COSNumber in project PdfBox-Android by TomRoush.
the class FDFField method getClearWidgetFieldFlags.
/**
* This will get the ClrF entry of the cos dictionary. If it it not present then this method will return null.
*
* @return The widget field flags.
*/
public Integer getClearWidgetFieldFlags() {
Integer retval = null;
COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.CLR_F);
if (ff != null) {
retval = ff.intValue();
}
return retval;
}
use of com.tom_roush.pdfbox.cos.COSNumber in project PdfBox-Android by TomRoush.
the class PDCIDFont method readWidths.
private void readWidths() {
widths = new HashMap<Integer, Float>();
COSBase wBase = dict.getDictionaryObject(COSName.W);
if (wBase instanceof COSArray) {
COSArray wArray = (COSArray) wBase;
int size = wArray.size();
int counter = 0;
while (counter < size) {
COSNumber firstCode = (COSNumber) wArray.getObject(counter++);
COSBase next = wArray.getObject(counter++);
if (next instanceof COSArray) {
COSArray array = (COSArray) next;
int startRange = firstCode.intValue();
int arraySize = array.size();
for (int i = 0; i < arraySize; i++) {
COSNumber width = (COSNumber) array.getObject(i);
widths.put(startRange + i, width.floatValue());
}
} else {
COSNumber secondCode = (COSNumber) next;
COSNumber rangeWidth = (COSNumber) wArray.getObject(counter++);
int startRange = firstCode.intValue();
int endRange = secondCode.intValue();
float width = rangeWidth.floatValue();
for (int i = startRange; i <= endRange; i++) {
widths.put(i, width);
}
}
}
}
}
use of com.tom_roush.pdfbox.cos.COSNumber in project PdfBox-Android by TomRoush.
the class AppendRectangleToPath method process.
@Override
public void process(Operator operator, List<COSBase> operands) throws IOException {
if (operands.size() < 4) {
throw new MissingOperandException(operator, operands);
}
if (!checkArrayTypesClass(operands, COSNumber.class)) {
return;
}
COSNumber x = (COSNumber) operands.get(0);
COSNumber y = (COSNumber) operands.get(1);
COSNumber w = (COSNumber) operands.get(2);
COSNumber h = (COSNumber) operands.get(3);
float x1 = x.floatValue();
float y1 = y.floatValue();
// create a pair of coordinates for the transformation
float x2 = w.floatValue() + x1;
float y2 = h.floatValue() + y1;
PointF p0 = context.transformedPoint(x1, y1);
PointF p1 = context.transformedPoint(x2, y1);
PointF p2 = context.transformedPoint(x2, y2);
PointF p3 = context.transformedPoint(x1, y2);
context.appendRectangle(p0, p1, p2, p3);
}
use of com.tom_roush.pdfbox.cos.COSNumber in project PdfBox-Android by TomRoush.
the class CurveTo method process.
@Override
public void process(Operator operator, List<COSBase> operands) throws IOException {
if (operands.size() < 6) {
throw new MissingOperandException(operator, operands);
}
if (!checkArrayTypesClass(operands, COSNumber.class)) {
return;
}
COSNumber x1 = (COSNumber) operands.get(0);
COSNumber y1 = (COSNumber) operands.get(1);
COSNumber x2 = (COSNumber) operands.get(2);
COSNumber y2 = (COSNumber) operands.get(3);
COSNumber x3 = (COSNumber) operands.get(4);
COSNumber y3 = (COSNumber) operands.get(5);
PointF point1 = context.transformedPoint(x1.floatValue(), y1.floatValue());
PointF point2 = context.transformedPoint(x2.floatValue(), y2.floatValue());
PointF point3 = context.transformedPoint(x3.floatValue(), y3.floatValue());
if (context.getCurrentPoint() == null) {
Log.w("PdfBox-Android", "curveTo (" + point3.x + "," + point3.y + ") without initial MoveTo");
context.moveTo(point3.x, point3.y);
} else {
context.curveTo(point1.x, point1.y, point2.x, point2.y, point3.x, point3.y);
}
}
Aggregations