public GR.Memory.ByteBuffer SaveToBuffer() { GR.Memory.ByteBuffer projectFile = new GR.Memory.ByteBuffer(); GR.IO.FileChunk chunkScreenInfo = new GR.IO.FileChunk(Types.FileChunk.CHARSET_SCREEN_INFO); // version chunkScreenInfo.AppendU32(0); // width chunkScreenInfo.AppendI32(ScreenWidth); // height chunkScreenInfo.AppendI32(ScreenHeight); chunkScreenInfo.AppendString(""); chunkScreenInfo.AppendI32((int)Mode); chunkScreenInfo.AppendI32(ScreenOffsetX); chunkScreenInfo.AppendI32(ScreenOffsetY); projectFile.Append(chunkScreenInfo.ToBuffer()); GR.IO.FileChunk chunkCharSet = new GR.IO.FileChunk(Types.FileChunk.CHARSET_DATA); chunkCharSet.Append(CharSet.SaveToBuffer()); projectFile.Append(chunkCharSet.ToBuffer()); GR.IO.FileChunk chunkScreenMultiColorData = new GR.IO.FileChunk(Types.FileChunk.MULTICOLOR_DATA); chunkScreenMultiColorData.AppendU8((byte)Mode); chunkScreenMultiColorData.AppendU8((byte)BackgroundColor); chunkScreenMultiColorData.AppendU8((byte)MultiColor1); chunkScreenMultiColorData.AppendU8((byte)MultiColor2); projectFile.Append(chunkScreenMultiColorData.ToBuffer()); GR.IO.FileChunk chunkScreenCharData = new GR.IO.FileChunk(Types.FileChunk.SCREEN_CHAR_DATA); for (int i = 0; i < Chars.Count; ++i) { chunkScreenCharData.AppendU8((byte)(Chars[i] & 0xff)); } projectFile.Append(chunkScreenCharData.ToBuffer()); GR.IO.FileChunk chunkScreenColorData = new GR.IO.FileChunk(Types.FileChunk.SCREEN_COLOR_DATA); for (int i = 0; i < Chars.Count; ++i) { chunkScreenColorData.AppendU8((byte)(Chars[i] >> 8)); } projectFile.Append(chunkScreenColorData.ToBuffer()); return(projectFile); }
public override GR.Memory.ByteBuffer SaveToBuffer() { return(m_Charset.SaveToBuffer()); }
public GR.Memory.ByteBuffer SaveToBuffer() { GR.Memory.ByteBuffer projectFile = new GR.Memory.ByteBuffer(); GR.IO.FileChunk chunkScreenInfo = new GR.IO.FileChunk(FileChunkConstants.CHARSET_SCREEN_INFO); // version chunkScreenInfo.AppendI32(0); // width chunkScreenInfo.AppendI32(ScreenWidth); // height chunkScreenInfo.AppendI32(ScreenHeight); chunkScreenInfo.AppendString(""); chunkScreenInfo.AppendI32((int)Mode); chunkScreenInfo.AppendI32(ScreenOffsetX); chunkScreenInfo.AppendI32(ScreenOffsetY); chunkScreenInfo.AppendI32(CharOffset); projectFile.Append(chunkScreenInfo.ToBuffer()); GR.IO.FileChunk chunkCharSet = new GR.IO.FileChunk(FileChunkConstants.CHARSET_DATA); chunkCharSet.Append(CharSet.SaveToBuffer()); projectFile.Append(chunkCharSet.ToBuffer()); GR.IO.FileChunk chunkScreenMultiColorData = new GR.IO.FileChunk(FileChunkConstants.MULTICOLOR_DATA); chunkScreenMultiColorData.AppendU8((byte)Mode); chunkScreenMultiColorData.AppendU8((byte)CharSet.Colors.BackgroundColor); chunkScreenMultiColorData.AppendU8((byte)CharSet.Colors.MultiColor1); chunkScreenMultiColorData.AppendU8((byte)CharSet.Colors.MultiColor2); projectFile.Append(chunkScreenMultiColorData.ToBuffer()); GR.IO.FileChunk chunkScreenCharData = new GR.IO.FileChunk(FileChunkConstants.SCREEN_CHAR_DATA); if (Lookup.NumBytesOfSingleCharacter(Lookup.TextCharModeFromTextMode(Mode)) == 2) { for (int i = 0; i < Chars.Count; ++i) { chunkScreenCharData.AppendU16((ushort)(Chars[i] & 0xffff)); } } else { for (int i = 0; i < Chars.Count; ++i) { chunkScreenCharData.AppendU8((byte)(Chars[i] & 0xffff)); } } projectFile.Append(chunkScreenCharData.ToBuffer()); GR.IO.FileChunk chunkScreenColorData = new GR.IO.FileChunk(FileChunkConstants.SCREEN_COLOR_DATA); if (Lookup.NumBytesOfSingleCharacter(Lookup.TextCharModeFromTextMode(Mode)) == 2) { for (int i = 0; i < Chars.Count; ++i) { chunkScreenColorData.AppendU16((ushort)(Chars[i] >> 16)); } } else { for (int i = 0; i < Chars.Count; ++i) { chunkScreenColorData.AppendU8((byte)(Chars[i] >> 16)); } } projectFile.Append(chunkScreenColorData.ToBuffer()); return(projectFile); }