fix linter errors, reformat
This commit is contained in:
parent
1ba396bc7c
commit
0982857082
1 changed files with 36 additions and 19 deletions
|
@ -1,27 +1,44 @@
|
|||
import { CollageModes, CollageModeType, collageModeType } from "../src/common/collages.ts";
|
||||
import { CanvasRenderingContext2D, createCanvas, Image, ImageBitmap, loadImage } from "https://deno.land/x/canvas/mod.ts";
|
||||
import { CollageModes } from "../src/common/collages.ts";
|
||||
import {
|
||||
CanvasRenderingContext2D,
|
||||
Image,
|
||||
} from "https://deno.land/x/canvas/mod.ts";
|
||||
import { CollageContext, CollageImage } from "../src/common/types.ts";
|
||||
|
||||
export class ProxyImage implements CollageImage {
|
||||
private image: Image;
|
||||
public readonly height: number;
|
||||
public readonly width: number;
|
||||
private image: Image;
|
||||
public readonly height: number;
|
||||
public readonly width: number;
|
||||
|
||||
constructor(image: Image) {
|
||||
this.image = image;
|
||||
this.width = image.width();
|
||||
this.height = image.height();
|
||||
}
|
||||
constructor(image: Image) {
|
||||
this.image = image;
|
||||
this.width = image.width();
|
||||
this.height = image.height();
|
||||
}
|
||||
|
||||
public get(): Image {
|
||||
return this.image;
|
||||
}
|
||||
public get(): Image {
|
||||
return this.image;
|
||||
}
|
||||
}
|
||||
|
||||
export type CastCanvasRenderingContext = CanvasRenderingContext2D & CollageContext;
|
||||
export type CastCanvasRenderingContext =
|
||||
& CanvasRenderingContext2D
|
||||
& CollageContext;
|
||||
|
||||
export default class BrowserCollageModes extends CollageModes<CastCanvasRenderingContext, ProxyImage> {
|
||||
drawImage(ctx: CastCanvasRenderingContext, image: ProxyImage, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void {
|
||||
ctx.drawImage(image.get(), sx, sy, sw, sh, dx, dy, dw, dh);
|
||||
}
|
||||
}
|
||||
export default class BrowserCollageModes
|
||||
extends CollageModes<CastCanvasRenderingContext, ProxyImage> {
|
||||
drawImage(
|
||||
ctx: CastCanvasRenderingContext,
|
||||
image: ProxyImage,
|
||||
sx: number,
|
||||
sy: number,
|
||||
sw: number,
|
||||
sh: number,
|
||||
dx: number,
|
||||
dy: number,
|
||||
dw: number,
|
||||
dh: number,
|
||||
): void {
|
||||
ctx.drawImage(image.get(), sx, sy, sw, sh, dx, dy, dw, dh);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue