示例#1
0
 public void installInto(BasePDFGraphicsContext context) {
   context.addDrawingAcceptor(new CircularPointer(context));
   context.addDrawingAcceptor(new CircularPointer3d(context));
   context.addDrawingAcceptor(new SimplePDFFill(context));
   context.addDrawingAcceptor(new Plain3dPDFLine(context));
   context.addDrawingAcceptor(new PlainPDFLine(context));
 }
示例#2
0
          protected void setStrokeProperties(List<Object> name, Dict properties) {

            Vector4 color = (Vector4) name.get(1);
            if (color == null) color = properties.get(iLinearGraphicsContext.fillColor);
            if (color == null) color = properties.get(iLinearGraphicsContext.color);
            if (color == null) color = black;

            float thick = widthFor(context, properties);

            thick = remapProperties(color = new Vector4(color), null, thick);

            PdfContentByte o = context.getOutput();

            o.setColorFill(new Color(clamp(color.x), clamp(color.y), clamp(color.z)));

            if (opName.equals("Opaque")) {
              PdfGState gs1 = new PdfGState();
              gs1.setFillOpacity(1);
              gs1.setStrokeOpacity(1);
              gs1.setBlendMode(new PdfName("Normal"));
              o.setGState(gs1);
            }
            {
              PdfGState gs1 = new PdfGState();
              gs1.setFillOpacity(color.w);
              gs1.setStrokeOpacity(color.w);
              gs1.setBlendMode(new PdfName(opName));
              o.setGState(gs1);
            }
          }
示例#3
0
    protected void constructUnitSquare(Vector4 color, float size) {
      unitSquare = context.getOutput().createTemplate(size, size);

      unitSquare.circle(size / 2, size / 2, size / 2);

      unitSquare.setColorFill(new Color(clamp(color.x), clamp(color.y), clamp(color.z)));
      unitSquare.fill();
    }
示例#4
0
    public float widthFor(BasePDFGraphicsContext context, Dict properties) {
      Number f = properties.get(iLinearGraphicsContext.thickness);
      Number m = context.getGlobalProperties().get(iLinearGraphicsContext.strokeThicknessMul);

      return (f == null ? 1 : f.floatValue()) * (m == null ? 1 : m.floatValue());
    }
示例#5
0
          protected void setStrokeProperties(List<Object> name, Dict properties) {

            Vector4 color = (Vector4) name.get(1);
            if (color == null) color = properties.get(iLinearGraphicsContext.strokeColor);
            if (color == null) color = properties.get(iLinearGraphicsContext.color);
            if (color == null) color = black;

            float thick = widthFor(context, properties);

            thick = remapProperties(color = new Vector4(color), null, thick);

            Pair<Float, Float> filtered = filteredThickness(thick, color.w);
            if (filtered != null) {
              thick = filtered.left;
              if (filtered.right != color.w) {
                color = new Vector4(color);
                color.w = filtered.right;
              }
            }

            if (lastStyle != null && ongoingStyle != null) {
              if (lastStyle.equals(ongoingStyle)
                  && (lastStyleOp != null && opName.equals(lastStyleOp))) {
                // System.err.println(" skipping
                // set stroke prop");
                // return;

              }
            }

            PdfContentByte o = context.getOutput();
            o.setMiterLimit(2);
            if (thick > 30) {
              o.setLineJoin(path.LINE_JOIN_ROUND);
              o.setLineCap(path.LINE_CAP_ROUND);
            }

            System.err.println(" set stoke properties <" + color + "> <" + opName + ">");
            o.setColorStroke(new Color(clamp(color.x), clamp(color.y), clamp(color.z)));
            o.setLineWidth(thick);

            if (opName.equals("Opaque")) {
              PdfGState gs1 = new PdfGState();
              gs1.setFillOpacity(1);
              gs1.setStrokeOpacity(1);
              gs1.setBlendMode(new PdfName("Normal"));
              o.setGState(gs1);
            } else {
              PdfGState gs1 = new PdfGState();
              // gs1.put(new PdfName("SA"), new
              // PdfName(PdfBoolean.FALSE));

              gs1.setFillOpacity(color.w);
              gs1.setStrokeOpacity(color.w);
              gs1.setBlendMode(new PdfName(opName));
              o.setGState(gs1);
            }

            ongoingStyle = lastStyle;
            lastStyleOp = opName;
          }