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

Erb display context #659

Merged
merged 3 commits into from
Jan 31, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/macos_11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: test/seed2-dfm-eval-euro
run: erbb configure && erbb build firmware && erbb build simulator && erbb build simulator --xcode
working-directory: test/seed2-dfm-eval-euro
- name: test/display-context
run: erbb configure && erbb build firmware && erbb build simulator && erbb build simulator --xcode
working-directory: test/display-context
- name: test/data
run: erbb configure && erbb build
working-directory: test/data
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ubuntu_20_04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: test/seed2-dfm-eval-euro
run: erbb configure && erbb build firmware && erbb build simulator
working-directory: test/seed2-dfm-eval-euro
- name: test/display-context
run: erbb configure && erbb build firmware && erbb build simulator
working-directory: test/display-context
- name: test/data
run: erbb configure && erbb build && erbb build hardware
working-directory: test/data
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ubuntu_22_04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: test/seed2-dfm-eval-euro
run: erbb configure && erbb build firmware && erbb build simulator
working-directory: test/seed2-dfm-eval-euro
- name: test/display-context
run: erbb configure && erbb build firmware && erbb build simulator
working-directory: test/display-context
- name: test/data
run: erbb configure && erbb build && erbb build hardware
working-directory: test/data
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/windows_2019.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: test/seed2-dfm-eval-euro
run: erbb configure && erbb build firmware && erbb build simulator
working-directory: test/seed2-dfm-eval-euro
- name: test/display-context
run: erbb configure && erbb build firmware && erbb build simulator
working-directory: test/display-context
- name: test/data
run: erbb configure && erbb build && erbb build simulator && erbb build hardware
working-directory: test/data
Expand Down
106 changes: 106 additions & 0 deletions include/erb/DisplayContext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*****************************************************************************

DisplayContext.h
Copyright (c) 2020 Raphael DINGE

*Tab=3***********************************************************************/



#pragma once



/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

#include <array>
#include <cstddef>



namespace erb
{



template <typename Format>
class DisplayContext
{

/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

public:
using Storage = typename Format::Storage;

enum class Color
{
On, Off, Invert
};

DisplayContext (Storage & data);
virtual ~DisplayContext () = default;

operator Storage () const;
Storage rotate_ccw (std::size_t width, std::size_t height) const;

void set (Color color);

void fill ();
void draw (std::size_t x, std::size_t y, std::size_t width, std::size_t height);
template <typename Picture>
void draw (std::size_t x, std::size_t y, const Picture & picture, std::size_t width, std::size_t height);
template <typename Picture>
void draw (std::size_t x, std::size_t y, const Picture & picture, std::size_t width, std::size_t height, char c);
template <typename Picture>
void draw (std::size_t x, std::size_t y, const Picture & picture, std::size_t width, std::size_t height, const char * str_0);



/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/



/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

protected:



/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

private:

Storage & _data;

Color _color = Color::On;



/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

private:
DisplayContext () = delete;
DisplayContext (const DisplayContext & rhs) = delete;
DisplayContext (DisplayContext && rhs) = delete;
DisplayContext &
operator = (const DisplayContext & rhs) = delete;
DisplayContext &
operator = (DisplayContext && rhs) = delete;
bool operator == (const DisplayContext & rhs) const = delete;
bool operator != (const DisplayContext & rhs) const = delete;



}; // class DisplayContext



} // namespace erb



#include "erb/DisplayContext.hpp"



/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
Loading
Loading