StraightEdgeRecord ser = new StraightEdgeRecord(dx, dy); shapeRecords.add(ser); return shapeRecords; StraightEdgeRecord ser = new StraightEdgeRecord(lastx, lasty); shapeRecords.add(ser); StraightEdgeRecord ser = new StraightEdgeRecord(xSeg, ySeg); shapeRecords.add(ser);
StraightEdgeRecord ser = new StraightEdgeRecord(dx, dy); shapeRecords.add(ser); return shapeRecords; StraightEdgeRecord ser = new StraightEdgeRecord(lastx, lasty); shapeRecords.add(ser); StraightEdgeRecord ser = new StraightEdgeRecord(xSeg, ySeg); shapeRecords.add(ser);
private void addLineSubdivideAware(int x, int y) { int limit = EdgeRecord.MAX_DELTA_IN_TWIPS; if (Math.abs(x) > limit || Math.abs(y) > limit) { int midXLeft = (int)Math.rint(Math.floor(x / 2.0)); int midYLeft = (int)Math.rint(Math.floor(y / 2.0)); int midXRight = (int)Math.rint(Math.ceil(x / 2.0)); int midYRight = (int)Math.rint(Math.ceil(y / 2.0)); if (Math.abs(midXLeft) > limit || Math.abs(midYLeft) > limit) addLineSubdivideAware(midXLeft, midYLeft); else shape.addShapeRecord(new StraightEdgeRecord(midXLeft, midYLeft)); if (Math.abs(midXRight) > limit || Math.abs(midYRight) > limit) addLineSubdivideAware(midXRight, midYRight); else shape.addShapeRecord(new StraightEdgeRecord(midXRight, midYRight)); } else { shape.addShapeRecord(new StraightEdgeRecord(x, y)); } }
private void addLineSubdivideAware(int x, int y) { int limit = EdgeRecord.MAX_DELTA_IN_TWIPS; if (Math.abs(x) > limit || Math.abs(y) > limit) { int midXLeft = (int)Math.rint(Math.floor(x / 2.0)); int midYLeft = (int)Math.rint(Math.floor(y / 2.0)); int midXRight = (int)Math.rint(Math.ceil(x / 2.0)); int midYRight = (int)Math.rint(Math.ceil(y / 2.0)); if (Math.abs(midXLeft) > limit || Math.abs(midYLeft) > limit) addLineSubdivideAware(midXLeft, midYLeft); else shape.addShapeRecord(new StraightEdgeRecord(midXLeft, midYLeft)); if (Math.abs(midXRight) > limit || Math.abs(midYRight) > limit) addLineSubdivideAware(midXRight, midYRight); else shape.addShapeRecord(new StraightEdgeRecord(midXRight, midYRight)); } else { shape.addShapeRecord(new StraightEdgeRecord(x, y)); } }
private StraightEdgeRecord readStraightEdgeRecord() throws IOException { StraightEdgeRecord straightEdgeRecord = null; final int nbits = 2 + bitStream.readUB(4); final boolean isGeneralLine = bitStream.readBit(); if (isGeneralLine) { final int dx = bitStream.readSB(nbits); final int dy = bitStream.readSB(nbits); straightEdgeRecord = new StraightEdgeRecord(dx, dy); } else { final boolean isVertLine = bitStream.readBit(); if (isVertLine) { final int dy = bitStream.readSB(nbits); straightEdgeRecord = new StraightEdgeRecord(0, dy); } else { final int dx = bitStream.readSB(nbits); straightEdgeRecord = new StraightEdgeRecord(dx, 0); } } return straightEdgeRecord; }
private StraightEdgeRecord readStraightEdgeRecord() throws IOException { StraightEdgeRecord straightEdgeRecord = null; final int nbits = 2 + bitStream.readUB(4); final boolean isGeneralLine = bitStream.readBit(); if (isGeneralLine) { final int dx = bitStream.readSB(nbits); final int dy = bitStream.readSB(nbits); straightEdgeRecord = new StraightEdgeRecord(dx, dy); } else { final boolean isVertLine = bitStream.readBit(); if (isVertLine) { final int dy = bitStream.readSB(nbits); straightEdgeRecord = new StraightEdgeRecord(0, dy); } else { final int dx = bitStream.readSB(nbits); straightEdgeRecord = new StraightEdgeRecord(dx, 0); } } return straightEdgeRecord; }
shapeRecords.add(new StraightEdgeRecord(0, -dya)); shapeRecords.add(new StraightEdgeRecord(dxa, 0)); shapeRecords.add(new StraightEdgeRecord(dxb, 0)); shapeRecords.add(new StraightEdgeRecord(dxc, 0)); shapeRecords.add(new StraightEdgeRecord(0, dya)); shapeRecords.add(new StraightEdgeRecord(0, dyb)); shapeRecords.add(new StraightEdgeRecord(0, dyc)); shapeRecords.add(new StraightEdgeRecord(-dxc, 0)); shapeRecords.add(new StraightEdgeRecord(-dxb, 0)); shapeRecords.add(new StraightEdgeRecord(-dxa, 0)); shapeRecords.add(new StraightEdgeRecord(0, -dyc)); shapeRecords.add(new StraightEdgeRecord(0, -dyb)); shapeRecords.add(new StraightEdgeRecord(0, dya)); shapeRecords.add(new StraightEdgeRecord(0, dyb)); shapeRecords.add(new StraightEdgeRecord(0, dyc)); shapeRecords.add(new StraightEdgeRecord(0, dya)); shapeRecords.add(new StraightEdgeRecord(0, dyb));
shapeRecords.add(new StraightEdgeRecord(0, -dya)); shapeRecords.add(new StraightEdgeRecord(dxa, 0)); shapeRecords.add(new StraightEdgeRecord(dxb, 0)); shapeRecords.add(new StraightEdgeRecord(dxc, 0)); shapeRecords.add(new StraightEdgeRecord(0, dya)); shapeRecords.add(new StraightEdgeRecord(0, dyb)); shapeRecords.add(new StraightEdgeRecord(0, dyc)); shapeRecords.add(new StraightEdgeRecord(-dxc, 0)); shapeRecords.add(new StraightEdgeRecord(-dxb, 0)); shapeRecords.add(new StraightEdgeRecord(-dxa, 0)); shapeRecords.add(new StraightEdgeRecord(0, -dyc)); shapeRecords.add(new StraightEdgeRecord(0, -dyb)); shapeRecords.add(new StraightEdgeRecord(0, dya)); shapeRecords.add(new StraightEdgeRecord(0, dyb)); shapeRecords.add(new StraightEdgeRecord(0, dyc)); shapeRecords.add(new StraightEdgeRecord(0, dya)); shapeRecords.add(new StraightEdgeRecord(0, dyb));
shapeWithStyle.addShapeRecord(new StraightEdgeRecord(-1 * width, 0)); shapeWithStyle.addShapeRecord(new StraightEdgeRecord(0, -1 * height)); shapeWithStyle.addShapeRecord(new StraightEdgeRecord(width, 0)); shapeWithStyle.addShapeRecord(new StraightEdgeRecord(0, height));
shapeWithStyle.addShapeRecord(new StraightEdgeRecord(-1 * width, 0)); shapeWithStyle.addShapeRecord(new StraightEdgeRecord(0, -1 * height)); shapeWithStyle.addShapeRecord(new StraightEdgeRecord(width, 0)); shapeWithStyle.addShapeRecord(new StraightEdgeRecord(0, height));
private void addEdgesWithFill(Styles styles, ShapeWithStyle shapeWithStyle, int[][] coords, int left, int right) { StyleChangeRecord scr = new StyleChangeRecord(); if ((left != 0) || (right != 0)) { IFillStyle fillStyle0 = null; if (left > 0) { fillStyle0 = styles.getFillStyles().get(left - 1); } IFillStyle fillStyle1 = null; if (right > 0) { fillStyle1 = styles.getFillStyles().get(right - 1); } scr.setDefinedStyles(fillStyle0, fillStyle1, null, styles); } shapeWithStyle.addShapeRecord(scr); for (int i = 0; i < coords.length; ++i) { shapeWithStyle.addShapeRecord(new StraightEdgeRecord(coords[i][0], coords[i][1])); } }
private void addEdgesWithFill(Styles styles, ShapeWithStyle shapeWithStyle, int[][] coords, int left, int right) { StyleChangeRecord scr = new StyleChangeRecord(); if ((left != 0) || (right != 0)) { IFillStyle fillStyle0 = null; if (left > 0) { fillStyle0 = styles.getFillStyles().get(left - 1); } IFillStyle fillStyle1 = null; if (right > 0) { fillStyle1 = styles.getFillStyles().get(right - 1); } scr.setDefinedStyles(fillStyle0, fillStyle1, null, styles); } shapeWithStyle.addShapeRecord(scr); for (int i = 0; i < coords.length; ++i) { shapeWithStyle.addShapeRecord(new StraightEdgeRecord(coords[i][0], coords[i][1])); } }