Solid Bitmap

The SolidBitmap was created to increase performance for editor programs with large user interfaces. All the SolidBitmap does, is emulate a very large Bitmap, when in reality it's only 1x1 pixel big. As editor programs often have a lot of large background colors and sprites that are a fully solid color, they also have a lot of large background bitmaps that are just one solid color.

triangle-exclamation

The SolidBitmap acts as though it's a normal, big bitmap, but it's really only a 1x1 bitmap that gets scaled up to the intended size during rendering. This makes for an increase in performance and a decrease in memory usage.

circle-info

Under normal circumstances, the SolidBitmap is really not necessary to use. The rendering back-end has been improved substantially since the SolidBitmap was invented; however, it remains a method of optimization.

To utilize the SolidBitmap, simple specify the size and the color.

using System;
using odl;

namespace TestNamespace
{
    class Program
    {
        public static void Main(string[] args)
        {
            Graphics.Start();

            Window w = new Window();
            w.Initialize();

            Sprite s = new Sprite();
            s.Bitmap = new SolidBitmap(w.Width, w.Height, Color.RED);

            w.Show();

            while (Graphics.CanUpdate())
            {
                Graphics.Update();
            }

            Graphics.Stop();
        }
    }
}

You can also change the size and color after creation.

triangle-exclamation

Last updated