/// <summary> /// Reads the pixel. /// </summary> /// <param name="x">The x.</param> /// <param name="y">The y.</param> /// <returns></returns> Color IPixelGraphicsDevice.ReadPixel(ushort x, ushort y) { uint color = frameBuffer.GetPixel(x, y); return(new Color( (byte)((color & redMask) >> redMaskShift), (byte)((color & greenMask) >> greenMaskShift), (byte)((color & blueMask) >> blueMaskShift), (byte)((color & alphaMask) >> alphaMaskShift) )); }
/// <summary> /// Get a Image from IFrameBuffer with specific Bounds example from Display /// </summary> /// <param name="buffer"></param> /// <param name="rec"></param> /// <returns></returns> public static Image FromBuffer(IFrameBuffer buffer, Rectangle rec) { var img = new Image(rec.Size.Width, rec.Size.Height); for (uint x = rec.Location.X; x < rec.Size.Width; x++) { for (uint y = rec.Location.Y; y < rec.Size.Height; y++) { img.SetPixel(x, y, buffer.GetPixel(x, y)); } } return(img); }
public uint GetPixel(int x, int y) { return(Dev.GetPixel(x, y)); }
/// <summary>Reads a single pixel.</summary> /// <param name="x">The x.</param> /// <param name="y">The y.</param> public Color ReadPixel(ushort x, ushort y) { uint color = frameBuffer.GetPixel(x, y); return(ConvertUIntToColor(color)); }