import { Property, View, Screen } from '@nativescript/core';
const xProperty = new Property({
    name: 'x',
    valueConverter(value) {
        return parseFloat(value);
    },
});
const yProperty = new Property({
    name: 'y',
    valueConverter(value) {
        return parseFloat(value);
    },
});
const imageProperty = new Property({
    name: 'image',
});
export class Image extends View {
    _addCanvas(canvas) {
        this._canvas = canvas;
    }
    draw() {
        if (this.image === undefined) {
            return;
        }
        const context = this._canvas.getContext('2d');
        const scale = Screen.mainScreen.scale;
        context.drawImage(this.image, this.x * scale, this.y * scale, this.width * scale, this.height * scale);
    }
}
imageProperty.register(Image);
xProperty.register(Image);
yProperty.register(Image);
//# sourceMappingURL=Image.js.map