Debian Codegraph @

src/uk/me/parabola/imgfmt/app/typ/DrawOrder.java

raw symbols SCIP
1 package uk.me.parabola.imgfmt.app.typ;
2
3 import uk.me.parabola.imgfmt.app.ImgFileWriter;
4 import uk.me.parabola.imgfmt.app.Writeable;
5
6 /**
7 * The drawing order for a type and a set of subtypes.
8 *
9 * The drawing order is specified by the order of these within the file, rather than anything
10 * actually in the item.
11 */
12 public class DrawOrder implements Writeable {
13 private final byte type;
14 private int subTypes;
15 private boolean hasSubtypes;
16
17 public DrawOrder(int type) {
18 this.type = (byte) (type & 0xff);
19 if (type >= 0x100)
20 hasSubtypes = true;
21 }
22
23 public void write(ImgFileWriter writer) {
24 writer.put1u(type);
25 writer.put4(subTypes);
26 }
27
28 public void addSubtype(int subtype) {
29 if (hasSubtypes)
30 subTypes |= 1 << subtype;
31 }
32 }