public static void Vertical(FastBitmap bmp, Rectangle rect,
                                    FastColour a, FastColour b)
        {
            int x, y, width, height;

            if (!Drawer2DExt.ClampCoords(bmp, rect, out x, out y,
                                         out width, out height))
            {
                return;
            }
            FastColour c = a;

            for (int yy = 0; yy < height; yy++)
            {
                int * row = bmp.GetRowPtr(y + yy);
                float t   = (float)yy / (height - 1);               // so last row has b as its colour

                c.R = (byte)Utils.Lerp(a.R, b.R, t);
                c.G = (byte)Utils.Lerp(a.G, b.G, t);
                c.B = (byte)Utils.Lerp(a.B, b.B, t);
                int pixel = c.ToArgb();

                for (int xx = 0; xx < width; xx++)
                {
                    row[x + xx] = pixel;
                }
            }
        }
Example #2
0
        public override void SetFogColour(FastColour col)
        {
            fogCol = col.ToArgb();
            if (fogCol == lastFogCol)
            {
                return;
            }

            device.SetRenderState(RenderState.FogColor, fogCol);
            lastFogCol = fogCol;
        }
Example #3
0
 unsafe void CalculatePalette(int *palette)
 {
     for (int i = 0; i < Palette.Length; i++)
     {
         FastColour col = Palette[i];
         if (!Active)
         {
             col = FastColour.Scale(col, 0.7f);
         }
         palette[i] = col.ToArgb();
     }
 }
Example #4
0
        public static void Clear(FastBitmap bmp, Rectangle rect, FastColour col)
        {
            int x, y, width, height;

            if (!ClampCoords(bmp, rect, out x, out y, out width, out height))
            {
                return;
            }
            int pixel = col.ToArgb();

            for (int yy = 0; yy < height; yy++)
            {
                int *row = bmp.GetRowPtr(y + yy);
                for (int xx = 0; xx < width; xx++)
                {
                    row[x + xx] = pixel;
                }
            }
        }
        public unsafe static void FastClear(FastBitmap dst, Rectangle dstRect, FastColour col)
        {
            int dstX, dstY, dstWidth, dstHeight;

            if (!CheckCoords(dst, dstRect, out dstX, out dstY, out dstWidth, out dstHeight))
            {
                return;
            }
            int pixel = col.ToArgb();

            for (int yy = 0; yy < dstHeight; yy++)
            {
                int *row = dst.GetRowPtr(dstY + yy);
                for (int xx = 0; xx < dstWidth; xx++)
                {
                    row[dstX + xx] = pixel;
                }
            }
        }
Example #6
0
 public override void ClearColour(FastColour col)
 {
     lastClearCol = col.ToArgb();
 }
 public override void SetFogColour(FastColour col)
 {
     fogCol = col.ToArgb();
     device.SetRenderState(RenderState.FogColor, fogCol);
 }