[escher][apps] Make View using blendRectWithMask without background

inherit from TransparentView
This commit is contained in:
Émilie Feral
2018-05-15 17:02:49 +02:00
committed by Ecco
parent 6f08a77cac
commit 33ad49789b
16 changed files with 15 additions and 32 deletions

View File

@@ -23,7 +23,6 @@ const uint8_t tickMask[BatteryView::k_tickHeight][BatteryView::k_tickWidth] = {
BatteryView::BatteryView() : BatteryView::BatteryView() :
View(),
m_chargeState(Ion::Battery::Charge::SOMEWHERE_INBETWEEN), m_chargeState(Ion::Battery::Charge::SOMEWHERE_INBETWEEN),
m_isCharging(false), m_isCharging(false),
m_isPlugged(false) m_isPlugged(false)

View File

@@ -3,7 +3,7 @@
#include <escher.h> #include <escher.h>
class BatteryView : public View { class BatteryView : public TransparentView {
public: public:
BatteryView(); BatteryView();
bool setChargeState(Ion::Battery::Charge chargeState); bool setChargeState(Ion::Battery::Charge chargeState);

View File

@@ -5,7 +5,7 @@
namespace HardwareTest { namespace HardwareTest {
class ArrowView : public View { class ArrowView : public TransparentView {
public: public:
ArrowView(); ArrowView();
void drawRect(KDContext * ctx, KDRect rect) const override; void drawRect(KDContext * ctx, KDRect rect) const override;

View File

@@ -3,7 +3,7 @@
#include <escher.h> #include <escher.h>
class LockView : public View { class LockView : public TransparentView {
public: public:
void drawRect(KDContext * ctx, KDRect rect) const override; void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override; KDSize minimalSizeForOptimalDisplay() const override;

View File

@@ -5,9 +5,8 @@
namespace Shared { namespace Shared {
class OkView : public View { class OkView : public TransparentView {
public: public:
using View::View;
void drawRect(KDContext * ctx, KDRect rect) const override; void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override; KDSize minimalSizeForOptimalDisplay() const override;
constexpr static KDCoordinate k_okSize = 20; constexpr static KDCoordinate k_okSize = 20;

View File

@@ -5,7 +5,7 @@
namespace Shared { namespace Shared {
class RoundCursorView : public View { class RoundCursorView : public TransparentView {
public: public:
RoundCursorView(KDColor color = KDColorBlack); RoundCursorView(KDColor color = KDColorBlack);
void drawRect(KDContext * ctx, KDRect rect) const override; void drawRect(KDContext * ctx, KDRect rect) const override;

View File

@@ -1,11 +1,10 @@
#ifndef ESCHER_CHEVRON_VIEW_H #ifndef ESCHER_CHEVRON_VIEW_H
#define ESCHER_CHEVRON_VIEW_H #define ESCHER_CHEVRON_VIEW_H
#include <escher/view.h> #include <escher/transparent_view.h>
class ChevronView : public View { class ChevronView : public TransparentView {
public: public:
ChevronView();
void drawRect(KDContext * ctx, KDRect rect) const override; void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override; KDSize minimalSizeForOptimalDisplay() const override;
/* k_chevronHeight and k_chevronWidth are the dimensions of the chevron. */ /* k_chevronHeight and k_chevronWidth are the dimensions of the chevron. */

View File

@@ -1,11 +1,10 @@
#ifndef ESCHER_ELLIPSIS_VIEW_H #ifndef ESCHER_ELLIPSIS_VIEW_H
#define ESCHER_ELLIPSIS_VIEW_H #define ESCHER_ELLIPSIS_VIEW_H
#include <escher/view.h> #include <escher/transparent_view.h>
class EllipsisView : public View { class EllipsisView : public TransparentView {
public: public:
EllipsisView();
void drawRect(KDContext * ctx, KDRect rect) const override; void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override; KDSize minimalSizeForOptimalDisplay() const override;
/* k_ellipsisHeight and k_ellipsisWidth are the dimensions of the ellipsis. */ /* k_ellipsisHeight and k_ellipsisWidth are the dimensions of the ellipsis. */

View File

@@ -1,9 +1,9 @@
#ifndef ESCHER_GAUGE_VIEW_H #ifndef ESCHER_GAUGE_VIEW_H
#define ESCHER_GAUGE_VIEW_H #define ESCHER_GAUGE_VIEW_H
#include <escher/view.h> #include <escher/transparent_view.h>
class GaugeView : public View { class GaugeView : public TransparentView {
public: public:
GaugeView(); GaugeView();
float level(); float level();

View File

@@ -1,9 +1,9 @@
#ifndef ESCHER_KEY_VIEW_H #ifndef ESCHER_KEY_VIEW_H
#define ESCHER_KEY_VIEW_H #define ESCHER_KEY_VIEW_H
#include <escher/view.h> #include <escher/transparent_view.h>
class KeyView : public View { class KeyView : public TransparentView {
public: public:
enum class Type { enum class Type {
Up, Up,

View File

@@ -1,9 +1,9 @@
#ifndef ESCHER_SWITCH_VIEW_H #ifndef ESCHER_SWITCH_VIEW_H
#define ESCHER_SWITCH_VIEW_H #define ESCHER_SWITCH_VIEW_H
#include <escher/view.h> #include <escher/transparent_view.h>
class SwitchView : public View { class SwitchView : public TransparentView {
public: public:
SwitchView(); SwitchView();
bool state(); bool state();

View File

@@ -14,11 +14,6 @@ const uint8_t chevronMask[ChevronView::k_chevronHeight][ChevronView::k_chevronWi
{0x0C, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, {0x0C, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
}; };
ChevronView::ChevronView() :
View()
{
}
KDColor s_workingBuffer[ChevronView::k_chevronWidth*ChevronView::k_chevronHeight]; KDColor s_workingBuffer[ChevronView::k_chevronWidth*ChevronView::k_chevronHeight];
void ChevronView::drawRect(KDContext * ctx, KDRect rect) const { void ChevronView::drawRect(KDContext * ctx, KDRect rect) const {

View File

@@ -7,11 +7,6 @@ const uint8_t ellipsisMask[EllipsisView::k_ellipsisHeight][EllipsisView::k_ellip
{0xFF, 0xD1, 0xA1, 0xC1, 0xFF, 0xFF, 0xFF, 0xD1, 0xA1, 0xC1, 0xFF, 0xFF, 0xFF, 0xD1, 0xA1, 0xC1, 0xFF}, {0xFF, 0xD1, 0xA1, 0xC1, 0xFF, 0xFF, 0xFF, 0xD1, 0xA1, 0xC1, 0xFF, 0xFF, 0xFF, 0xD1, 0xA1, 0xC1, 0xFF},
}; };
EllipsisView::EllipsisView() :
View()
{
}
KDColor s_ellipsisWorkingBuffer[EllipsisView::k_ellipsisWidth*EllipsisView::k_ellipsisHeight]; KDColor s_ellipsisWorkingBuffer[EllipsisView::k_ellipsisWidth*EllipsisView::k_ellipsisHeight];
void EllipsisView::drawRect(KDContext * ctx, KDRect rect) const { void EllipsisView::drawRect(KDContext * ctx, KDRect rect) const {

View File

@@ -15,7 +15,6 @@ const uint8_t gaugeIndicatorMask[GaugeView::k_indicatorDiameter][GaugeView::k_in
}; };
GaugeView::GaugeView() : GaugeView::GaugeView() :
View(),
m_level(1), m_level(1),
m_backgroundColor(KDColorWhite) m_backgroundColor(KDColorWhite)
{ {

View File

@@ -67,7 +67,6 @@ const uint8_t minusMask[KeyView::k_keySize][KeyView::k_keySize] = {
}; };
KeyView::KeyView(Type type) : KeyView::KeyView(Type type) :
View(),
m_type(type) m_type(type)
{ {
} }

View File

@@ -33,7 +33,6 @@ const uint8_t onOffMask[SwitchView::k_onOffSize][SwitchView::k_onOffSize] = {
}; };
SwitchView::SwitchView() : SwitchView::SwitchView() :
View(),
m_state(true) m_state(true)
{ {
} }