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

(-)src/java/org/apache/xmlgraphics/ps/PSState.java (-5 / +5 lines)
Lines 43-49 Link Here
43
    private int linecap = 0;
43
    private int linecap = 0;
44
    private double linewidth = 1.0f;
44
    private double linewidth = 1.0f;
45
    private String dashpattern = DEFAULT_DASH;
45
    private String dashpattern = DEFAULT_DASH;
46
    private Color rgbColor = DEFAULT_RGB_COLOR;
46
    private Color color = DEFAULT_RGB_COLOR;
47
    
47
    
48
    //Font state
48
    //Font state
49
    private String fontname;
49
    private String fontname;
Lines 69-75 Link Here
69
        this.linecap = org.linecap;
69
        this.linecap = org.linecap;
70
        this.linewidth = org.linewidth;
70
        this.linewidth = org.linewidth;
71
        this.dashpattern = org.dashpattern;
71
        this.dashpattern = org.dashpattern;
72
        this.rgbColor = org.rgbColor;
72
        this.color = org.color;
73
        this.fontname = org.fontname;
73
        this.fontname = org.fontname;
74
        this.fontsize = org.fontsize;
74
        this.fontsize = org.fontsize;
75
    }
75
    }
Lines 152-159 Link Here
152
     * @return true if the color changed compared to the previous setting
152
     * @return true if the color changed compared to the previous setting
153
     */
153
     */
154
    public boolean useColor(Color value) {
154
    public boolean useColor(Color value) {
155
        if (!rgbColor.equals(value)) {
155
        if (!color.equals(value)) {
156
            rgbColor = value;
156
            color = value;
157
            return true;
157
            return true;
158
        } else {
158
        } else {
159
            return false;
159
            return false;
Lines 192-198 Link Here
192
        gen.useLineCap(linecap);
192
        gen.useLineCap(linecap);
193
        gen.useLineWidth(linewidth);
193
        gen.useLineWidth(linewidth);
194
        gen.useDash(dashpattern);
194
        gen.useDash(dashpattern);
195
        gen.useRGBColor(rgbColor);
195
        gen.useColor(color);
196
        if (fontname != null) {
196
        if (fontname != null) {
197
            gen.useFont(fontname, fontsize);
197
            gen.useFont(fontname, fontsize);
198
        }
198
        }
(-)src/java/org/apache/xmlgraphics/ps/PSGenerator.java (-9 / +18 lines)
Lines 32-37 Link Here
32
32
33
import javax.xml.transform.Source;
33
import javax.xml.transform.Source;
34
34
35
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
35
import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
36
import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
36
37
37
/**
38
/**
Lines 41-46 Link Here
41
 */
42
 */
42
public class PSGenerator {
43
public class PSGenerator {
43
44
45
    /**
46
     * Default postscript language level
47
     */
44
    public static final int DEFAULT_LANGUAGE_LEVEL = 3;
48
    public static final int DEFAULT_LANGUAGE_LEVEL = 3;
45
    
49
    
46
    /** 
50
    /** 
Lines 495-516 Link Here
495
            writeln(pattern + " setdash");
499
            writeln(pattern + " setdash");
496
        }
500
        }
497
    }
501
    }
498
                                
502
499
    /**
503
    /**
500
     * Establishes the specified color (RGB).
504
     * Establishes the specified color (RGB).
501
     * @param col the color as defined by the setrgbcolor command.
505
     * @param col the color as defined by the setrgbcolor command.
502
     * @exception IOException In case of an I/O problem
506
     * @exception IOException In case of an I/O problem
507
     * @deprecated use useColor method instead
503
     */
508
     */
504
    public void useRGBColor(Color col) throws IOException {
509
    public void useRGBColor(Color col) throws IOException {
505
        if (col == null) {
510
        useColor(col);
506
            col = PSState.DEFAULT_RGB_COLOR;
511
    }        
507
        }
512
513
    /**
514
     * Establishes the specified color.
515
     * @param col the color.
516
     * @exception IOException In case of an I/O problem
517
     */
518
    public void useColor(Color col) throws IOException {
508
        if (getCurrentState().useColor(col)) {
519
        if (getCurrentState().useColor(col)) {
509
            float[] comps = col.getColorComponents(null);
520
            final boolean textAsShapes = false;
510
            writeln(formatDouble(comps[0])
521
            PSGraphics2D graphics = new PSGraphics2D(textAsShapes, this);
511
                    + " " + formatDouble(comps[1])
522
            graphics.establishColor(col);
512
                    + " " + formatDouble(comps[2])
513
                    + " setrgbcolor");
514
        }
523
        }
515
    }
524
    }
516
    
525
    

Return to bug 42507