public PixelData(int width, int height, int bytesPerPixel, byte[] raw, GetPixelDelegate getPixel, SetPixelDelegate setPixel) { Width = width; Height = height; BytesPerPixel = bytesPerPixel; Raw = raw; _setPixel = setPixel; _getPixel = getPixel; }
public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth) { switch (aSize) { case ScreenSize.Size320x200: if (aDepth == ColorDepth.BitDepth8) { WriteVGARegisters(g_320x200x8); PixelWidth = 320; PixelHeight = 200; Colors = 256; SetPixel = new SetPixelDelegate(SetPixel320x200x8); GetPixel = new GetPixelDelegate(GetPixel320x200x8); } else if (aDepth == ColorDepth.BitDepth4) { WriteVGARegisters(g_320x200x4); PixelWidth = 320; PixelHeight = 200; Colors = 16; //SetPixel = new SetPixelDelegate(SetPixel320x200x4); //GetPixel = new GetPixelDelegate(GetPixel320x200x4); } else throw new Exception("Unsupported color depth passed for specified screen size"); break; case ScreenSize.Size640x480: if (aDepth == ColorDepth.BitDepth2) { WriteVGARegisters(g_640x480x2); PixelWidth = 640; PixelHeight = 480; Colors = 4; //SetPixel = new SetPixelDelegate(SetPixel640x480x2); //GetPixel = new GetPixelDelegate(GetPixel640x480x2); } else if (aDepth == ColorDepth.BitDepth4) { WriteVGARegisters(g_640x480x4); PixelWidth = 640; PixelHeight = 480; Colors = 16; SetPixel = new SetPixelDelegate(SetPixel640x480x4); GetPixel = new GetPixelDelegate(GetPixel640x480x4); } else throw new Exception("Unsupported color depth passed for specified screen size"); break; case ScreenSize.Size720x480: if (aDepth == ColorDepth.BitDepth4) { WriteVGARegisters(g_720x480x4); PixelWidth = 720; PixelHeight = 480; Colors = 16; SetPixel = new SetPixelDelegate(SetPixel720x480x4); GetPixel = new GetPixelDelegate(GetPixel720x480x4); } else throw new Exception("Unsupported color depth passed for specified screen size"); break; default: throw new Exception("Unknown screen size"); } }
public VGAScreen() { SetPixel = new SetPixelDelegate(SetPixelNoMode); GetPixel = new GetPixelDelegate(GetPixelNoMode); }