Sets the Color to be used when drawing all future shapes, text, etc.
(Color c)
| 854 | * Sets the Color to be used when drawing all future shapes, text, etc. |
| 855 | */ |
| 856 | @Override |
| 857 | public void setColor(Color c) { |
| 858 | if(c==null) { |
| 859 | c = Color.black; |
| 860 | } |
| 861 | _color = c; |
| 862 | if(getColorDepth()==BLACK_AND_WHITE) { |
| 863 | float value = 0; |
| 864 | if(c.getRed()+c.getGreen()+c.getBlue()>255*1.5-1) { |
| 865 | value = 1; |
| 866 | } |
| 867 | append(value+" setgray"); //$NON-NLS-1$ |
| 868 | } else if(getColorDepth()==GRAYSCALE) { |
| 869 | float value = ((c.getRed()+c.getGreen()+c.getBlue())/(3*255f)); |
| 870 | append(value+" setgray"); //$NON-NLS-1$ |
| 871 | } else { |
| 872 | append((c.getRed()/255f)+" "+(c.getGreen()/255f)+" "+(c.getBlue()/255f)+" setrgbcolor"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | /** |
| 877 | * Sets the paint mode of this EpsGraphics2D object to overwrite the |
no test coverage detected