/// <summary> /// Copy a bitmap to the display. /// </summary> /// <remarks> /// Currently, this method only supports copying the bitmap over the contents /// of the display buffer. /// </remarks> /// <param name="x">Abscissa of the top left corner of the bitmap.</param> /// <param name="y">Ordinate of the top left corner of the bitmap.</param> /// <param name="width">Width of the bitmap in bytes.</param> /// <param name="height">Height of the bitmap in bytes.</param> /// <param name="bitmap">Bitmap to transfer</param> /// <param name="bitmapMode">How should the bitmap be transferred to the display?</param> public override void DrawBitmap(int x, int y, OneBppBitmap bitmap, BitmapMode bitmapMode) { var mergeMode = OneBppBitmap.MergeMode.Copy; switch (bitmapMode) { case BitmapMode.And: mergeMode = OneBppBitmap.MergeMode.And; break; case BitmapMode.Or: mergeMode = OneBppBitmap.MergeMode.Or; break; case BitmapMode.XOr: mergeMode = OneBppBitmap.MergeMode.XOr; break; case BitmapMode.Copy: mergeMode = OneBppBitmap.MergeMode.Copy; break; } this._backingStore.MergeInto(( uint )x, ( uint )y, bitmap, mergeMode); }
protected virtual void InitSSD1306() { SendCommands(this.SetupSequence); this._backingStore = OneBppBitmap.FromBuffer(this.Width , this.Height , new byte[this.Width * this.Height / 8] , OneBppBitmap.ByteDirectionSpec.TopToBottomLsbFirst); _showPreamble = new byte[] { 0x21, 0x00, ( byte )(this.Width - 1), 0x22, 0x00, ( byte )((this.Height / 8) - 1) }; IgnoreOutOfBoundsPixels = false; // // Finally, put the display into a known state. // InvertDisplay = false; Sleep = false; Contrast = 0xff; StopScrolling(); }
public virtual OneBppBitmap GetBitmapFromString(string text) { var bitmaps = this.GetCharactersFromString(text); var width = this.GetWidthFromString(text); if (width == 0) { return(null); } var result = OneBppBitmap.FromBitmap(width, this.Height, bitmaps.First()); uint xIndex = 0; foreach (var bitmap in bitmaps) { result.MergeInto(xIndex, 0, bitmap, OneBppBitmap.MergeMode.Or); xIndex = bitmap.Width; } return(result); }
public override void DrawBitmap(int x, int y, OneBppBitmap bitmap, BitmapMode bitmapMode) => throw new NotImplementedException();
public abstract void DrawBitmap(int x, int y, OneBppBitmap bitmap, Color color);
/// <summary> /// Copy a 1bpp bitmap to the display. /// </summary> /// <param name="x">horizontal top left corner of the bitmap.</param> /// <param name="y">vertical top left corner of the bitmap.</param> /// <param name="bitmap">Bitmap to transfer</param> /// <param name="bitmapMode">How should the bitmap be transferred to the display?</param> public abstract void DrawBitmap(int x, int y, OneBppBitmap bitmap, BitmapMode bitmapMode);