Object lastItem = sequence.get(sequence.size()-1); if (lastItem instanceof CharStringCommand && ((CharStringCommand)lastItem).getKey().getValue()[0] == RETURN) sequence.add(new CharStringCommand(TWO_BYTE, CALLOTHERSUBR)); break; case 1: sequence.add(new CharStringCommand(TWO_BYTE, CALLOTHERSUBR)); break; case 3:
private void closePath() { CharStringCommand command = pathCount > 0 ? (CharStringCommand) type1Sequence .get(type1Sequence.size() - 1) : null; CharStringCommand closepathCommand = new CharStringCommand(9); if (command != null && !closepathCommand.equals(command)) { addCommand(Collections.<Number> emptyList(), closepathCommand); } }
private CharStringCommand readCommand(DataInput input, int b0) throws IOException { if (b0 == 12) { int b1 = input.readUnsignedByte(); return new CharStringCommand(b0, b1); } return new CharStringCommand(b0); }
/** * Constructor with one value. * * @param b0 value */ public CharStringCommand(int b0) { setKey(new Key(b0)); }
private void parseHints(List<Object> type2Sequence) { List<Command> commands = new LinkedList<Command>(); Command commandOn = null; for (Object objOn : type2Sequence) { if (objOn instanceof CharStringCommand) { CharStringCommand command = (CharStringCommand) objOn; commandOn = new Command(); commandOn.name = command.toString(); commands.add(commandOn); } else if (objOn instanceof Integer && commandOn != null) commandOn.values.add((Integer) objOn); } for (Command command : commands) { parseHint(command); } }
private void drawAlternatingLine(List<Number> numbers, boolean horizontal) { while (numbers.size() > 0) { addCommand(numbers.subList(0, 1), new CharStringCommand( horizontal ? 6 : 7)); numbers = numbers.subList(1, numbers.size()); horizontal = !horizontal; } }
/** * Constructor with two values. * * @param b0 value1 * @param b1 value2 */ public CharStringCommand(int b0, int b1) { setKey(new Key(b0, b1)); }
String name = CharStringCommand.TYPE2_VOCABULARY.get(command.getKey()); addCommand(numbers, new CharStringCommand(12, 6)); numbers.get(5), -(numbers.get(2).floatValue()), numbers.get(6), 0); addCommandList(Arrays.asList(first, second), new CharStringCommand(8)); break; addCommandList(Arrays.asList(first, second), new CharStringCommand(8)); break; List<Number> second = Arrays.asList(numbers.get(5), 0, numbers.get(6), numbers.get(7), numbers.get(8), 0); addCommandList(Arrays.asList(first, second), new CharStringCommand(8)); break; numbers.get(9), (Math.abs(dx) > Math.abs(dy) ? numbers.get(10) : -dx), (Math.abs(dx) > Math.abs(dy) ? -dy : numbers.get(10))); addCommandList(Arrays.asList(first, second), new CharStringCommand(8)); break; new CharStringCommand(8)); addCommand(numbers.subList(numbers.size() - 2, numbers.size()), new CharStringCommand(5)); new CharStringCommand(5)); addCommand(numbers.subList(numbers.size() - 6, numbers.size()), new CharStringCommand(8));
private List<Number> clearStack(List<Number> numbers, boolean flag) { if (type1Sequence.isEmpty()) { if (flag) { addCommand(Arrays.asList((Number) 0f, numbers.get(0).floatValue() + nominalWidthX), new CharStringCommand(13)); numbers = numbers.subList(1, numbers.size()); } else { addCommand(Arrays.asList((Number) 0f, defWidthX), new CharStringCommand(13)); } } return numbers; }
private void closePath() { CharStringCommand command = pathCount > 0 ? (CharStringCommand) type1Sequence .get(type1Sequence.size() - 1) : null; CharStringCommand closepathCommand = new CharStringCommand(9); if (command != null && !closepathCommand.equals(command)) { addCommand(Collections.<Number> emptyList(), closepathCommand); } }
/** * Constructor with an array as values. * * @param values array of values */ public CharStringCommand(int[] values) { setKey(new Key(values)); }
/** * {@inheritDoc} */ @Override public int hashCode() { return getKey().hashCode(); }
Object lastItem = sequence.get(sequence.size()-1); if (lastItem instanceof CharStringCommand && ((CharStringCommand)lastItem).getKey().getValue()[0] == RETURN) sequence.add(new CharStringCommand(TWO_BYTE, CALLOTHERSUBR)); break; case 1: sequence.add(new CharStringCommand(TWO_BYTE, CALLOTHERSUBR)); break; case 3:
private void drawAlternatingCurve(List<Number> numbers, boolean horizontal) { while (numbers.size() >= 4) { boolean last = numbers.size() == 5; if (horizontal) { addCommand(Arrays.asList(numbers.get(0), 0, numbers.get(1), numbers.get(2), last ? numbers.get(4) : 0, numbers.get(3)), new CharStringCommand(8)); } else { addCommand(Arrays.asList(0, numbers.get(0), numbers.get(1), numbers.get(2), numbers.get(3), last ? numbers.get(4) : 0), new CharStringCommand(8)); } numbers = numbers.subList(last ? 5 : 4, numbers.size()); horizontal = !horizontal; } }
private void closePath() { CharStringCommand command = pathCount > 0 ? (CharStringCommand) type1Sequence .get(type1Sequence.size() - 1) : null; CharStringCommand closepathCommand = new CharStringCommand(9); if (command != null && !closepathCommand.equals(command)) { addCommand(Collections.<Number> emptyList(), closepathCommand); } }
/** * Constructor with two values. * * @param b0 value1 * @param b1 value2 */ public CharStringCommand(int b0, int b1) { setKey(new Key(b0, b1)); }
private static Integer removeInteger(List<Object> sequence) throws IOException { Object item = sequence.remove(sequence.size() - 1); if (item instanceof Integer) { return (Integer)item; } CharStringCommand command = (CharStringCommand) item; // div if (command.getKey().getValue()[0] == 12 && command.getKey().getValue()[1] == 12) { int a = (Integer) sequence.remove(sequence.size() - 1); int b = (Integer) sequence.remove(sequence.size() - 1); return b / a; } throw new IOException("Unexpected char string command: " + command.getKey()); }
Object lastItem = sequence.get(sequence.size()-1); if (lastItem instanceof CharStringCommand && ((CharStringCommand)lastItem).getKey().getValue()[0] == RETURN) sequence.add(new CharStringCommand(TWO_BYTE, CALLOTHERSUBR)); break; case 1: sequence.add(new CharStringCommand(TWO_BYTE, CALLOTHERSUBR)); break; case 3: