예제 #1
0
파일: FntImporter.cs 프로젝트: drdnar/MFE
        private Char digestBitmap(int offset, int width)
        {
            Char ch = new Mfe.Char();

            ch.Height       = (byte)dfPixHeight;
            ch.LogicalWidth = ch.Width = (byte)width;
            ptr             = offset;
            int columns = ((width - 1) >> 3) + 1;

            for (int c = 0; c < columns; c++) /* Not a secret message */
            {
                for (int y = 0; y < dfPixHeight; y++)
                {
                    int line = readByte();
                    for (int x = 0; x < 8; x++, line = line << 1)
                    {
                        ch[y, c * 8 + x] = (line & 0x80) != 0;
                    }
                }
            }
            return(ch);
        }
예제 #2
0
        private static byte getNextByte(Mfe.Char ch, bool Inverted, ref int row, ref int col, out int remainingBits)
        {
            int b     = 0;
            int shift = 0;

            remainingBits = ch.Width * ch.Height - col * ch.Height - row;
            int i;

            if (remainingBits > 8)
            {
                i = 8;
            }
            else
            {
                i = remainingBits;
            }
            while (i-- > 0)
            {
                if (ch[row, col] ^ Inverted)
                {
                    b |= 1 << shift++;
                }
                else
                {
                    shift++;
                }
                remainingBits--;
                row++;
                if (row >= ch.Height)
                {
                    col++;
                    row = 0;
                }
            }
            return((byte)b);
        }