Slide 22
Slide 22 text
Bresenham Line Algorithm
Update the method onPointerMove() in app.component.ts:
if (this.previousPoint) {
const currentPoint = {x: ~~event.offsetX, y: ~~event.offsetY};
const points = this.paintService.bresenhamLine(this.previousPoint.x,
this.previousPoint.y, currentPoint.x, currentPoint.y);
for (const {x, y} of points) {
this.context.fillRect(x, y, 2, 2);
}
this.previousPoint = currentPoint;
}
Paint
EX #5
Das nächste Level für Cross-Platform-Apps
Progressive Web Apps und Project Fugu