27 lines
No EOL
618 B
Dart
27 lines
No EOL
618 B
Dart
import 'dart:html';
|
|
import 'package:dart_floyd_steinberg_dithering/Dither.dart';
|
|
|
|
CanvasElement input;
|
|
CanvasElement output;
|
|
|
|
ImageElement inputImg;
|
|
ImageElement outputImg;
|
|
|
|
void main() {
|
|
inputImg = new ImageElement(src: 'kitten.jpg', width: 712, height: 470);
|
|
|
|
input = document.querySelector('#input');
|
|
output = document.querySelector('#output');
|
|
|
|
inputImg.onLoad.listen(imgLoaded);
|
|
}
|
|
|
|
void imgLoaded(Event e) {
|
|
print("image loaded");
|
|
input.context2D.drawImage(inputImg, 0, 0);
|
|
|
|
}
|
|
|
|
ImageData getImageData(CanvasElement canvas) {
|
|
return canvas.context2D.getImageData(0, 0, canvas.width, canvas.height);
|
|
} |