m5stack-avatar
Loading...
Searching...
No Matches
ColorPalette.h
1// Copyright (c) Shinya Ishikawa. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full
3// license information.
4
5#ifndef COLOR_PALETTE_H_
6#define COLOR_PALETTE_H_
7#include <M5Unified.h>
8
9#include <map>
10#include <string>
11
12namespace m5avatar {
13
20enum class DrawingLocation : unsigned char {
21 // Skin
22 kSkin = 0, // required
23 // Eye
24 kPupil,
25 kEyelash,
26 kEyelid,
27 kIris1,
28 kIris2,
29 kIrisBackground, // required
30 kEyeHighlight,
31 kSclera,
32 kScleraBackground,
33 // Eyebrow
34 kEyeBrow,
35 // Mouth
36 kMouthBackground,
37 kInnerMouse,
38 kTongue,
39 // Cheek
40 kCheek1,
41 kCheek2,
42 // Chat Balloon
43 kBalloonForeground,
44 kBalloonBackground
45};
46
51 private:
52 std::map<DrawingLocation, uint16_t> palette_;
53
54 public:
55 // TODO(meganetaaan): constructor with color settings
57 ~ColorPalette() = default;
58 ColorPalette(const ColorPalette &other) = default;
59 ColorPalette &operator=(const ColorPalette &other) = default;
60
61 uint16_t get(DrawingLocation key) const;
62 void set(DrawingLocation key, uint16_t value);
63 bool contains(DrawingLocation key);
64 void clear(void);
65};
66} // namespace m5avatar
67
68// defines for backward compatibility
69#define COLOR_PRIMARY m5avatar::DrawingLocation::kIrisBackground
70#define COLOR_SECONDARY m5avatar::DrawingLocation::kIris1
71#define COLOR_BACKGROUND m5avatar::DrawingLocation::kSkin
72#define COLOR_BALLOON_FOREGROUND m5avatar::DrawingLocation::kBalloonForeground
73#define COLOR_BALLOON_BACKGROUND m5avatar::DrawingLocation::kBalloonBackground
74
75#endif // COLOR_PALETTE_H_
Definition: ColorPalette.h:50