a whole load of work in progress
This commit is contained in:
parent
caec0b8ac9
commit
26ba098183
63 changed files with 3234 additions and 321 deletions
22
static/painter.js
Normal file
22
static/painter.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { Pixmap } from "./haku.js";
|
||||
|
||||
export class Painter {
|
||||
#pixmap;
|
||||
imageBitmap;
|
||||
|
||||
constructor(paintArea) {
|
||||
this.paintArea = paintArea;
|
||||
this.#pixmap = new Pixmap(paintArea, paintArea);
|
||||
}
|
||||
|
||||
async createImageBitmap() {
|
||||
return await createImageBitmap(this.#pixmap.imageData);
|
||||
}
|
||||
|
||||
renderBrush(haku) {
|
||||
this.#pixmap.clear(0, 0, 0, 0);
|
||||
let result = haku.renderBrush(this.#pixmap, this.paintArea / 2, this.paintArea / 2);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue