2020-08-21 09:55:59 +00:00
|
|
|
#include "InfiniPaint.h"
|
|
|
|
#include "../DisplayApp.h"
|
2020-11-15 15:49:36 +00:00
|
|
|
#include "../LittleVgl.h"
|
2020-08-21 09:55:59 +00:00
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
2020-10-09 08:35:32 +00:00
|
|
|
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} {
|
2020-08-21 09:55:59 +00:00
|
|
|
app->SetTouchMode(DisplayApp::TouchModes::Polling);
|
2020-10-04 12:08:48 +00:00
|
|
|
std::fill(b, b + bufferSize, LV_COLOR_WHITE);
|
2020-08-21 09:55:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
InfiniPaint::~InfiniPaint() {
|
|
|
|
// Reset the touchmode
|
|
|
|
app->SetTouchMode(DisplayApp::TouchModes::Gestures);
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InfiniPaint::Refresh() {
|
|
|
|
return running;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InfiniPaint::OnButtonPushed() {
|
|
|
|
running = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) {
|
|
|
|
lv_area_t area;
|
2020-10-04 12:08:48 +00:00
|
|
|
area.x1 = x - (width / 2);
|
|
|
|
area.y1 = y - (height / 2);
|
|
|
|
area.x2 = x + (width / 2) - 1;
|
|
|
|
area.y2 = y + (height / 2) - 1;
|
2020-08-21 09:55:59 +00:00
|
|
|
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None);
|
|
|
|
lvgl.FlushDisplay(&area, b);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|