Use transform from math. Update some interfaces
This commit is contained in:
parent
4e7f31e4a0
commit
311945df5c
8 changed files with 14 additions and 24 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { IRgbColor } from "./color";
|
|
||||||
import { IPoint } from "@gxc-solutions/math";
|
import { IPoint } from "@gxc-solutions/math";
|
||||||
|
import { IRgbColor } from "./color";
|
||||||
|
import { ImageSource } from "./image-source";
|
||||||
|
|
||||||
export type FillType = "solid" | "texture";
|
export type FillType = "solid" | "texture";
|
||||||
export type GradientType = "liner" | "radial" | "conic";
|
export type GradientType = "liner" | "radial" | "conic";
|
||||||
|
|
@ -15,7 +16,7 @@ export interface ISolidFill extends IBaseFill {
|
||||||
|
|
||||||
export interface ITextureFill extends IBaseFill {
|
export interface ITextureFill extends IBaseFill {
|
||||||
type: "texture";
|
type: "texture";
|
||||||
texture: HTMLImageElement;
|
texture: ImageSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IGradientStop {
|
export interface IGradientStop {
|
||||||
|
|
|
||||||
1
lib/src/interfaces/image-source.ts
Normal file
1
lib/src/interfaces/image-source.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export type ImageSource = HTMLImageElement | ImageBitmap | ImageData;
|
||||||
|
|
@ -4,4 +4,4 @@ export * from "./objects";
|
||||||
export * from "./fill";
|
export * from "./fill";
|
||||||
export * from "./color";
|
export * from "./color";
|
||||||
export * from "./stroke";
|
export * from "./stroke";
|
||||||
export * from "./transform";
|
export * from "./image-source";
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { IPoint } from "@gxc-solutions/math";
|
import { IPoint, ITransform } from "@gxc-solutions/math";
|
||||||
import { IRgbColor } from "./color";
|
import { IRgbColor } from "./color";
|
||||||
import { Fill } from "./fill";
|
import { Fill } from "./fill";
|
||||||
import { ITransform } from "./transform";
|
|
||||||
import { IStroke } from "./stroke";
|
import { IStroke } from "./stroke";
|
||||||
|
import { ImageSource } from "./image-source";
|
||||||
|
|
||||||
export interface IRectangle {
|
export interface IRectangle {
|
||||||
x: number;
|
x: number;
|
||||||
|
|
@ -47,7 +47,7 @@ export interface IEllipseDrawObject extends IBaseDrawObject {
|
||||||
|
|
||||||
export interface IImageDrawObject extends IBaseDrawObject {
|
export interface IImageDrawObject extends IBaseDrawObject {
|
||||||
readonly type: "image";
|
readonly type: "image";
|
||||||
source: HTMLImageElement | ImageBitmap;
|
source: ImageSource;
|
||||||
stroke: IStroke;
|
stroke: IStroke;
|
||||||
rectangle: IRectangle;
|
rectangle: IRectangle;
|
||||||
fill: Fill;
|
fill: Fill;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
export interface ITransform {
|
|
||||||
scaleX: number;
|
|
||||||
scaleY: number;
|
|
||||||
|
|
||||||
translateY: number;
|
|
||||||
translateX: number;
|
|
||||||
|
|
||||||
skewY: number;
|
|
||||||
skewX: number;
|
|
||||||
|
|
||||||
rotate: number;
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@gxc-solutions/renderer-base",
|
"name": "@gxc-solutions/renderer-base",
|
||||||
"version": "0.0.10",
|
"version": "0.0.11",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "GXC Solutions",
|
"author": "GXC Solutions",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|
|
||||||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -9,7 +9,7 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gxc-solutions/math": "^0.0.2"
|
"@gxc-solutions/math": "^0.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.4",
|
"@eslint/eslintrc": "^3.3.4",
|
||||||
|
|
@ -208,9 +208,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@gxc-solutions/math": {
|
"node_modules/@gxc-solutions/math": {
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"resolved": "https://npm.gxc-solutions.ru/@gxc-solutions/math/-/math-0.0.2.tgz",
|
"resolved": "https://npm.gxc-solutions.ru/@gxc-solutions/math/-/math-0.0.3.tgz",
|
||||||
"integrity": "sha512-R6zYvbspis+XoHZ7lwyVLAUGZkJwivbeo94VtN7cSZzOA86AgVev+UQeHt9S1Ua4d1FwgxYVasck1/l5WXR7CQ=="
|
"integrity": "sha512-B39/C/3YzfSbLgsf0sBpZILTSO8TIZVbh6tv3pXulG1qDL1tg41mLjp7M263MsC7ARzj7ME8WWsniBj0C4L+XA=="
|
||||||
},
|
},
|
||||||
"node_modules/@humanfs/core": {
|
"node_modules/@humanfs/core": {
|
||||||
"version": "0.19.1",
|
"version": "0.19.1",
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "",
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gxc-solutions/math": "^0.0.2"
|
"@gxc-solutions/math": "^0.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.4",
|
"@eslint/eslintrc": "^3.3.4",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue