View | Details | Raw Unified | Return to bug 48797
Collapse All | Expand All

(-)src/java/org/apache/xmlgraphics/ps/PSProcSets.java (-1 / +14 lines)
Lines 55-63 Link Here
55
            gen.writeln("/ld{load def}bd");
55
            gen.writeln("/ld{load def}bd");
56
            gen.writeln("/M/moveto ld");
56
            gen.writeln("/M/moveto ld");
57
            gen.writeln("/RM/rmoveto ld");
57
            gen.writeln("/RM/rmoveto ld");
58
            gen.writeln("/C/curveto ld");
59
            gen.writeln("/L/lineto ld");
58
            gen.writeln("/t/show ld");
60
            gen.writeln("/t/show ld");
59
            gen.writeln("/A/ashow ld");
61
            gen.writeln("/A/ashow ld");
60
            gen.writeln("/cp/closepath ld");
62
            gen.writeln("/cp/closepath ld");
63
            gen.writeln("/RC/setrgbcolor ld");
64
            gen.writeln("/GC/setgray ld");
65
            gen.writeln("/CC/setcmykcolor ld");
66
            gen.writeln("/N/newpath ld");
67
            gen.writeln("/ML/setmiterlimit ld");
68
            gen.writeln("/LW/setlinewidth ld");
69
            gen.writeln("/LJ/setlinejoin ld");
70
            gen.writeln("/GR/grestore ld");
71
            gen.writeln("/GS/gsave ld");
72
            gen.writeln("/f/fill ld");
73
            gen.writeln("/S/stroke ld");
61
74
62
            gen.writeln("/re {4 2 roll M"); //define rectangle
75
            gen.writeln("/re {4 2 roll M"); //define rectangle
63
            gen.writeln("1 index 0 rlineto");
76
            gen.writeln("1 index 0 rlineto");
Lines 127-133 Link Here
127
            gen.writeln("  grestore");
140
            gen.writeln("  grestore");
128
            gen.writeln("} bd");
141
            gen.writeln("} bd");
129
142
130
            gen.writeln("/QUADTO {");
143
            gen.writeln("/QT {");
131
            gen.writeln("/Y22 exch store");
144
            gen.writeln("/Y22 exch store");
132
            gen.writeln("/X22 exch store");
145
            gen.writeln("/X22 exch store");
133
            gen.writeln("/Y21 exch store");
146
            gen.writeln("/Y21 exch store");
(-)src/java/org/apache/xmlgraphics/ps/PSGenerator.java (-8 / +8 lines)
Lines 384-390 Link Here
384
     * @exception IOException In case of an I/O problem
384
     * @exception IOException In case of an I/O problem
385
     */
385
     */
386
    public void saveGraphicsState() throws IOException {
386
    public void saveGraphicsState() throws IOException {
387
        writeln("gsave");
387
        writeln("GS");
388
388
389
        PSState state = new PSState(this.currentState, false);
389
        PSState state = new PSState(this.currentState, false);
390
        this.graphicsStateStack.push(this.currentState);
390
        this.graphicsStateStack.push(this.currentState);
Lines 398-404 Link Here
398
     */
398
     */
399
    public boolean restoreGraphicsState() throws IOException {
399
    public boolean restoreGraphicsState() throws IOException {
400
        if (this.graphicsStateStack.size() > 0) {
400
        if (this.graphicsStateStack.size() > 0) {
401
            writeln("grestore");
401
            writeln("GR");
402
            this.currentState = (PSState)this.graphicsStateStack.pop();
402
            this.currentState = (PSState)this.graphicsStateStack.pop();
403
            return true;
403
            return true;
404
        } else {
404
        } else {
Lines 537-543 Link Here
537
     */
537
     */
538
    public void useMiterLimit(float miterlimit) throws IOException {
538
    public void useMiterLimit(float miterlimit) throws IOException {
539
        if (getCurrentState().useMiterLimit(miterlimit)) {
539
        if (getCurrentState().useMiterLimit(miterlimit)) {
540
            writeln(miterlimit + " setmiterlimit");
540
            writeln(miterlimit + " ML");
541
        }
541
        }
542
    }
542
    }
543
543
Lines 548-554 Link Here
548
     */
548
     */
549
    public void useLineWidth(double width) throws IOException {
549
    public void useLineWidth(double width) throws IOException {
550
        if (getCurrentState().useLineWidth(width)) {
550
        if (getCurrentState().useLineWidth(width)) {
551
            writeln(formatDouble(width) + " setlinewidth");
551
            writeln(formatDouble(width) + " LW");
552
        }
552
        }
553
    }
553
    }
554
554
Lines 608-616 Link Here
608
                }
608
                }
609
            }
609
            }
610
            if (same) {
610
            if (same) {
611
                p.append(" setgray");
611
                p.append(" GC");
612
            } else {
612
            } else {
613
                p.append(" setrgbcolor");
613
                p.append(" RC");
614
            }
614
            }
615
        } else if (col.getColorSpace().getType() == ColorSpace.TYPE_CMYK) {
615
        } else if (col.getColorSpace().getType() == ColorSpace.TYPE_CMYK) {
616
            // colorspace is CMYK
616
            // colorspace is CMYK
Lines 620-631 Link Here
620
                }
620
                }
621
                p.append(formatDouble(comps[i]));
621
                p.append(formatDouble(comps[i]));
622
            }
622
            }
623
            p.append(" setcmykcolor");
623
            p.append(" CC");
624
        } else {
624
        } else {
625
            // means we're in DeviceGray or Unknown.
625
            // means we're in DeviceGray or Unknown.
626
            // assume we're in DeviceGray, because otherwise we're screwed.
626
            // assume we're in DeviceGray, because otherwise we're screwed.
627
            p.append(formatDouble(comps[0]));
627
            p.append(formatDouble(comps[0]));
628
            p.append(" setgray");
628
            p.append(" GC");
629
        }
629
        }
630
        return p.toString();
630
        return p.toString();
631
    }
631
    }
(-)src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java (-15 / +16 lines)
Lines 69-77 Link Here
69
69
70
    /** the PostScript generator being created */
70
    /** the PostScript generator being created */
71
    protected PSGenerator gen;
71
    protected PSGenerator gen;
72
    
73
    /** Disable or enable clipping */
74
    protected boolean clippingDisabled = false;
72
75
73
    private boolean clippingDisabled = false;
74
75
    /** Fallback text handler */
76
    /** Fallback text handler */
76
77
77
    protected TextHandler fallbackTextHandler = new StrokingTextHandler();
78
    protected TextHandler fallbackTextHandler = new StrokingTextHandler();
Lines 372-383 Link Here
372
                                 + gen.formatDouble(vals[3]) + " "
373
                                 + gen.formatDouble(vals[3]) + " "
373
                                 + gen.formatDouble(vals[4]) + " "
374
                                 + gen.formatDouble(vals[4]) + " "
374
                                 + gen.formatDouble(vals[5])
375
                                 + gen.formatDouble(vals[5])
375
                                 + " curveto");
376
                                 + " C");
376
                break;
377
                break;
377
            case PathIterator.SEG_LINETO:
378
            case PathIterator.SEG_LINETO:
378
                gen.writeln(gen.formatDouble(vals[0]) + " "
379
                gen.writeln(gen.formatDouble(vals[0]) + " "
379
                                 + gen.formatDouble(vals[1])
380
                                 + gen.formatDouble(vals[1])
380
                                 + " lineto");
381
                                 + " L");
381
                break;
382
                break;
382
            case PathIterator.SEG_MOVETO:
383
            case PathIterator.SEG_MOVETO:
383
                gen.writeln(gen.formatDouble(vals[0]) + " "
384
                gen.writeln(gen.formatDouble(vals[0]) + " "
Lines 388-397 Link Here
388
                gen.writeln(gen.formatDouble(vals[0]) + " "
389
                gen.writeln(gen.formatDouble(vals[0]) + " "
389
                          + gen.formatDouble(vals[1]) + " "
390
                          + gen.formatDouble(vals[1]) + " "
390
                          + gen.formatDouble(vals[2]) + " "
391
                          + gen.formatDouble(vals[2]) + " "
391
                          + gen.formatDouble(vals[3]) + " QUADTO ");
392
                          + gen.formatDouble(vals[3]) + " QT ");
392
                break;
393
                break;
393
            case PathIterator.SEG_CLOSE:
394
            case PathIterator.SEG_CLOSE:
394
                gen.writeln("closepath");
395
                gen.writeln("cp");
395
                break;
396
                break;
396
            default:
397
            default:
397
                break;
398
                break;
Lines 435-441 Link Here
435
            applyPaint(getPaint(), false);
436
            applyPaint(getPaint(), false);
436
            applyStroke(getStroke());
437
            applyStroke(getStroke());
437
438
438
            gen.writeln("newpath");
439
            gen.writeln("N");
439
            PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
440
            PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
440
            processPathIterator(iter);
441
            processPathIterator(iter);
441
            doDrawing(false, true, false);
442
            doDrawing(false, true, false);
Lines 456-462 Link Here
456
        if (!this.clippingDisabled) {
457
        if (!this.clippingDisabled) {
457
            preparePainting();
458
            preparePainting();
458
            try {
459
            try {
459
                gen.writeln("newpath");
460
                gen.writeln("N");
460
                PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
461
                PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
461
                processPathIterator(iter);
462
                processPathIterator(iter);
462
                // clip area
463
                // clip area
Lines 556-566 Link Here
556
                break;
557
                break;
557
            case BasicStroke.JOIN_ROUND:
558
            case BasicStroke.JOIN_ROUND:
558
                gen.useLineJoin(1);
559
                gen.useLineJoin(1);
559
                gen.writeln("1 setlinejoin");
560
                gen.writeln("1 LJ");
560
                break;
561
                break;
561
            case BasicStroke.JOIN_BEVEL:
562
            case BasicStroke.JOIN_BEVEL:
562
                gen.useLineJoin(2);
563
                gen.useLineJoin(2);
563
                gen.writeln("2 setlinejoin");
564
                gen.writeln("2 LJ");
564
                break;
565
                break;
565
            default: System.err.println("Unsupported line join: " + lj);
566
            default: System.err.println("Unsupported line join: " + lj);
566
            }
567
            }
Lines 722-728 Link Here
722
723
723
            applyPaint(getPaint(), true);
724
            applyPaint(getPaint(), true);
724
725
725
            gen.writeln("newpath");
726
            gen.writeln("N");
726
            PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
727
            PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM);
727
            processPathIterator(iter);
728
            processPathIterator(iter);
728
            doDrawing(true, false,
729
            doDrawing(true, false,
Lines 746-765 Link Here
746
        if (fill) {
747
        if (fill) {
747
            if (stroke) {
748
            if (stroke) {
748
                if (!nonzero) {
749
                if (!nonzero) {
749
                    gen.writeln("gsave fill grestore stroke");
750
                    gen.writeln("GS f GR S");
750
                } else {
751
                } else {
751
                    gen.writeln("gsave eofill grestore stroke");
752
                    gen.writeln("GS eofill GR S");
752
                }
753
                }
753
            } else {
754
            } else {
754
                if (!nonzero) {
755
                if (!nonzero) {
755
                    gen.writeln("fill");
756
                    gen.writeln("f");
756
                } else {
757
                } else {
757
                    gen.writeln("eofill");
758
                    gen.writeln("eofill");
758
                }
759
                }
759
            }
760
            }
760
        } else {
761
        } else {
761
            // if(stroke)
762
            // if(stroke)
762
            gen.writeln("stroke");
763
            gen.writeln("S");
763
        }
764
        }
764
    }
765
    }
765
766
(-)src/java/org/apache/xmlgraphics/java2d/ps/AbstractPSDocumentGraphics2D.java (+9 lines)
Lines 89-94 Link Here
89
        writeFileHeader();
89
        writeFileHeader();
90
    }
90
    }
91
91
92
    /**
93
     * Disable clipping on each draw commands.
94
     * 
95
     * @param b set to true avoids clipping.
96
     */
97
    public void disableClipping(boolean b) {
98
        this.clippingDisabled = b;
99
    }
100
92
    protected abstract void writeFileHeader() throws IOException;
101
    protected abstract void writeFileHeader() throws IOException;
93
102
94
    /**
103
    /**

Return to bug 48797