/** * Private constructor * * @param val * @param s the display string * @param r the default red value * @param g the default green value * @param b the default blue value */ protected Colour(int val, String s, int r, int g, int b) { value = val; string = s; rgb = new RGB(r,g,b); Colour[] oldcols = colours; colours = new Colour[oldcols.length + 1]; System.arraycopy(oldcols, 0, colours, 0, oldcols.length); colours[oldcols.length] = this; }
/** * Private constructor * * @param val * @param s the display string * @param r the default red value * @param g the default green value * @param b the default blue value */ public Colour(int val, String s, int r, int g, int b) { value = val; string = s; rgb = new RGB(r,g,b); Colour[] oldcols = colours; colours = new Colour[oldcols.length + 1]; System.arraycopy(oldcols, 0, colours, 0, oldcols.length); colours[oldcols.length] = this; }
protected void setColourUsed(Colour colour, Color reportColour) { if (log.isDebugEnabled()) { log.debug("Modifying palette colour " + colour.getValue() + " to " + reportColour); } int red = reportColour.getRed(); int green = reportColour.getGreen(); int blue = reportColour.getBlue(); workbook.setColourRGB(colour, red, green, blue); RGB customRGB = new RGB(red, green, blue); usedColours.put(colour, customRGB); }
coneColorFilter.addColorToLookFor(new RGB(0, 0, 0)); coneColorFilter.addColorToLookFor(new RGB(5, 5, 5)); coneColorFilter.addColorToLookFor(new RGB(10, 10, 10)); roadColorfilter.addColorToLookFor(new RGB(68, 63, 69)); roadColorfilter.addColorToLookFor(new RGB(63, 59, 60)); roadColorfilter.addColorToLookFor(new RGB(63, 58, 62)); roadColorfilter.addColorToLookFor(new RGB(76, 72, 73)); roadColorfilter.addColorToLookFor(new RGB(79, 74, 78)); roadColorfilter.addColorToLookFor(new RGB(78, 73, 77)); roadColorfilter.addColorToLookFor(new RGB(78, 73, 77)); roadColorfilter.addColorToLookFor(new RGB(54, 52, 53)); roadColorfilter.addColorToLookFor(new RGB(51, 51, 51)); roadColorfilter.addColorToLookFor(new RGB(40, 40, 40)); roadColorfilter.addColorToLookFor(new RGB(45, 45, 45)); roadColorfilter.addColorToLookFor(new RGB(50, 50, 50)); roadColorfilter.addColorToLookFor(new RGB(55, 55, 55)); roadColorfilter.addColorToLookFor(new RGB(60, 60, 60)); roadColorfilter.addColorToLookFor(new RGB(44, 44, 44));
/** * Initialize the record data */ private void initialize() { byte[] data = getRecord().getData(); int numrecords = IntegerHelper.getInt(data[0], data[1]); for (int i = 0; i < numrecords; i++) { int pos = i * 4 + 2; int red = IntegerHelper.getInt(data[pos], (byte) 0); int green = IntegerHelper.getInt(data[pos + 1], (byte) 0); int blue = IntegerHelper.getInt(data[pos + 2], (byte) 0); rgbColours[i] = new RGB(red, green, blue); } initialized = true; }
/** * Initialize the record data */ private void initialize() { byte[] data = getRecord().getData(); int numrecords = IntegerHelper.getInt(data[0], data[1]); for (int i = 0; i < numrecords; i++) { int pos = i * 4 + 2; int red = IntegerHelper.getInt(data[pos], (byte) 0); int green = IntegerHelper.getInt(data[pos + 1], (byte) 0); int blue = IntegerHelper.getInt(data[pos + 2], (byte) 0); rgbColours[i] = new RGB(red, green, blue); } initialized = true; }
/** * Sets the RGB value for the specified colour for this workbook * * @param c the colour whose RGB value is to be overwritten * @param r the red portion to set (0-255) * @param g the green portion to set (0-255) * @param b the blue portion to set (0-255) */ public void setColourRGB(Colour c, int r, int g, int b) { // Only colours on the standard palette with values 8-64 are acceptable int pos = c.getValue() - 8; if (pos < 0 || pos >= numColours) { return; } if (!initialized) { initialize(); } // Force the colours into the range 0-255 r = setValueRange(r, 0, 0xff); g = setValueRange(g, 0, 0xff); b = setValueRange(b, 0, 0xff); rgbColours[pos] = new RGB(r, g, b); // Indicate that the palette has been modified dirty = true; }
/** * Sets the RGB value for the specified colour for this workbook * * @param c the colour whose RGB value is to be overwritten * @param r the red portion to set (0-255) * @param g the green portion to set (0-255) * @param b the blue portion to set (0-255) */ public void setColourRGB(Colour c, int r, int g, int b) { // Only colours on the standard palette with values 8-64 are acceptable int pos = c.getValue() - 8; if (pos < 0 || pos >= numColours) { return; } if (!initialized) { initialize(); } // Force the colours into the range 0-255 r = setValueRange(r, 0, 0xff); g = setValueRange(g, 0, 0xff); b = setValueRange(b, 0, 0xff); rgbColours[pos] = new RGB(r, g, b); // Indicate that the palette has been modified dirty = true; }