Example #1
0
        void BitmapConverter(byte[] bitmapBytes, byte[] pixelBytes, GT.Mainboard.BPP bpp)
        {
            if (bpp != GT.Mainboard.BPP.BPP16_BGR_BE)
            {
                throw new ArgumentOutOfRangeException("bpp", "Only BPP16_BGR_BE supported");
            }

            GHI.OSHW.Hardware.Util.BitmapConvertBPP(bitmapBytes, pixelBytes, GHIOSHW.Util.BPP_Type.BPP16_BGR_BE);

            //Util.BitmapConvertBPP(bitmapBytes, pixelBytes, Util.BPP_Type.BPP16_BGR_BE);

            //int bitmapSize = bitmapBytes.Length;

            //int x = 0;
            //for (int i = 0; i < bitmapSize; i += 4)
            //{
            //    byte R = bitmapBytes[i + 0];
            //    byte G = bitmapBytes[i + 1];
            //    byte B = bitmapBytes[i + 2];

            //    pixelBytes[x] = (byte)((R & 0xE0) | (G >> 5));
            //    pixelBytes[x + 1] = (byte)(B >> 3);
            //    x += 2;
            //}
        }
        private void BitmapConverter(Bitmap bitmap, byte[] pixelBytes, GT.Mainboard.BPP bpp)
        {
            if (bpp != GT.Mainboard.BPP.BPP16_BGR_BE)
            {
                throw new ArgumentOutOfRangeException("bpp", "Only BPP16_BGR_BE supported");
            }

            GHI.Utilities.Bitmaps.Convert(bitmap, GHI.Utilities.Bitmaps.Format.Bpp16BgrBe, pixelBytes);
        }
Example #3
0
        void BitmapConverter(byte[] bitmapBytes, byte[] pixelBytes, GT.Mainboard.BPP bpp)
        {
            if (bpp != GT.Mainboard.BPP.BPP16_BGR_BE)
            {
                throw new ArgumentOutOfRangeException("bpp", "Only BPP16_BGR_BE supported");
            }

            Util.BitmapConvertBPP(bitmapBytes, pixelBytes, Util.BPP_Type.BPP16_BGR_BE);
        }
Example #4
0
        private void NativeBitmapSpi(Bitmap bitmap, SPI.Configuration config, int xSrc, int ySrc, int width, int height, GT.Mainboard.BPP bpp)
        {
            if (bpp != GT.Mainboard.BPP.BPP16_BGR_BE)
            {
                throw new ArgumentOutOfRangeException("bpp", "Only BPP16_BGR_BE supported");
            }

            if (!this.configSet)
            {
                Display.BitmapFormat     = GHI.Utilities.Bitmaps.Format.Bpp16BgrBe;
                Display.CurrentRotation  = Display.Rotation.Normal;
                Display.Type             = Display.DisplayType.Spi;
                Display.ControlPin       = Cpu.Pin.GPIO_NONE;
                Display.BacklightPin     = Cpu.Pin.GPIO_NONE;
                Display.ResetPin         = Cpu.Pin.GPIO_NONE;
                Display.SpiConfiguration = config;
                Display.Width            = bitmap.Width;
                Display.Height           = bitmap.Height;

                Display.Save();

                this.configSet = true;
            }

            bitmap.Flush(xSrc, ySrc, width, height);
        }
Example #5
0
        private void NativeSPIBitmapPaint(Bitmap bitmap, SPI.Configuration config, int xSrc, int ySrc, int width, int height, GT.Mainboard.BPP bpp)
        {
            if (bpp != BPP.BPP16_BGR_BE)
            {
                throw new ArgumentException("Invalid BPP");
            }

            if (!this.configSet)
            {
                Util.SetSpecialDisplayConfig(config, Util.BPP_Type.BPP16_BGR_LE);

                this.configSet = true;
            }

            bitmap.Flush(xSrc, ySrc, width, height);
        }