ColorSchemeAtompublic class ColorSchemeAtom extends RecordAtom A ColorSchemeAtom (type 2032). Holds the 8 RGB values for the different
colours of bits of text, that makes up a given colour scheme.
Slides (presumably) link to a given colour scheme atom, and that
defines the colours to be used |
Fields Summary |
---|
private byte[] | _header | private static long | _type | private int | backgroundColourRGB | private int | textAndLinesColourRGB | private int | shadowsColourRGB | private int | titleTextColourRGB | private int | fillsColourRGB | private int | accentColourRGB | private int | accentAndHyperlinkColourRGB | private int | accentAndFollowingHyperlinkColourRGB |
Constructors Summary |
---|
protected ColorSchemeAtom(byte[] source, int start, int len)For the Colour Scheme (ColorSchem) Atom
// Sanity Checking - we're always 40 bytes long
if(len < 40) {
len = 40;
if(source.length - start < 40) {
throw new RuntimeException("Not enough data to form a ColorSchemeAtom (always 40 bytes long) - found " + (source.length - start));
}
}
// Get the header
_header = new byte[8];
System.arraycopy(source,start,_header,0,8);
// Grab the rgb values
backgroundColourRGB = (int)LittleEndian.getInt(source,start+8+0);
textAndLinesColourRGB = (int)LittleEndian.getInt(source,start+8+4);
shadowsColourRGB = (int)LittleEndian.getInt(source,start+8+8);
titleTextColourRGB = (int)LittleEndian.getInt(source,start+8+12);
fillsColourRGB = (int)LittleEndian.getInt(source,start+8+16);
accentColourRGB = (int)LittleEndian.getInt(source,start+8+20);
accentAndHyperlinkColourRGB = (int)LittleEndian.getInt(source,start+8+24);
accentAndFollowingHyperlinkColourRGB = (int)LittleEndian.getInt(source,start+8+28);
| public ColorSchemeAtom()Create a new ColorSchemeAtom, to go with a new Slide
_header = new byte[8];
LittleEndian.putUShort(_header, 0, 16);
LittleEndian.putUShort(_header, 2, (int)_type);
LittleEndian.putInt(_header, 4, 32);
// Setup the default rgb values
backgroundColourRGB = 16777215;
textAndLinesColourRGB = 0;
shadowsColourRGB = 8421504;
titleTextColourRGB = 0;
fillsColourRGB = 10079232;
accentColourRGB = 13382451;
accentAndHyperlinkColourRGB = 16764108;
accentAndFollowingHyperlinkColourRGB = 11711154;
|
Methods Summary |
---|
public int | getAccentAndFollowingHyperlinkColourRGB()Fetch the RGB value for Accent And Following Hyperlink Colour return accentAndFollowingHyperlinkColourRGB;
| public int | getAccentAndHyperlinkColourRGB()Fetch the RGB value for Accent And Hyperlink Colour return accentAndHyperlinkColourRGB;
| public int | getAccentColourRGB()Fetch the RGB value for Accent Colour return accentColourRGB;
| public int | getBackgroundColourRGB()Fetch the RGB value for Background Colour
return backgroundColourRGB;
| public int | getColor(int idx)Returns color by its index
int[] clr = {backgroundColourRGB, textAndLinesColourRGB, shadowsColourRGB, titleTextColourRGB,
fillsColourRGB, accentColourRGB, accentAndHyperlinkColourRGB, accentAndFollowingHyperlinkColourRGB};
return clr[idx];
| public int | getFillsColourRGB()Fetch the RGB value for Fills Colour return fillsColourRGB;
| public long | getRecordType()We are of type 3999 return _type;
| public int | getShadowsColourRGB()Fetch the RGB value for Shadows Colour return shadowsColourRGB;
| public int | getTextAndLinesColourRGB()Fetch the RGB value for Text And Lines Colour return textAndLinesColourRGB;
| public int | getTitleTextColourRGB()Fetch the RGB value for Title Text Colour return titleTextColourRGB;
| public static int | joinRGB(byte r, byte g, byte b)Convert from split R, G, B values to an integer RGB value
return joinRGB(new byte[] { r,g,b });
| public static int | joinRGB(byte[] rgb)Convert from split R, G, B values to an integer RGB value
if(rgb.length != 3) {
throw new RuntimeException("joinRGB accepts a byte array of 3 values, but got one of " + rgb.length + " values!");
}
byte[] with_zero = new byte[4];
System.arraycopy(rgb,0,with_zero,0,3);
with_zero[3] = 0;
int ret = (int)LittleEndian.getInt(with_zero,0);
return ret;
| public void | setAccentAndFollowingHyperlinkColourRGB(int rgb)Set the RGB value for Accent And Following Hyperlink Colour accentAndFollowingHyperlinkColourRGB = rgb;
| public void | setAccentAndHyperlinkColourRGB(int rgb)Set the RGB value for Accent And Hyperlink Colour accentAndHyperlinkColourRGB = rgb;
| public void | setAccentColourRGB(int rgb)Set the RGB value for Accent Colour accentColourRGB = rgb;
| public void | setBackgroundColourRGB(int rgb)Set the RGB value for Background Colour backgroundColourRGB = rgb;
| public void | setFillsColourRGB(int rgb)Set the RGB value for Fills Colour fillsColourRGB = rgb;
| public void | setShadowsColourRGB(int rgb)Set the RGB value for Shadows Colour shadowsColourRGB = rgb;
| public void | setTextAndLinesColourRGB(int rgb)Set the RGB value for Text And Lines Colour textAndLinesColourRGB = rgb;
| public void | setTitleTextColourRGB(int rgb)Set the RGB value for Title Text Colour titleTextColourRGB = rgb;
| public static byte[] | splitRGB(int rgb)Convert from an integer RGB value to individual R, G, B 0-255 values
byte[] ret = new byte[3];
// Serialise to bytes, then grab the right ones out
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
writeLittleEndian(rgb,baos);
} catch(IOException ie) {
// Should never happen
throw new RuntimeException(ie);
}
byte[] b = baos.toByteArray();
System.arraycopy(b,0,ret,0,3);
return ret;
| public void | writeOut(java.io.OutputStream out)Write the contents of the record back, so it can be written
to disk
// Header - size or type unchanged
out.write(_header);
// Write out the rgb values
writeLittleEndian(backgroundColourRGB,out);
writeLittleEndian(textAndLinesColourRGB,out);
writeLittleEndian(shadowsColourRGB,out);
writeLittleEndian(titleTextColourRGB,out);
writeLittleEndian(fillsColourRGB,out);
writeLittleEndian(accentColourRGB,out);
writeLittleEndian(accentAndHyperlinkColourRGB,out);
writeLittleEndian(accentAndFollowingHyperlinkColourRGB,out);
|
|