| 371 | this.#filter = ("string" === typeof options.filter) ? Filter[options.filter] : options.filter; |
| 372 | } |
| 373 | begin(x, y, width, height) { |
| 374 | const epd = this.#epd, area = this.#area; |
| 375 | |
| 376 | if ((x | width) & 3) |
| 377 | throw new Error; |
| 378 | |
| 379 | if (this.#epd._rotation & 1) { |
| 380 | if ((y | height) & 3) |
| 381 | throw new Error; |
| 382 | } |
| 383 | |
| 384 | if (area.continue) { |
| 385 | if (x < area.x) { |
| 386 | area.width += area.x - x; |
| 387 | area.x = x; |
| 388 | } |
| 389 | if ((x + width) > (area.x + area.width)) |
| 390 | area.width = (x + width) - area.x; |
| 391 | |
| 392 | if (y < area.y) { |
| 393 | area.height += area.y - y; |
| 394 | area.y = y; |
| 395 | } |
| 396 | if ((y + height) > (area.y + area.height)) |
| 397 | area.height = (y + height) - area.y; |
| 398 | } |
| 399 | else |
| 400 | area.x = x, area.y = y, area.width = width, area.height = height; |
| 401 | |
| 402 | epd.setArea(x, y, width, height); |
| 403 | |
| 404 | epd.select.write(0); |
| 405 | epd.spi.write16(0); |
| 406 | |
| 407 | this.#buffer.position = 0; |
| 408 | } |
| 409 | send(src, offset, byteLength) { |
| 410 | const filter = this.#filter, buffer = this.#buffer; |
| 411 | let position = buffer.position; |