| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
package uk.me.parabola.imgfmt.app.typ; |
| 14 |
|
| 15 |
import java.nio.charset.CharsetEncoder; |
| 16 |
|
| 17 |
import uk.me.parabola.imgfmt.app.ImgFileWriter; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public class TypPoint extends TypElement { |
| 25 |
private Xpm nightXpm; |
| 26 |
private static final byte F_BITMAP = 0x1; |
| 27 |
private static final byte F_NIGHT_XPM = 0x2; |
| 28 |
private static final byte F_LABEL = 0x4; |
| 29 |
private static final byte F_EXTENDED_FONT = 0x8; |
| 30 |
|
| 31 |
public void write(ImgFileWriter writer, CharsetEncoder encoder) { |
| 32 |
offset = writer.position(); |
| 33 |
|
| 34 |
byte flags = F_BITMAP; |
| 35 |
|
| 36 |
if (nightXpm != null) |
| 37 |
flags |= F_NIGHT_XPM; |
| 38 |
|
| 39 |
if (!labels.isEmpty()) |
| 40 |
flags |= F_LABEL; |
| 41 |
|
| 42 |
if (fontStyle != 0 || dayFontColour != null || nightFontColour != null) |
| 43 |
flags |= F_EXTENDED_FONT; |
| 44 |
|
| 45 |
writer.put1u(flags); |
| 46 |
|
| 47 |
|
| 48 |
ColourInfo colourInfo = xpm.getColourInfo(); |
| 49 |
writer.put1u(colourInfo.getWidth()); |
| 50 |
writer.put1u(colourInfo.getHeight()); |
| 51 |
|
| 52 |
|
| 53 |
writeImage(writer, xpm); |
| 54 |
|
| 55 |
if ((flags & F_NIGHT_XPM) != 0) |
| 56 |
writeImage(writer, nightXpm); |
| 57 |
|
| 58 |
if ((flags & F_LABEL) != 0) |
| 59 |
writeLabelBlock(writer, encoder); |
| 60 |
|
| 61 |
if ((flags & F_EXTENDED_FONT) != 0) |
| 62 |
writeExtendedFontInfo(writer); |
| 63 |
} |
| 64 |
|
| 65 |
public void setNightXpm(Xpm nightXpm) { |
| 66 |
this.nightXpm = nightXpm; |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
public boolean simpleBitmap() { |
| 73 |
return false; |
| 74 |
} |
| 75 |
} |