Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BufferRgba8888 update #557

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ namespace Meadow.Foundation.Graphics.Buffers
/// <summary>
/// Represents a 32bpp color pixel buffer
/// </summary>
public class BufferRgb8888 : PixelBufferBase
public class BufferRgba8888 : PixelBufferBase
{
/// <summary>
/// Color mode of the buffer
/// </summary>
public override ColorMode ColorMode => ColorMode.Format32bppRgba8888;

/// <summary>
/// Create a new BufferRgb888 object
/// Create a new BufferRgba8888 object
/// </summary>
/// <param name="width">The width in pixels</param>
/// <param name="height">The height in pixels</param>
/// <param name="buffer">The backing buffer</param>
public BufferRgb8888(int width, int height, byte[] buffer) : base(width, height, buffer) { }
public BufferRgba8888(int width, int height, byte[] buffer) : base(width, height, buffer) { }

/// <summary>
/// Create a new BufferRgb888 object
/// Create a new BufferRgba8888 object
/// </summary>
/// <param name="width">The width in pixels</param>
/// <param name="height">The height in pixels</param>
public BufferRgb8888(int width, int height) : base(width, height) { }
public BufferRgba8888(int width, int height) : base(width, height) { }

/// <summary>
/// Create a new BufferRgb888 object
/// Create a new BufferRgba8888 object
/// </summary>
public BufferRgb8888() : base() { }
public BufferRgba8888() : base() { }

/// <summary>
/// Get the pixel color
Expand All @@ -55,7 +55,6 @@ public override Color GetPixel(int x, int y)
{
var index = ((y * Width) + x) * 4;

//split into R,G,B & invert
byte r = Buffer[index];
byte g = Buffer[index + 1];
byte b = Buffer[index + 2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void LoadBitmap(Stream source)
switch (BitsPerPixel)
{
case 32:
DisplayBuffer = new BufferRgb8888(width, height, pixelData);
DisplayBuffer = new BufferRgba8888(width, height, pixelData);
break;
case 24:
// 24-bit images are stored BGR, not RGB. Yay. Time to swap
Expand Down