コード例 #1
0
ファイル: Tim.cs プロジェクト: EthanNichols/CTR-tools
 /// <summary>
 /// Saves current TIM as 4-bit BMP using BMPHeader.
 /// </summary>
 /// <param name="s">Filename.</param>
 /// <param name="pal">Palette.</param>
 public void SaveBMP(string s, byte[] pal)
 {
     using (BinaryWriterEx bw = new BinaryWriterEx(File.Create(s)))
     {
         BMPHeader bh = new BMPHeader();
         bh.Update(region.Width * 4, region.Height, 16, 4);
         bh.UpdateData(pal, FixBitmapData(FixPixelOrder(data), region.Width * 2, region.Height));
         bh.Write(bw);
     }
 }
コード例 #2
0
        public byte[] SaveBMPToStream(byte[] pal)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriterEx bw = new BinaryWriterEx(ms))
                {
                    BMPHeader bh = new BMPHeader();
                    bh.Update(region.Width * 4, region.Height, 16, 4);
                    bh.UpdateData(pal, FixBitmapData(FixPixelOrder(data), region.Width * 2, region.Height));
                    bh.Write(bw);

                    return(ms.ToArray());
                }
            }
        }