ili9341: st7735: st7789: add DrawBitmap method

This adds a new DrawBitmap method, which is meant to replace
DrawRGBBitmap8.
This commit is contained in:
Ayke van Laethem
2023-11-11 18:49:15 +01:00
committed by Ron Evans
parent 100aadf585
commit af33129f41
3 changed files with 33 additions and 0 deletions
+9
View File
@@ -382,6 +382,8 @@ func (d *DeviceOf[T]) fillRectangle(x, y, width, height int16, c color.RGBA) err
}
// DrawRGBBitmap8 copies an RGB bitmap to the internal buffer at given coordinates
//
// Deprecated: use DrawBitmap instead.
func (d *DeviceOf[T]) DrawRGBBitmap8(x, y int16, data []uint8, w, h int16) error {
k, i := d.Size()
if x < 0 || y < 0 || w <= 0 || h <= 0 ||
@@ -395,6 +397,13 @@ func (d *DeviceOf[T]) DrawRGBBitmap8(x, y int16, data []uint8, w, h int16) error
return nil
}
// DrawBitmap copies the bitmap to the internal buffer on the screen at the
// given coordinates. It returns once the image data has been sent completely.
func (d *DeviceOf[T]) DrawBitmap(x, y int16, bitmap pixel.Image[T]) error {
width, height := bitmap.Size()
return d.DrawRGBBitmap8(x, y, bitmap.RawBuffer(), int16(width), int16(height))
}
// FillRectangleWithBuffer fills buffer with a rectangle at a given coordinates.
func (d *DeviceOf[T]) FillRectangleWithBuffer(x, y, width, height int16, buffer []color.RGBA) error {
i, j := d.Size()