Exemplo n.º 1
0
        public void DrawBitmap(BitmapBits source, Point location)
        {
            int dstx = location.X; int dsty = location.Y;

            for (int i = 0; i < source.Height; i++)
            {
                int di = ((dsty + i) * Width) + dstx;
                int si = i * source.Width;
                Array.Copy(source.Bits, si, Bits, di, source.Width);
            }
        }
Exemplo n.º 2
0
        public BitmapBits Scale(int factor)
        {
            BitmapBits res = new BitmapBits(Width * factor, Height * factor);

            for (int y = 0; y < res.Height; y++)
            {
                for (int x = 0; x < res.Width; x++)
                {
                    res[x, y] = this[(x / factor), (y / factor)];
                }
            }
            return(res);
        }
Exemplo n.º 3
0
 public FontItem(byte[] file, int address, bool oldformat, ushort index)
 {
     if (!oldformat)
     {
         ID       = BitConverter.ToUInt16(file, address);
         miscdata = new byte[0xE];
         Array.Copy(file, address + 2, miscdata, 0, miscdata.Length);
         bits = new BitmapBits(file, address + 0x10, false);
     }
     else
     {
         ID       = index;
         miscdata = new byte[0xE];
         bits     = new BitmapBits(file, address, true);
     }
 }
Exemplo n.º 4
0
        public void DrawBitmapComposited(BitmapBits source, Point location)
        {
            int srcl = 0;

            if (location.X < 0)
            {
                srcl = -location.X;
            }
            int srct = 0;

            if (location.Y < 0)
            {
                srct = -location.Y;
            }
            int srcr = source.Width;

            if (srcr > Width - location.X)
            {
                srcr = Width - location.X;
            }
            int srcb = source.Height;

            if (srcb > Height - location.Y)
            {
                srcb = Height - location.Y;
            }
            for (int i = srct; i < srcb; i++)
            {
                for (int x = srcl; x < srcr; x++)
                {
                    if (source[x, i])
                    {
                        this[location.X + x, location.Y + i] = source[x, i];
                    }
                }
            }
        }