/** * Translates this matrix by the given vector. * * @param vector 2D vector */ public void translate(Vector vector) { Matrix m = Matrix.getTranslateInstance(vector.getX(), vector.getY()); concatenate(m); }
/** * Applies a text position adjustment from the TJ operator. May be overridden in subclasses. * * @param tx x-translation * @param ty y-translation */ protected void applyTextAdjustment(float tx, float ty) throws IOException { // update the text matrix textMatrix.concatenate(Matrix.getTranslateInstance(tx, ty)); }
/** * This will take this string and create a hex representation of the bytes that make the string. * * @return A hex string representing the bytes in this string. */ public String toHexString() { return Hex.getString(bytes); }
/** * Rotares this matrix by the given factors. * * @param theta The angle of rotation measured in radians */ public void rotate(double theta) { Matrix m = Matrix.getRotateInstance(theta, 0, 0); concatenate(m); }
@Override public Matrix getFontMatrix() { if (fontMatrix == null) { // 1000 upem, this is not strictly true fontMatrix = new Matrix(0.001f, 0, 0, 0.001f, 0, 0); } return fontMatrix; }
/** * Scales this matrix by the given factors. * * @param sx x-scale * @param sy y-scale */ public void scale(float sx, float sy) { Matrix m = Matrix.getScaleInstance(sx, sy); concatenate(m); }
/** * Produces a copy of the first matrix, with the second matrix concatenated. * * @param a The matrix to copy. * @param b The matrix to concatenate. */ public static Matrix concatenate(Matrix a, Matrix b) { Matrix copy = a.clone(); copy.concatenate(b); return copy; }
/** * This will get the X scaling factor. This is dependent on the current transformation matrix * (set by the "cm" operator), the text matrix (set by the "Tm" operator) and the font size (set * by the "Tf" operator). * * @return The X scaling factor. */ public float getXScale() { return textMatrix.getScalingFactorX(); }
/** * Concatenates (premultiplies) the given matrix to this matrix. * * @param matrix The matrix to concatenate. */ public void concatenate(Matrix matrix) { matrix.multiply(this, this); }
/** * This will get the Y scaling factor. This is dependent on the current transformation matrix * (set by the "cm" operator), the text matrix (set by the "Tm" operator) and the font size (set * by the "Tf" operator). * * @return The Y scaling factor. */ public float getYScale() { return textMatrix.getScalingFactorY(); }
/** * Returns the bytes corresponding to the ASCII hex encoding of the given byte. */ public static byte[] getBytes(byte b) { return new byte[]{HEX_BYTES[getHighNibble(b)], HEX_BYTES[getLowNibble(b)]}; }
private TilingPaintParameter(Matrix matrix, COSDictionary patternDict, PDColorSpace colorSpace, PDColor color, AffineTransform xform) { this.matrix = matrix.clone(); this.patternDict = patternDict; this.colorSpace = colorSpace; this.color = color; this.xform = xform; }
@Override public boolean containsKey(Object key) { return findKey(key) >= 0; }
/** * Sorts the given list using compareTo as comparator. * * @param <T> type of the objects to be sorted. * @param list list to be sorted */ public static <T extends Comparable> void sort(List<T> list) { sort(list, (Comparator<T>) OBJCOMP); }
/** * Returns a new vector scaled by both x and y. * * @param sxy x and y scale */ public Vector scale(float sxy) { return new Vector(x * sxy, y * sxy); }
@Override public boolean containsValue(Object value) { return findValue(value) >= 0; }
/** * Translates this matrix by the given ammount. * * @param tx x-translation * @param ty y-translation */ public void translate(float tx, float ty) { Matrix m = Matrix.getTranslateInstance(tx, ty); concatenate(m); }
@Override public Matrix getMatrix() { // todo: take into account user-space unit redefinition as scale? return new Matrix(); }
@SuppressWarnings("unchecked") @Override public V get(Object key) { int kIdx = findKey(key); return kIdx < 0 ? null : (V) mapArr[kIdx+1]; }