Kris Jenkins
09/14/2024, 5:14 PMEPaper API well enough yet. Can anyone answer these questions, please?
* I've written a class that implements initialize and draw-two-color. Will that be enough, or are there other methods I need to look at?
* What's the commit method for?
* For draw-two-color, what's the format of the pixels array? I was expecting it to just horizontally scan the region from top-left to bottom-right, but it doesn't seem to be that simple...
https://cdn.discordapp.com/attachments/1284562905278451722/1284562906129764464/IMG_8361.jpeg?ex=66e9102e&is=66e7beae&hm=0d912cc64871c48beb170a4828f8d6066f7bb19abd079c327383dab389dd4972&floitsch
09/16/2024, 7:43 AMKris Jenkins
09/16/2024, 8:44 AMfloitsch
09/16/2024, 3:56 PMAbstractDriver from the pixel-display package:
abstract class AbstractDriver:
abstract width -> int
abstract height -> int
abstract flags -> int
x-rounding -> int: return 8
y-rounding -> int: return 8
start-partial-update speed/int -> none:
start-full-update speed/int -> none:
clean left/int top/int right/int bottom/int -> none:
commit left/int top/int right/int bottom/int -> none:
draw-two-color l/int t/int r/int b/int pixels/ByteArray -> none:
throw "Not a two-color driver"
draw-two-bit l/int t/int r/int b/int plane0/ByteArray plane1/ByteArray -> none:
throw "Not a two-bit driver"
draw-gray-scale l/int t/int r/int b/int pixels/ByteArray -> none:
throw "Not a gray-scale driver"
draw-several-color l/int t/int r/int b/int pixels/ByteArray -> none:
throw "Not a several-color driver"
draw-true-color l/int t/int r/int b/int red/ByteArray green/ByteArray blue/ByteArray -> none:
throw "Not a true-color driver"
close -> none:
As you can see, it has all methods implemented with empty stubs.
For a two-color display, it makes sense to override:
- width
- height
- flags
- draw-to-color
- commit
- clean ?
- start-full-update
- eventually: start-partial-update ...
The EPaper class has plenty of methods, but none override the EPaper methods. These are thus just there as utility methods to help you implement the actualy methods.
Looking at one of the implemented classes (like waveshare-2-color-7-5.toit) you can see that it implements:
- draw-to-color
- clean
- start-full-update
- commit
- it also supports partial updates, but you can ignore these for now.
It uses some additional help methods (send-to-device_, redraw-rect_ ...), but these are not required for the API.
The initialize isn't required either, but you probably want it, and initialize automatically in the constructor (like the Waveshare2Color154).Kris Jenkins
09/19/2024, 10:24 AMfloitsch
09/19/2024, 10:26 AM