question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display abstraction interface

See original GitHub issue

I’ve noticed all the various displays have different methods exposed to work with them. I’d like to suggest an interface (or abstract base class) is provided for all of them, so we can write common code, and quickly swap out the display used in our code, without having to change anything but the display creation. I’ve found that I’d often change displays to something better, and having rewrite quite a lot of code because of it, and it would also make it easier for people to adapt existing code and apps for the display they have.

For instance it’s pretty typical that there’s a method for SendBitmap(Bitmap), ClearScreen() and FillRect(Color,Rectangle)`, and it would be nice to be able to write display-agnostic code against all of these. It would also allow us to build a common text and line drawing API for all of these. The interface would also need a few getters to get display info like width/height, bit depth, etc, information about whether there’s on/off control (and if so methods for doing that).

Describe the ideal solution

Suggestion for interface

public interface IDisplay
{
     void SendBitmap(Bitmap bmp);
     void FillRect(Color color, Rectangle rect);
     void ClearScreen();
     Task ResetScreenAsync();
     void SetDisplayOn();
     void SetDisplayOff();     
     bool IsDisplayOnOffSupported() { get; } 
     ushort Width { get; }
     ushort Height { get; }
     byte BitsPerPixel { get; }
     bool IsColorDisplay { get; }
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
richlandercommented, May 4, 2022

Just want to put on the table that we could also start with an existing API/implementation and morph it to what we want. There is a mid-point between “start from scratch” and “use an existing package”.

1reaction
pgrawehrcommented, May 22, 2022

@maloo I think this is the wrong ticket. You’re looking for #1832. Work on this has been started.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Interface and Abstract Class Tutorial With Examples
This video tutorial explains what is Java Interface, how to implement it, and multiple inheritance using Interfaces in Java with examples.
Read more >
How abstraction is achieved using interfaces in Java
Abstraction is a process of hiding the implementation details from the user, only the functionality will be provided to the user.
Read more >
Abstraction in Java
... Class in Java · Difference between Abstract Class and Interface in Java ... Difference Between Lock and Monitor in Java Concurrency ...
Read more >
Implement Interface using Abstract Class in Java
Interface contains only abstract methods that can't be instantiated and it is declared by keyword interface. A class that is declared with ...
Read more >
Java Abstraction
Data abstraction is the process of hiding certain details and showing only essential information to the user. Abstraction can be achieved with either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found