7
7
"time"
8
8
9
9
"tinygo.org/x/drivers"
10
+ "tinygo.org/x/drivers/pixel"
10
11
)
11
12
12
13
type Config struct {
@@ -173,6 +174,8 @@ func (d *Device) EnableTEOutput(on bool) {
173
174
}
174
175
175
176
// DrawRGBBitmap copies an RGB bitmap to the internal buffer at given coordinates
177
+ //
178
+ // Deprecated: use DrawBitmap instead.
176
179
func (d * Device ) DrawRGBBitmap (x , y int16 , data []uint16 , w , h int16 ) error {
177
180
k , i := d .Size ()
178
181
if x < 0 || y < 0 || w <= 0 || h <= 0 ||
@@ -187,6 +190,8 @@ func (d *Device) DrawRGBBitmap(x, y int16, data []uint16, w, h int16) error {
187
190
}
188
191
189
192
// DrawRGBBitmap8 copies an RGB bitmap to the internal buffer at given coordinates
193
+ //
194
+ // Deprecated: use DrawBitmap instead.
190
195
func (d * Device ) DrawRGBBitmap8 (x , y int16 , data []uint8 , w , h int16 ) error {
191
196
k , i := d .Size ()
192
197
if x < 0 || y < 0 || w <= 0 || h <= 0 ||
@@ -200,6 +205,13 @@ func (d *Device) DrawRGBBitmap8(x, y int16, data []uint8, w, h int16) error {
200
205
return nil
201
206
}
202
207
208
+ // DrawBitmap copies the bitmap to the internal buffer on the screen at the
209
+ // given coordinates. It returns once the image data has been sent completely.
210
+ func (d * Device ) DrawBitmap (x , y int16 , bitmap pixel.Image [pixel.RGB565BE ]) error {
211
+ width , height := bitmap .Size ()
212
+ return d .DrawRGBBitmap8 (x , y , bitmap .RawBuffer (), int16 (width ), int16 (height ))
213
+ }
214
+
203
215
// FillRectangle fills a rectangle at given coordinates with a color
204
216
func (d * Device ) FillRectangle (x , y , width , height int16 , c color.RGBA ) error {
205
217
k , i := d .Size ()
0 commit comments