/// <summary> /// Converts the color to the framebuffer color /// </summary> /// <param name="color">The color.</param> /// <returns></returns> protected uint ConvertColor(Color color) { return (uint)( ((color.Alpha << alphaMaskShift) & alphaMask) | ((color.Red << redMaskShift) & redMask) | ((color.Green << greenMaskShift) & greenMask) | ((color.Blue << blueMaskShift) & blueMask) ); }
/// <summary> /// Sets the palette. /// </summary> /// <param name="colorIndex">Index of the color.</param> /// <param name="color">The color.</param> public void SetPalette(byte colorIndex, Color color) { }
/// <summary> /// Clears the specified color. /// </summary> /// <param name="color">The color.</param> public void Clear(Color color) { //TODO }
/// <summary> /// Writes the pixel. /// </summary> /// <param name="color">The color.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> public void WritePixel(Color color, ushort x, ushort y) { frameBuffer.SetPixel(ConvertColor(color), x, y); UpdateFrame(x, y, 1, 1); }
/// <summary> /// Clears the specified color. /// </summary> /// <param name="color">The color.</param> void IPixelGraphicsDevice.Clear(Color color) { //TODO }
/// <summary> /// Writes the pixel. /// </summary> /// <param name="color">The color.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> void IPixelGraphicsDevice.WritePixel(Color color, ushort x, ushort y) { frameBuffer.SetPixel(ConvertColor(color), x, y); UpdateFrame(x, y, 1, 1); }
/// <summary> /// Sets the palette. /// </summary> /// <param name="colorIndex">Index of the color.</param> /// <param name="color">The color.</param> public void SetPalette(byte colorIndex, Color color) { dacPaletteMask.Write8(0xFF); dacIndexWrite.Write8(colorIndex); dacData.Write8(color.Red); dacData.Write8(color.Green); dacData.Write8(color.Blue); }
/// <summary> /// Gets the palette. /// </summary> /// <param name="colorIndex">Index of the color.</param> /// <returns></returns> public Color GetPalette(byte colorIndex) { Color color = new Color(); dacPaletteMask.Write8(0xFF); dacIndexRead.Write8(colorIndex); color.Red = dacData.Read8(); color.Green = dacData.Read8(); color.Blue = dacData.Read8(); return color; }
/// <summary> /// Starts the device. /// </summary> /// <param name="pciDevice">The pci device.</param> public static void StartDevice(IPCIDevice pciDevice) { var deviceDriver = deviceDriverRegistry.FindDriver(pciDevice); if (deviceDriver == null) { pciDevice.SetNoDriverFound(); return; } var hardwareDevice = System.Activator.CreateInstance(deviceDriver.DriverType); StartDevice(pciDevice, deviceDriver, hardwareDevice as IHardwareDevice); if (pciDevice.VendorID == 0x15AD && pciDevice.DeviceID == 0x0405) { var display = hardwareDevice as IPixelGraphicsDevice; var color = new Color(255, 0, 0); display.WritePixel(color, 100, 100); } }
/// <summary> /// Writes the pixel fast. /// </summary> /// <param name="color">The color.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> public void WritePixelFast(Color color, ushort x, ushort y) { unsafe { byte* row = (byte*)bitmapData.Scan0 + (y * bitmapData.Stride); row[x * 3 + 2] = color.Red; row[x * 3 + 1] = color.Green; row[x * 3 + 0] = color.Blue; } }
/// <summary> /// Writes the pixel. /// </summary> /// <param name="color">The color.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> public void WritePixel(Color color, ushort x, ushort y) { lock (displayform.bitmap) { displayform.bitmap.SetPixel(x, y, System.Drawing.Color.FromArgb(color.Red, color.Green, color.Blue)); } displayform.Changed = true; }