@@ -51,7 +51,7 @@ pub struct Display<
51
51
const HEIGHT : u32 ,
52
52
const BWRBIT : bool ,
53
53
const BYTECOUNT : usize ,
54
- COLOR : ColorType ,
54
+ COLOR : ColorType + PixelColor ,
55
55
> {
56
56
buffer : [ u8 ; BYTECOUNT ] ,
57
57
rotation : DisplayRotation ,
63
63
const HEIGHT : u32 ,
64
64
const BWRBIT : bool ,
65
65
const BYTECOUNT : usize ,
66
- COLOR : ColorType ,
66
+ COLOR : ColorType + PixelColor ,
67
67
> Default for Display < WIDTH , HEIGHT , BWRBIT , BYTECOUNT , COLOR >
68
68
{
69
69
/// Initialize display with the color '0', which may not be the same on all device.
91
91
const HEIGHT : u32 ,
92
92
const BWRBIT : bool ,
93
93
const BYTECOUNT : usize ,
94
- COLOR : ColorType ,
94
+ COLOR : ColorType + PixelColor ,
95
95
> DrawTarget for Display < WIDTH , HEIGHT , BWRBIT , BYTECOUNT , COLOR >
96
96
{
97
97
type Color = COLOR ;
@@ -114,7 +114,7 @@ impl<
114
114
const HEIGHT : u32 ,
115
115
const BWRBIT : bool ,
116
116
const BYTECOUNT : usize ,
117
- COLOR : ColorType ,
117
+ COLOR : ColorType + PixelColor ,
118
118
> OriginDimensions for Display < WIDTH , HEIGHT , BWRBIT , BYTECOUNT , COLOR >
119
119
{
120
120
fn size ( & self ) -> Size {
@@ -130,7 +130,7 @@ impl<
130
130
const HEIGHT : u32 ,
131
131
const BWRBIT : bool ,
132
132
const BYTECOUNT : usize ,
133
- COLOR : ColorType ,
133
+ COLOR : ColorType + PixelColor ,
134
134
> Display < WIDTH , HEIGHT , BWRBIT , BYTECOUNT , COLOR >
135
135
{
136
136
/// get internal buffer to use it (to draw in epd)
@@ -182,7 +182,7 @@ impl<const WIDTH: u32, const HEIGHT: u32, const BWRBIT: bool, const BYTECOUNT: u
182
182
/// Same as `Display`, except that its characteristics are defined at runtime.
183
183
/// See display for documentation as everything is the same except that default
184
184
/// is replaced by a `new` method.
185
- pub struct VarDisplay < ' a , COLOR : ColorType > {
185
+ pub struct VarDisplay < ' a , COLOR : ColorType + PixelColor > {
186
186
width : u32 ,
187
187
height : u32 ,
188
188
bwrbit : bool ,
@@ -192,7 +192,7 @@ pub struct VarDisplay<'a, COLOR: ColorType> {
192
192
}
193
193
194
194
/// For use with embedded_grahics
195
- impl < ' a , COLOR : ColorType > DrawTarget for VarDisplay < ' a , COLOR > {
195
+ impl < ' a , COLOR : ColorType + PixelColor > DrawTarget for VarDisplay < ' a , COLOR > {
196
196
type Color = COLOR ;
197
197
type Error = core:: convert:: Infallible ;
198
198
@@ -208,7 +208,7 @@ impl<'a, COLOR: ColorType> DrawTarget for VarDisplay<'a, COLOR> {
208
208
}
209
209
210
210
/// For use with embedded_grahics
211
- impl < ' a , COLOR : ColorType > OriginDimensions for VarDisplay < ' a , COLOR > {
211
+ impl < ' a , COLOR : ColorType + PixelColor > OriginDimensions for VarDisplay < ' a , COLOR > {
212
212
fn size ( & self ) -> Size {
213
213
match self . rotation {
214
214
DisplayRotation :: Rotate0 | DisplayRotation :: Rotate180 => {
@@ -228,7 +228,7 @@ pub enum VarDisplayError {
228
228
BufferTooSmall ,
229
229
}
230
230
231
- impl < ' a , COLOR : ColorType > VarDisplay < ' a , COLOR > {
231
+ impl < ' a , COLOR : ColorType + PixelColor > VarDisplay < ' a , COLOR > {
232
232
/// You must allocate the buffer by yourself, it must be large enough to contain all pixels.
233
233
///
234
234
/// Parameters are documented in `Display` as they are the same as the const generics there.
@@ -312,7 +312,7 @@ impl<'a> VarDisplay<'a, TriColor> {
312
312
// It sets a specific pixel in a buffer to a given color.
313
313
// The big number of parameters is due to the fact that it is an internal function to both
314
314
// strctures.
315
- fn set_pixel < COLOR : ColorType > (
315
+ fn set_pixel < COLOR : ColorType + PixelColor > (
316
316
buffer : & mut [ u8 ] ,
317
317
width : u32 ,
318
318
height : u32 ,
0 commit comments