abstract-image
Advanced tools
Comparing version 11.0.3 to 11.0.4
@@ -1,40 +0,4 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ReactSvgExportExample1 = ReactSvgExportExample1; | ||
const React = __importStar(require("react")); | ||
const AbstractImage = __importStar(require("../../index.js")); | ||
function ReactSvgExportExample1() { | ||
import * as React from "react"; | ||
import * as AbstractImage from "../../index.js"; | ||
export function ReactSvgExportExample1() { | ||
const components = [ | ||
@@ -52,3 +16,3 @@ AbstractImage.createLine(AbstractImage.createPoint(0, 200), AbstractImage.createPoint(400, 200), AbstractImage.black, 1), | ||
// eslint-disable-next-line import/no-default-export | ||
exports.default = { | ||
export default { | ||
component: ReactSvgExportExample1, | ||
@@ -55,0 +19,0 @@ title: "ReactSvgExportExample1", |
@@ -1,40 +0,4 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SvgExportExample1 = SvgExportExample1; | ||
const React = __importStar(require("react")); | ||
const AbstractImage = __importStar(require("../../index.js")); | ||
function SvgExportExample1() { | ||
import * as React from "react"; | ||
import * as AbstractImage from "../../index.js"; | ||
export function SvgExportExample1() { | ||
const components = [ | ||
@@ -53,3 +17,3 @@ AbstractImage.createLine(AbstractImage.createPoint(25, 25), AbstractImage.createPoint(80, 60), AbstractImage.black, 2), | ||
// eslint-disable-next-line import/no-default-export | ||
exports.default = { | ||
export default { | ||
component: SvgExportExample1, | ||
@@ -56,0 +20,0 @@ title: "SvgExportExample1", |
@@ -1,3 +0,3 @@ | ||
import * as AbstractImage from "../model/index.js"; | ||
export declare function dxf2dExportImage(root: AbstractImage.AbstractImage): string; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
export declare function dxf2dExportImage(root: AbstractImage): string; | ||
//# sourceMappingURL=dxf2d-export-image.d.ts.map |
@@ -1,39 +0,3 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dxf2dExportImage = dxf2dExportImage; | ||
const AbstractImage = __importStar(require("../model/index.js")); | ||
function dxf2dExportImage(root) { | ||
import { corners } from "../model/component.js"; | ||
export function dxf2dExportImage(root) { | ||
const builder = createBuilder(); | ||
@@ -203,6 +167,6 @@ let height = root.size.height; | ||
builder.append("66\n" + "1" + "\n"); | ||
let corners = AbstractImage.corners(c); | ||
let cors = corners(c); | ||
// for (let point in c.Corners().Concat(c.Corners().Take(1))) { | ||
// for (let point of concat([corners, corners.take(1)])) { | ||
for (let point of corners.concat(corners[0])) { | ||
for (let point of cors.concat(cors[0])) { | ||
builder.append("0\nVERTEX\n"); | ||
@@ -209,0 +173,0 @@ builder.append("8\n" + layer.toString() + "\n"); |
@@ -1,5 +0,5 @@ | ||
import * as AI from "../model/index.js"; | ||
export declare function epsExportImage(root: AI.AbstractImage): string; | ||
export declare function epsExportImage(root: AI.AbstractImage, characterEncoding: "standard-encoding"): string; | ||
export declare function epsExportImage(root: AI.AbstractImage, characterEncoding: "iso-latin-1-encoding"): Uint8Array; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
export declare function epsExportImage(root: AbstractImage): string; | ||
export declare function epsExportImage(root: AbstractImage, characterEncoding: "standard-encoding"): string; | ||
export declare function epsExportImage(root: AbstractImage, characterEncoding: "iso-latin-1-encoding"): Uint8Array; | ||
//# sourceMappingURL=eps-export-image.d.ts.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.epsExportImage = epsExportImage; | ||
function epsExportImage(root, characterEncoding) { | ||
export function epsExportImage(root, characterEncoding) { | ||
if (characterEncoding === "iso-latin-1-encoding") { | ||
@@ -6,0 +3,0 @@ const eps = [ |
export * from "./svg-export-image.js"; | ||
export * from "./png-export-image.js"; | ||
export * from "./dxf2d-export-image.js"; | ||
export * from "./react-svg-export-image.js"; | ||
export * from "./eps-export-image.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,20 +0,6 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./svg-export-image.js"), exports); | ||
__exportStar(require("./png-export-image.js"), exports); | ||
__exportStar(require("./dxf2d-export-image.js"), exports); | ||
export * from "./svg-export-image.js"; | ||
export * from "./png-export-image.js"; | ||
export * from "./dxf2d-export-image.js"; | ||
export * from "./react-svg-export-image.js"; | ||
export * from "./eps-export-image.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
import * as AbstractImage from "../model/index.js"; | ||
export declare function createPNG(image: AbstractImage.AbstractImage): Uint8Array; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
export declare function createPNG(image: AbstractImage): Uint8Array; | ||
//# sourceMappingURL=png-export-image.d.ts.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createPNG = createPNG; | ||
function createPNG(image) { | ||
export function createPNG(image) { | ||
if (image.components.length !== 1) { | ||
@@ -6,0 +3,0 @@ throw new Error("Not supported!"); |
import React from "react"; | ||
import * as AbstractImage from "../model/index.js"; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
import { Point } from "../model/point.js"; | ||
export interface ReactSvgCallbacks { | ||
@@ -9,7 +10,7 @@ readonly onClick?: MouseCallback; | ||
} | ||
export type MouseCallback = (id: string | undefined, point: AbstractImage.Point) => void; | ||
export type MouseCallback = (id: string | undefined, point: Point) => void; | ||
export declare function ReactSvg({ image, callbacks, }: { | ||
readonly image: AbstractImage.AbstractImage; | ||
readonly image: AbstractImage; | ||
readonly callbacks?: ReactSvgCallbacks; | ||
}): React.JSX.Element; | ||
//# sourceMappingURL=react-svg-export-image.d.ts.map |
@@ -1,47 +0,8 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ReactSvg = ReactSvg; | ||
const B64 = __importStar(require("base64-js")); | ||
const react_1 = __importDefault(require("react")); | ||
const AbstractImage = __importStar(require("../model/index.js")); | ||
function ReactSvg({ image, callbacks, }) { | ||
import { fromByteArray } from "base64-js"; | ||
import React from "react"; | ||
import { createPoint } from "../model/point.js"; | ||
export function ReactSvg({ image, callbacks, }) { | ||
const cb = callbacks || {}; | ||
const id = "ai_root"; | ||
return (react_1.default.createElement("svg", { id: id, width: `${image.size.width}px`, height: `${image.size.height}px`, viewBox: [0, 0, image.size.width, image.size.height].join(" "), onClick: _callback(cb.onClick, id), onDoubleClick: _callback(cb.onDoubleClick, id), onMouseMove: _callback(cb.onMouseMove, id), onContextMenu: _callback(cb.onContextMenu, id) }, image.components.map((c, i) => (react_1.default.createElement(Component, { key: i, component: c }))))); | ||
return (React.createElement("svg", { id: id, width: `${image.size.width}px`, height: `${image.size.height}px`, viewBox: [0, 0, image.size.width, image.size.height].join(" "), onClick: _callback(cb.onClick, id), onDoubleClick: _callback(cb.onDoubleClick, id), onMouseMove: _callback(cb.onMouseMove, id), onContextMenu: _callback(cb.onContextMenu, id) }, image.components.map((c, i) => (React.createElement(JsxComponent, { key: i, component: c }))))); | ||
} | ||
@@ -56,3 +17,3 @@ function _callback(callback, rootId) { | ||
const offsetY = e.clientY - rect.top; | ||
const mousePoint = AbstractImage.createPoint(offsetX, offsetY); | ||
const mousePoint = createPoint(offsetX, offsetY); | ||
const id = getIdAttr(e.target, rootId); | ||
@@ -79,17 +40,17 @@ callback(id && id !== "" ? id : undefined, mousePoint); | ||
} | ||
function Component({ component }) { | ||
function JsxComponent({ component }) { | ||
switch (component.type) { | ||
case "group": | ||
return (react_1.default.createElement("g", { name: component.name }, component.children.flatMap((c, i) => (react_1.default.createElement(Component, { key: i, component: c }))))); | ||
return (React.createElement("g", { name: component.name }, component.children.flatMap((c, i) => (React.createElement(JsxComponent, { key: i, component: c }))))); | ||
case "binaryimage": | ||
const url = getImageUrl(component.format, component.data); | ||
return (react_1.default.createElement("image", { x: component.topLeft.x, y: component.topLeft.y, width: component.bottomRight.x - component.topLeft.x, height: component.bottomRight.y - component.topLeft.y, id: makeIdAttr(component.id), href: url })); | ||
return (React.createElement("image", { x: component.topLeft.x, y: component.topLeft.y, width: component.bottomRight.x - component.topLeft.x, height: component.bottomRight.y - component.topLeft.y, id: makeIdAttr(component.id), href: url })); | ||
case "line": { | ||
const strokeDasharray = component.strokeDashStyle.dashes.length > 0 ? component.strokeDashStyle.dashes.join(" ") : undefined; | ||
const strokeDashoffset = component.strokeDashStyle.dashes.length > 0 ? component.strokeDashStyle.offset : undefined; | ||
return (react_1.default.createElement("line", { id: makeIdAttr(component.id), x1: component.start.x, y1: component.start.y, x2: component.end.x, y2: component.end.y, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset })); | ||
return (React.createElement("line", { id: makeIdAttr(component.id), x1: component.start.x, y1: component.start.y, x2: component.end.x, y2: component.end.y, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset })); | ||
} | ||
case "text": { | ||
if (!component.text) { | ||
return react_1.default.createElement(react_1.default.Fragment, null); | ||
return React.createElement(React.Fragment, null); | ||
} | ||
@@ -99,3 +60,3 @@ const alignmentBaseline = getBaselineAdjustment(component.verticalGrowthDirection); | ||
const lines = component.text !== null ? component.text.split("\n") : []; | ||
const tSpans = lines.map((t, i) => (react_1.default.createElement(TSpan, { key: t, text: t, x: component.position.x, y: component.position.y + i * component.fontSize, fontSize: component.fontSize, alignmentBaseline: alignmentBaseline, lineHeight: component.fontSize }))); | ||
const tSpans = lines.map((t, i) => (React.createElement(TSpan, { key: t, text: t, x: component.position.x, y: component.position.y + i * component.fontSize, fontSize: component.fontSize, alignmentBaseline: alignmentBaseline, lineHeight: component.fontSize }))); | ||
const baseStyle = { | ||
@@ -107,4 +68,4 @@ textAnchor: getTextAnchor(component.horizontalGrowthDirection), | ||
}; | ||
return (react_1.default.createElement(react_1.default.Fragment, null, | ||
component.strokeThickness > 0 && component.strokeColor && (react_1.default.createElement("text", { style: { | ||
return (React.createElement(React.Fragment, null, | ||
component.strokeThickness > 0 && component.strokeColor && (React.createElement("text", { style: { | ||
...baseStyle, | ||
@@ -114,3 +75,3 @@ stroke: colorToRgb(component.strokeColor), | ||
}, transform: transform }, tSpans)), | ||
react_1.default.createElement("text", { style: { ...baseStyle, fill: colorToRgb(component.textColor) }, transform: transform, id: makeIdAttr(component.id) }, tSpans))); | ||
React.createElement("text", { style: { ...baseStyle, fill: colorToRgb(component.textColor) }, transform: transform, id: makeIdAttr(component.id) }, tSpans))); | ||
} | ||
@@ -124,3 +85,3 @@ case "ellipse": { | ||
const strokeDashoffset = component.strokeDashStyle.dashes.length > 0 ? component.strokeDashStyle.offset : undefined; | ||
return (react_1.default.createElement("ellipse", { id: makeIdAttr(component.id), cx: cx, cy: cy, rx: rx, ry: ry, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) })); | ||
return (React.createElement("ellipse", { id: makeIdAttr(component.id), cx: cx, cy: cy, rx: rx, ry: ry, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) })); | ||
} | ||
@@ -131,3 +92,3 @@ case "polyline": { | ||
const strokeDashoffset = component.strokeDashStyle.dashes.length > 0 ? component.strokeDashStyle.offset : undefined; | ||
return (react_1.default.createElement("polyline", { id: makeIdAttr(component.id), points: linePoints, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fill: "none" })); | ||
return (React.createElement("polyline", { id: makeIdAttr(component.id), points: linePoints, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fill: "none" })); | ||
} | ||
@@ -138,3 +99,3 @@ case "polygon": { | ||
const strokeDashoffset = component.strokeDashStyle.dashes.length > 0 ? component.strokeDashStyle.offset : undefined; | ||
return (react_1.default.createElement("polygon", { id: makeIdAttr(component.id), points: points, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) })); | ||
return (React.createElement("polygon", { id: makeIdAttr(component.id), points: points, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) })); | ||
} | ||
@@ -144,6 +105,6 @@ case "rectangle": { | ||
const strokeDashoffset = component.strokeDashStyle.dashes.length > 0 ? component.strokeDashStyle.offset : undefined; | ||
return (react_1.default.createElement("rect", { id: makeIdAttr(component.id), x: component.topLeft.x, y: component.topLeft.y, width: Math.abs(component.bottomRight.x - component.topLeft.x), height: Math.abs(component.bottomRight.y - component.topLeft.y), stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fillOpacity: colorToOpacity(component.fillColor), ...(component.radius ? { rx: component.radius.x.toString(), ry: component.radius.y.toString() } : {}), fill: colorToRgb(component.fillColor) })); | ||
return (React.createElement("rect", { id: makeIdAttr(component.id), x: component.topLeft.x, y: component.topLeft.y, width: Math.abs(component.bottomRight.x - component.topLeft.x), height: Math.abs(component.bottomRight.y - component.topLeft.y), stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), strokeDasharray: strokeDasharray, strokeDashoffset: strokeDashoffset, fillOpacity: colorToOpacity(component.fillColor), ...(component.radius ? { rx: component.radius.x.toString(), ry: component.radius.y.toString() } : {}), fill: colorToRgb(component.fillColor) })); | ||
} | ||
default: | ||
return react_1.default.createElement(react_1.default.Fragment, null); | ||
return React.createElement(React.Fragment, null); | ||
} | ||
@@ -167,3 +128,3 @@ } | ||
else if (format === "png") { | ||
const base64 = B64.fromByteArray(data.bytes); | ||
const base64 = fromByteArray(data.bytes); | ||
return `data:image/png;base64,${base64}`; | ||
@@ -177,3 +138,3 @@ } | ||
} | ||
const base64 = B64.fromByteArray(new Uint8Array(bytes)); | ||
const base64 = fromByteArray(new Uint8Array(bytes)); | ||
return `data:image/svg+xml;base64,${base64}`; | ||
@@ -189,10 +150,10 @@ } | ||
if (inside) { | ||
tags.push(react_1.default.createElement("tspan", { key: i, baselineShift: "sub", alignmentBaseline: alignmentBaseline, style: { fontSize: (fontSize * 0.8).toString() + "px" } }, splitText)); | ||
tags.push(React.createElement("tspan", { key: i, baselineShift: "sub", alignmentBaseline: alignmentBaseline, style: { fontSize: (fontSize * 0.8).toString() + "px" } }, splitText)); | ||
} | ||
else { | ||
tags.push(react_1.default.createElement("tspan", { key: i, alignmentBaseline: alignmentBaseline }, splitText)); | ||
tags.push(React.createElement("tspan", { key: i, alignmentBaseline: alignmentBaseline }, splitText)); | ||
} | ||
inside = !inside; | ||
} | ||
return (react_1.default.createElement("tspan", { x: x, y: y, height: lineHeight.toString() + "px" }, tags)); | ||
return (React.createElement("tspan", { x: x, y: y, height: lineHeight.toString() + "px" }, tags)); | ||
} | ||
@@ -199,0 +160,0 @@ function getBaselineAdjustment(d) { |
@@ -1,3 +0,3 @@ | ||
import * as AbstractImage from "../model/index.js"; | ||
export declare function createSVG(image: AbstractImage.AbstractImage, pixelWidth?: number, pixelHeight?: number): string; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
export declare function createSVG(image: AbstractImage, pixelWidth?: number, pixelHeight?: number): string; | ||
//# sourceMappingURL=svg-export-image.d.ts.map |
@@ -1,39 +0,3 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSVG = createSVG; | ||
const B64 = __importStar(require("base64-js")); | ||
function createSVG(image, pixelWidth, pixelHeight) { | ||
import { fromByteArray } from "base64-js"; | ||
export function createSVG(image, pixelWidth, pixelHeight) { | ||
const imageElements = image.components.map((c) => abstractComponentToSVG(c)); | ||
@@ -305,3 +269,3 @@ return createElement("svg", { | ||
else if (format === "png") { | ||
const base64 = B64.fromByteArray(data.bytes); | ||
const base64 = fromByteArray(data.bytes); | ||
return `data:image/png;base64,${base64}`; | ||
@@ -315,3 +279,3 @@ } | ||
} | ||
const base64 = B64.fromByteArray(new Uint8Array(bytes)); | ||
const base64 = fromByteArray(new Uint8Array(bytes)); | ||
return `data:image/svg+xml;base64,${base64}`; | ||
@@ -318,0 +282,0 @@ } |
@@ -1,28 +0,12 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./model/abstract-image.js"), exports); | ||
__exportStar(require("./model/color.js"), exports); | ||
__exportStar(require("./model/component.js"), exports); | ||
__exportStar(require("./model/point.js"), exports); | ||
__exportStar(require("./model/size.js"), exports); | ||
__exportStar(require("./model/dash-style.js"), exports); | ||
__exportStar(require("./exporters/svg-export-image.js"), exports); | ||
__exportStar(require("./exporters/png-export-image.js"), exports); | ||
__exportStar(require("./exporters/dxf2d-export-image.js"), exports); | ||
__exportStar(require("./exporters/react-svg-export-image.js"), exports); | ||
__exportStar(require("./exporters/eps-export-image.js"), exports); | ||
export * from "./model/abstract-image.js"; | ||
export * from "./model/color.js"; | ||
export * from "./model/component.js"; | ||
export * from "./model/point.js"; | ||
export * from "./model/size.js"; | ||
export * from "./model/dash-style.js"; | ||
export * from "./exporters/svg-export-image.js"; | ||
export * from "./exporters/png-export-image.js"; | ||
export * from "./exporters/dxf2d-export-image.js"; | ||
export * from "./exporters/react-svg-export-image.js"; | ||
export * from "./exporters/eps-export-image.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,12 +0,12 @@ | ||
import * as Size from "./size.js"; | ||
import * as Color from "./color.js"; | ||
import * as Component from "./component.js"; | ||
import * as Point from "./point.js"; | ||
import { Size } from "./size.js"; | ||
import { Color } from "./color.js"; | ||
import { Component } from "./component.js"; | ||
import { Point } from "./point.js"; | ||
export interface AbstractImage { | ||
readonly topLeft: Point.Point; | ||
readonly size: Size.Size; | ||
readonly backgroundColor: Color.Color; | ||
readonly components: Array<Component.Component>; | ||
readonly topLeft: Point; | ||
readonly size: Size; | ||
readonly backgroundColor: Color; | ||
readonly components: Array<Component>; | ||
} | ||
export declare function createAbstractImage(topLeft: Point.Point, size: Size.Size, backgroundColor: Color.Color, components: Array<Component.Component>): AbstractImage; | ||
export declare function createAbstractImage(topLeft: Point, size: Size, backgroundColor: Color, components: Array<Component>): AbstractImage; | ||
//# sourceMappingURL=abstract-image.d.ts.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createAbstractImage = createAbstractImage; | ||
function createAbstractImage(topLeft, size, backgroundColor, components) { | ||
export function createAbstractImage(topLeft, size, backgroundColor, components) { | ||
return { | ||
@@ -6,0 +3,0 @@ topLeft: topLeft, |
@@ -1,11 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lightBlue = exports.yellow = exports.white = exports.transparent = exports.red = exports.purple = exports.orange = exports.magenta = exports.lightGray = exports.green = exports.gray = exports.darkGray = exports.cyan = exports.brown = exports.blue = exports.black = void 0; | ||
exports.fromArgb = fromArgb; | ||
exports.toString6Hex = toString6Hex; | ||
exports.fromString = fromString; | ||
function fromArgb(a, r, g, b) { | ||
export function fromArgb(a, r, g, b) { | ||
return { a: a, r: r, g: g, b: b }; | ||
} | ||
function toString6Hex(color) { | ||
export function toString6Hex(color) { | ||
return (("00" + color.r.toString(16)).substr(-2) + | ||
@@ -15,3 +9,3 @@ ("00" + color.g.toString(16)).substr(-2) + | ||
} | ||
function fromString(s) { | ||
export function fromString(s) { | ||
if (s === null || s === undefined || s.length !== 9 || s[0] !== "#") { | ||
@@ -29,18 +23,18 @@ return undefined; | ||
} | ||
exports.black = fromArgb(0xff, 0, 0, 0); | ||
exports.blue = fromArgb(0xff, 0x00, 0x00, 0xff); | ||
exports.brown = fromArgb(0xff, 0xa5, 0x2a, 0x2a); | ||
exports.cyan = fromArgb(0xff, 0x00, 0xff, 0xff); | ||
exports.darkGray = fromArgb(0xff, 0xa9, 0xa9, 0xa9); | ||
exports.gray = fromArgb(0xff, 0x80, 0x80, 0x80); | ||
exports.green = fromArgb(0xff, 0x00, 0x80, 0x00); | ||
exports.lightGray = fromArgb(0xff, 0xd3, 0xd3, 0xd3); | ||
exports.magenta = fromArgb(0xff, 0xff, 0x00, 0xff); | ||
exports.orange = fromArgb(0xff, 0xff, 0xa5, 0x00); | ||
exports.purple = fromArgb(0xff, 0x80, 0x00, 0x80); | ||
exports.red = fromArgb(0xff, 0xff, 0x00, 0x00); | ||
exports.transparent = fromArgb(0x00, 0xff, 0xff, 0xff); | ||
exports.white = fromArgb(0xff, 0xff, 0xff, 0xff); | ||
exports.yellow = fromArgb(0xff, 0xff, 0xff, 0x00); | ||
exports.lightBlue = fromArgb(0xff, 0xad, 0xd8, 0xe6); | ||
export const black = fromArgb(0xff, 0, 0, 0); | ||
export const blue = fromArgb(0xff, 0x00, 0x00, 0xff); | ||
export const brown = fromArgb(0xff, 0xa5, 0x2a, 0x2a); | ||
export const cyan = fromArgb(0xff, 0x00, 0xff, 0xff); | ||
export const darkGray = fromArgb(0xff, 0xa9, 0xa9, 0xa9); | ||
export const gray = fromArgb(0xff, 0x80, 0x80, 0x80); | ||
export const green = fromArgb(0xff, 0x00, 0x80, 0x00); | ||
export const lightGray = fromArgb(0xff, 0xd3, 0xd3, 0xd3); | ||
export const magenta = fromArgb(0xff, 0xff, 0x00, 0xff); | ||
export const orange = fromArgb(0xff, 0xff, 0xa5, 0x00); | ||
export const purple = fromArgb(0xff, 0x80, 0x00, 0x80); | ||
export const red = fromArgb(0xff, 0xff, 0x00, 0x00); | ||
export const transparent = fromArgb(0x00, 0xff, 0xff, 0xff); | ||
export const white = fromArgb(0xff, 0xff, 0xff, 0xff); | ||
export const yellow = fromArgb(0xff, 0xff, 0xff, 0x00); | ||
export const lightBlue = fromArgb(0xff, 0xad, 0xd8, 0xe6); | ||
//# sourceMappingURL=color.js.map |
@@ -1,5 +0,5 @@ | ||
import * as Point from "./point.js"; | ||
import * as Color from "./color.js"; | ||
import * as DashStyle from "./dash-style.js"; | ||
import * as AbstractImage from "./abstract-image.js"; | ||
import { Point } from "./point.js"; | ||
import { Color } from "./color.js"; | ||
import { DashStyle } from "./dash-style.js"; | ||
import { AbstractImage } from "./abstract-image.js"; | ||
export type Component = BinaryImage | Ellipse | Line | PolyLine | Polygon | Rectangle | Text | SubImage | Group; | ||
@@ -18,4 +18,4 @@ export interface Group { | ||
readonly type: "binaryimage"; | ||
readonly topLeft: Point.Point; | ||
readonly bottomRight: Point.Point; | ||
readonly topLeft: Point; | ||
readonly bottomRight: Point; | ||
readonly format: BinaryFormat; | ||
@@ -34,56 +34,56 @@ readonly data: ImageData; | ||
} | ||
export declare function createBinaryImage(topLeft: Point.Point, bottomRight: Point.Point, format: BinaryFormat, data: ImageData, id?: string): BinaryImage; | ||
export declare function createBinaryImage(topLeft: Point, bottomRight: Point, format: BinaryFormat, data: ImageData, id?: string): BinaryImage; | ||
export interface Ellipse { | ||
readonly type: "ellipse"; | ||
readonly topLeft: Point.Point; | ||
readonly bottomRight: Point.Point; | ||
readonly strokeColor: Color.Color; | ||
readonly topLeft: Point; | ||
readonly bottomRight: Point; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly fillColor: Color.Color; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly fillColor: Color; | ||
readonly id: string | undefined; | ||
} | ||
export declare function createEllipse(topLeft: Point.Point, bottomRight: Point.Point, strokeColor: Color.Color, strokeThickness: number, fillColor: Color.Color, id?: string, strokeDashStyle?: DashStyle.DashStyle): Ellipse; | ||
export declare function createEllipse(topLeft: Point, bottomRight: Point, strokeColor: Color, strokeThickness: number, fillColor: Color, id?: string, strokeDashStyle?: DashStyle): Ellipse; | ||
export interface Line { | ||
readonly type: "line"; | ||
readonly start: Point.Point; | ||
readonly end: Point.Point; | ||
readonly strokeColor: Color.Color; | ||
readonly start: Point; | ||
readonly end: Point; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly id: string | undefined; | ||
} | ||
export declare function createLine(start: Point.Point, end: Point.Point, strokeColor: Color.Color, strokeThickness: number, id?: string, strokeDashStyle?: DashStyle.DashStyle): Line; | ||
export declare function createLine(start: Point, end: Point, strokeColor: Color, strokeThickness: number, id?: string, strokeDashStyle?: DashStyle): Line; | ||
export interface PolyLine { | ||
readonly type: "polyline"; | ||
readonly points: Array<Point.Point>; | ||
readonly strokeColor: Color.Color; | ||
readonly points: Array<Point>; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly id: string | undefined; | ||
} | ||
export declare function createPolyLine(points: Array<Point.Point>, strokeColor: Color.Color, strokeThickness: number, id?: string, strokeDashStyle?: DashStyle.DashStyle): PolyLine; | ||
export declare function createPolyLine(points: Array<Point>, strokeColor: Color, strokeThickness: number, id?: string, strokeDashStyle?: DashStyle): PolyLine; | ||
export interface Polygon { | ||
readonly type: "polygon"; | ||
readonly points: Array<Point.Point>; | ||
readonly strokeColor: Color.Color; | ||
readonly points: Array<Point>; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly fillColor: Color.Color; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly fillColor: Color; | ||
readonly id: string | undefined; | ||
} | ||
export declare function createPolygon(points: Array<Point.Point>, strokeColor: Color.Color, strokeThickness: number, fillColor: Color.Color, id?: string, strokeDashStyle?: DashStyle.DashStyle): Polygon; | ||
export declare function createPolygon(points: Array<Point>, strokeColor: Color, strokeThickness: number, fillColor: Color, id?: string, strokeDashStyle?: DashStyle): Polygon; | ||
export interface Rectangle { | ||
readonly type: "rectangle"; | ||
readonly topLeft: Point.Point; | ||
readonly bottomRight: Point.Point; | ||
readonly strokeColor: Color.Color; | ||
readonly topLeft: Point; | ||
readonly bottomRight: Point; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly fillColor: Color.Color; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly fillColor: Color; | ||
readonly id: string | undefined; | ||
readonly radius?: Point.Point; | ||
readonly radius?: Point; | ||
} | ||
export declare function createRectangle(topLeft: Point.Point, bottomRight: Point.Point, strokeColor: Color.Color, strokeThickness: number, fillColor: Color.Color, id?: string, strokeDashStyle?: DashStyle.DashStyle, radius?: Point.Point): Rectangle; | ||
export declare function corners(rectangle: Rectangle): Array<Point.Point>; | ||
export declare function createRectangle(topLeft: Point, bottomRight: Point, strokeColor: Color, strokeThickness: number, fillColor: Color, id?: string, strokeDashStyle?: DashStyle, radius?: Point): Rectangle; | ||
export declare function corners(rectangle: Rectangle): Array<Point>; | ||
export type AbstractFontWeight = "light" | "normal" | "mediumBold" | "bold" | "extraBold"; | ||
@@ -94,7 +94,7 @@ export type TextAlignment = "left" | "center" | "right"; | ||
readonly type: "text"; | ||
readonly position: Point.Point; | ||
readonly position: Point; | ||
readonly text: string; | ||
readonly fontFamily: string; | ||
readonly fontSize: number; | ||
readonly textColor: Color.Color; | ||
readonly textColor: Color; | ||
readonly fontWeight: AbstractFontWeight; | ||
@@ -106,14 +106,14 @@ readonly clockwiseRotationDegrees: number; | ||
readonly strokeThickness: number; | ||
readonly strokeColor: Color.Color; | ||
readonly strokeColor: Color; | ||
readonly italic: boolean; | ||
readonly id: string | undefined; | ||
} | ||
export declare function createText(position: Point.Point, text: string, fontFamily: string, fontSize: number, textColor: Color.Color, fontWeight: AbstractFontWeight, clockwiseRotationDegrees: number, textAlignment: TextAlignment, horizontalGrowthDirection: GrowthDirection, verticalGrowthDirection: GrowthDirection, strokeThickness: number, strokeColor: Color.Color, italic: boolean, id?: string): Text; | ||
export declare function createText(position: Point, text: string, fontFamily: string, fontSize: number, textColor: Color, fontWeight: AbstractFontWeight, clockwiseRotationDegrees: number, textAlignment: TextAlignment, horizontalGrowthDirection: GrowthDirection, verticalGrowthDirection: GrowthDirection, strokeThickness: number, strokeColor: Color, italic: boolean, id?: string): Text; | ||
export interface SubImage { | ||
readonly type: "subimage"; | ||
readonly topLeft: Point.Point; | ||
readonly topLeft: Point; | ||
readonly image: Component; | ||
} | ||
export declare function createSubImage(topLeft: Point.Point, image: Component): SubImage; | ||
export declare function embedAbstractImage(topLeft: Point.Point, name: string, image: AbstractImage.AbstractImage): Component; | ||
export declare function createSubImage(topLeft: Point, image: Component): SubImage; | ||
export declare function embedAbstractImage(topLeft: Point, name: string, image: AbstractImage): Component; | ||
//# sourceMappingURL=component.d.ts.map |
@@ -1,50 +0,4 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createGroup = createGroup; | ||
exports.createBinaryImage = createBinaryImage; | ||
exports.createEllipse = createEllipse; | ||
exports.createLine = createLine; | ||
exports.createPolyLine = createPolyLine; | ||
exports.createPolygon = createPolygon; | ||
exports.createRectangle = createRectangle; | ||
exports.corners = corners; | ||
exports.createText = createText; | ||
exports.createSubImage = createSubImage; | ||
exports.embedAbstractImage = embedAbstractImage; | ||
const Point = __importStar(require("./point.js")); | ||
const DashStyle = __importStar(require("./dash-style.js")); | ||
function createGroup(name, children) { | ||
import { createPoint } from "./point.js"; | ||
import { solidLine } from "./dash-style.js"; | ||
export function createGroup(name, children) { | ||
return { | ||
@@ -56,3 +10,3 @@ type: "group", | ||
} | ||
function createBinaryImage(topLeft, bottomRight, format, data, id) { | ||
export function createBinaryImage(topLeft, bottomRight, format, data, id) { | ||
return { | ||
@@ -67,3 +21,3 @@ type: "binaryimage", | ||
} | ||
function createEllipse(topLeft, bottomRight, strokeColor, strokeThickness, fillColor, id, strokeDashStyle = DashStyle.solidLine) { | ||
export function createEllipse(topLeft, bottomRight, strokeColor, strokeThickness, fillColor, id, strokeDashStyle = solidLine) { | ||
return { | ||
@@ -80,3 +34,3 @@ type: "ellipse", | ||
} | ||
function createLine(start, end, strokeColor, strokeThickness, id, strokeDashStyle = DashStyle.solidLine) { | ||
export function createLine(start, end, strokeColor, strokeThickness, id, strokeDashStyle = solidLine) { | ||
return { | ||
@@ -92,3 +46,3 @@ type: "line", | ||
} | ||
function createPolyLine(points, strokeColor, strokeThickness, id, strokeDashStyle = DashStyle.solidLine) { | ||
export function createPolyLine(points, strokeColor, strokeThickness, id, strokeDashStyle = solidLine) { | ||
return { | ||
@@ -103,3 +57,3 @@ type: "polyline", | ||
} | ||
function createPolygon(points, strokeColor, strokeThickness, fillColor, id, strokeDashStyle = DashStyle.solidLine) { | ||
export function createPolygon(points, strokeColor, strokeThickness, fillColor, id, strokeDashStyle = solidLine) { | ||
return { | ||
@@ -115,3 +69,3 @@ type: "polygon", | ||
} | ||
function createRectangle(topLeft, bottomRight, strokeColor, strokeThickness, fillColor, id, strokeDashStyle = DashStyle.solidLine, radius) { | ||
export function createRectangle(topLeft, bottomRight, strokeColor, strokeThickness, fillColor, id, strokeDashStyle = solidLine, radius) { | ||
return { | ||
@@ -129,11 +83,11 @@ type: "rectangle", | ||
} | ||
function corners(rectangle) { | ||
export function corners(rectangle) { | ||
return [ | ||
rectangle.topLeft, | ||
Point.createPoint(rectangle.bottomRight.x, rectangle.topLeft.y), | ||
createPoint(rectangle.bottomRight.x, rectangle.topLeft.y), | ||
rectangle.bottomRight, | ||
Point.createPoint(rectangle.topLeft.x, rectangle.bottomRight.y), | ||
createPoint(rectangle.topLeft.x, rectangle.bottomRight.y), | ||
]; | ||
} | ||
function createText(position, text, fontFamily, fontSize, textColor, fontWeight, clockwiseRotationDegrees, textAlignment, horizontalGrowthDirection, verticalGrowthDirection, strokeThickness, strokeColor, italic, id) { | ||
export function createText(position, text, fontFamily, fontSize, textColor, fontWeight, clockwiseRotationDegrees, textAlignment, horizontalGrowthDirection, verticalGrowthDirection, strokeThickness, strokeColor, italic, id) { | ||
return { | ||
@@ -157,8 +111,8 @@ type: "text", | ||
} | ||
function createSubImage(topLeft, image) { | ||
export function createSubImage(topLeft, image) { | ||
return { type: "subimage", topLeft, image }; | ||
} | ||
function embedAbstractImage(topLeft, name, image) { | ||
export function embedAbstractImage(topLeft, name, image) { | ||
return createSubImage(topLeft, createGroup(name, image.components)); | ||
} | ||
//# sourceMappingURL=component.js.map |
@@ -1,6 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.solidLine = void 0; | ||
exports.createDashStyle = createDashStyle; | ||
function createDashStyle(dashes, offset = 0) { | ||
export function createDashStyle(dashes, offset = 0) { | ||
return { | ||
@@ -11,3 +7,3 @@ dashes: dashes, | ||
} | ||
exports.solidLine = createDashStyle([]); | ||
export const solidLine = createDashStyle([]); | ||
//# sourceMappingURL=dash-style.js.map |
@@ -1,23 +0,7 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./abstract-image.js"), exports); | ||
__exportStar(require("./color.js"), exports); | ||
__exportStar(require("./component.js"), exports); | ||
__exportStar(require("./point.js"), exports); | ||
__exportStar(require("./size.js"), exports); | ||
__exportStar(require("./dash-style.js"), exports); | ||
export * from "./abstract-image.js"; | ||
export * from "./color.js"; | ||
export * from "./component.js"; | ||
export * from "./point.js"; | ||
export * from "./size.js"; | ||
export * from "./dash-style.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createPoint = createPoint; | ||
function createPoint(x, y) { | ||
export function createPoint(x, y) { | ||
return { | ||
@@ -6,0 +3,0 @@ x: x, |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSize = createSize; | ||
function createSize(width, height) { | ||
export function createSize(width, height) { | ||
return { | ||
@@ -6,0 +3,0 @@ width: width, |
{ | ||
"name": "abstract-image", | ||
"version": "11.0.3", | ||
"version": "11.0.4", | ||
"description": "Dynamically create images using code or JSX and render to any format", | ||
@@ -34,3 +34,3 @@ "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-image", | ||
}, | ||
"gitHead": "445cb777bc7bf2d301fea27a7bda61d00a9f0e43" | ||
"gitHead": "2b28beae0303be1d261b3b91a7bd946986ba334a" | ||
} |
@@ -1,4 +0,5 @@ | ||
import * as AbstractImage from "../model/index.js"; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
import { Component, corners, Ellipse, Group, Line, Polygon, PolyLine, Rectangle, Text } from "../model/component.js"; | ||
export function dxf2dExportImage(root: AbstractImage.AbstractImage): string { | ||
export function dxf2dExportImage(root: AbstractImage): string { | ||
const builder: Builder = createBuilder(); | ||
@@ -43,3 +44,3 @@ let height: number = root.size.height; | ||
// tslint:disable-next-line:variable-name | ||
c_in: AbstractImage.Component, | ||
c_in: Component, | ||
builder: Builder, | ||
@@ -56,3 +57,3 @@ layer: number, | ||
if (c_in.type === "group") { | ||
let c: AbstractImage.Group = c_in; | ||
let c: Group = c_in; | ||
for (const child of c.children) { | ||
@@ -79,3 +80,3 @@ _visit(child, builder, layer, height); | ||
if (c_in.type === "line") { | ||
let c: AbstractImage.Line = c_in; | ||
let c: Line = c_in; | ||
builder.append("0\nLINE\n"); | ||
@@ -92,3 +93,3 @@ builder.append("8\nLines\n"); | ||
if (c_in.type === "polyline") { | ||
let c: AbstractImage.PolyLine = c_in; | ||
let c: PolyLine = c_in; | ||
builder.append("0\nPOLYLINE\n"); | ||
@@ -109,3 +110,3 @@ builder.append("8\n" + layer.toString() + "\n"); | ||
if (c_in.type === "text") { | ||
let c: AbstractImage.Text = c_in; | ||
let c: Text = c_in; | ||
let horizontalAlignment: number; | ||
@@ -146,3 +147,3 @@ if (c.horizontalGrowthDirection === "left") { | ||
if (c_in.type === "ellipse") { | ||
let c: AbstractImage.Ellipse = c_in; | ||
let c: Ellipse = c_in; | ||
layer++; | ||
@@ -179,3 +180,3 @@ | ||
if (c_in.type === "polygon") { | ||
let c: AbstractImage.Polygon = c_in; | ||
let c: Polygon = c_in; | ||
@@ -199,3 +200,3 @@ builder.append("0\nPOLYLINE\n"); | ||
if (c_in.type === "rectangle") { | ||
let c: AbstractImage.Rectangle = c_in; | ||
let c: Rectangle = c_in; | ||
@@ -205,6 +206,6 @@ builder.append("0\nPOLYLINE\n"); | ||
builder.append("66\n" + "1" + "\n"); | ||
let corners = AbstractImage.corners(c); | ||
let cors = corners(c); | ||
// for (let point in c.Corners().Concat(c.Corners().Take(1))) { | ||
// for (let point of concat([corners, corners.take(1)])) { | ||
for (let point of corners.concat(corners[0])) { | ||
for (let point of cors.concat(cors[0])) { | ||
builder.append("0\nVERTEX\n"); | ||
@@ -211,0 +212,0 @@ builder.append("8\n" + layer.toString() + "\n"); |
@@ -1,9 +0,11 @@ | ||
import * as AI from "../model/index.js"; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
import { Color } from "../model/color.js"; | ||
import { Component, Text } from "../model/component.js"; | ||
type CharacterEncoding = "standard-encoding" | "iso-latin-1-encoding"; | ||
export function epsExportImage(root: AI.AbstractImage): string; | ||
export function epsExportImage(root: AI.AbstractImage, characterEncoding: "standard-encoding"): string; | ||
export function epsExportImage(root: AI.AbstractImage, characterEncoding: "iso-latin-1-encoding"): Uint8Array; | ||
export function epsExportImage(root: AI.AbstractImage, characterEncoding?: CharacterEncoding): string | Uint8Array { | ||
export function epsExportImage(root: AbstractImage): string; | ||
export function epsExportImage(root: AbstractImage, characterEncoding: "standard-encoding"): string; | ||
export function epsExportImage(root: AbstractImage, characterEncoding: "iso-latin-1-encoding"): Uint8Array; | ||
export function epsExportImage(root: AbstractImage, characterEncoding?: CharacterEncoding): string | Uint8Array { | ||
if (characterEncoding === "iso-latin-1-encoding") { | ||
@@ -24,3 +26,3 @@ const eps = [ | ||
function createEpsHeaderLines(root: AI.AbstractImage): ReadonlyArray<string> { | ||
function createEpsHeaderLines(root: AbstractImage): ReadonlyArray<string> { | ||
return [ | ||
@@ -46,3 +48,3 @@ "%!PS-Adobe-3.0 EPSF-3.0", | ||
function epsExportComponent(c: AI.Component, height: number, characterEncoding: CharacterEncoding): Array<string> { | ||
function epsExportComponent(c: Component, height: number, characterEncoding: CharacterEncoding): Array<string> { | ||
switch (c.type) { | ||
@@ -130,3 +132,3 @@ case "ellipse": { | ||
function getTextXOffset(c: AI.Text): string { | ||
function getTextXOffset(c: Text): string { | ||
if (c.horizontalGrowthDirection === "left") { | ||
@@ -141,3 +143,3 @@ return `(${c.text}) stringwidth pop neg`; | ||
function getTextYOffset(c: AI.Text): string { | ||
function getTextYOffset(c: Text): string { | ||
if (c.verticalGrowthDirection === "down") { | ||
@@ -152,3 +154,3 @@ return `gsave (${c.text}) true charpath pathbbox exch pop 3 -1 roll pop sub grestore`; | ||
function getColored(color: AI.Color, instructions: Array<string>): Array<string> { | ||
function getColored(color: Color, instructions: Array<string>): Array<string> { | ||
if (color.a === 0) { | ||
@@ -188,3 +190,3 @@ return []; | ||
function createIsoLatin1FontLines(root: AI.AbstractImage): ReadonlyArray<string> { | ||
function createIsoLatin1FontLines(root: AbstractImage): ReadonlyArray<string> { | ||
const fontFamilies = getUsedFontFamilies(root.components); | ||
@@ -223,3 +225,3 @@ const lines = []; | ||
function getUsedFontFamilies(components: ReadonlyArray<AI.Component>): ReadonlyArray<string> { | ||
function getUsedFontFamilies(components: ReadonlyArray<Component>): ReadonlyArray<string> { | ||
const families = []; | ||
@@ -226,0 +228,0 @@ for (const c of components) { |
export * from "./svg-export-image.js"; | ||
export * from "./png-export-image.js"; | ||
export * from "./dxf2d-export-image.js"; | ||
export * from "./react-svg-export-image.js"; | ||
export * from "./eps-export-image.js"; |
@@ -1,4 +0,4 @@ | ||
import * as AbstractImage from "../model/index.js"; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
export function createPNG(image: AbstractImage.AbstractImage): Uint8Array { | ||
export function createPNG(image: AbstractImage): Uint8Array { | ||
if (image.components.length !== 1) { | ||
@@ -5,0 +5,0 @@ throw new Error("Not supported!"); |
@@ -1,6 +0,8 @@ | ||
import * as B64 from "base64-js"; | ||
import * as AbstractImage from "../model/index.js"; | ||
import { fromByteArray } from "base64-js"; | ||
import { Component, GrowthDirection, BinaryFormat, ImageData } from "../model/component.js"; | ||
import { AbstractImage } from "../model/abstract-image.js"; | ||
import { Color } from "../model/color.js"; | ||
export function createSVG(image: AbstractImage.AbstractImage, pixelWidth?: number, pixelHeight?: number): string { | ||
const imageElements = image.components.map((c: AbstractImage.Component) => abstractComponentToSVG(c)); | ||
export function createSVG(image: AbstractImage, pixelWidth?: number, pixelHeight?: number): string { | ||
const imageElements = image.components.map((c: Component) => abstractComponentToSVG(c)); | ||
@@ -19,3 +21,3 @@ return createElement( | ||
function abstractComponentToSVG(component: AbstractImage.Component): string { | ||
function abstractComponentToSVG(component: Component): string { | ||
switch (component.type) { | ||
@@ -305,3 +307,3 @@ case "group": | ||
function getBaselineAdjustment(d: AbstractImage.GrowthDirection): "baseline" | "central" | "hanging" { | ||
function getBaselineAdjustment(d: GrowthDirection): "baseline" | "central" | "hanging" { | ||
if (d === "up") { | ||
@@ -319,3 +321,3 @@ return "baseline"; | ||
function getTextAnchor(d: AbstractImage.GrowthDirection): string { | ||
function getTextAnchor(d: GrowthDirection): string { | ||
if (d === "left") { | ||
@@ -333,15 +335,15 @@ return "end"; | ||
function colorToRgb(color: AbstractImage.Color): string { | ||
function colorToRgb(color: Color): string { | ||
return `rgb(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()})`; | ||
} | ||
function colorToOpacity(color: AbstractImage.Color): string { | ||
function colorToOpacity(color: Color): string { | ||
return (color.a / 255).toString(); | ||
} | ||
function getImageUrl(format: AbstractImage.BinaryFormat, data: AbstractImage.ImageData): string { | ||
function getImageUrl(format: BinaryFormat, data: ImageData): string { | ||
if (data.type === "url") { | ||
return data.url; | ||
} else if (format === "png") { | ||
const base64 = B64.fromByteArray(data.bytes); | ||
const base64 = fromByteArray(data.bytes); | ||
return `data:image/png;base64,${base64}`; | ||
@@ -354,5 +356,5 @@ } else { | ||
} | ||
const base64 = B64.fromByteArray(new Uint8Array(bytes)); | ||
const base64 = fromByteArray(new Uint8Array(bytes)); | ||
return `data:image/svg+xml;base64,${base64}`; | ||
} | ||
} |
@@ -1,18 +0,18 @@ | ||
import * as Size from "./size.js"; | ||
import * as Color from "./color.js"; | ||
import * as Component from "./component.js"; | ||
import * as Point from "./point.js"; | ||
import { Size } from "./size.js"; | ||
import { Color } from "./color.js"; | ||
import { Component } from "./component.js"; | ||
import { Point } from "./point.js"; | ||
export interface AbstractImage { | ||
readonly topLeft: Point.Point; | ||
readonly size: Size.Size; | ||
readonly backgroundColor: Color.Color; | ||
readonly components: Array<Component.Component>; | ||
readonly topLeft: Point; | ||
readonly size: Size; | ||
readonly backgroundColor: Color; | ||
readonly components: Array<Component>; | ||
} | ||
export function createAbstractImage( | ||
topLeft: Point.Point, | ||
size: Size.Size, | ||
backgroundColor: Color.Color, | ||
components: Array<Component.Component> | ||
topLeft: Point, | ||
size: Size, | ||
backgroundColor: Color, | ||
components: Array<Component> | ||
): AbstractImage { | ||
@@ -19,0 +19,0 @@ return { |
@@ -1,5 +0,5 @@ | ||
import * as Point from "./point.js"; | ||
import * as Color from "./color.js"; | ||
import * as DashStyle from "./dash-style.js"; | ||
import * as AbstractImage from "./abstract-image.js"; | ||
import { Point, createPoint } from "./point.js"; | ||
import { Color } from "./color.js"; | ||
import { DashStyle, solidLine } from "./dash-style.js"; | ||
import { AbstractImage } from "./abstract-image.js"; | ||
@@ -30,4 +30,4 @@ export type Component = BinaryImage | Ellipse | Line | PolyLine | Polygon | Rectangle | Text | SubImage | Group; | ||
readonly type: "binaryimage"; | ||
readonly topLeft: Point.Point; | ||
readonly bottomRight: Point.Point; | ||
readonly topLeft: Point; | ||
readonly bottomRight: Point; | ||
readonly format: BinaryFormat; | ||
@@ -51,4 +51,4 @@ readonly data: ImageData; | ||
export function createBinaryImage( | ||
topLeft: Point.Point, | ||
bottomRight: Point.Point, | ||
topLeft: Point, | ||
bottomRight: Point, | ||
format: BinaryFormat, | ||
@@ -70,8 +70,8 @@ data: ImageData, | ||
readonly type: "ellipse"; | ||
readonly topLeft: Point.Point; | ||
readonly bottomRight: Point.Point; | ||
readonly strokeColor: Color.Color; | ||
readonly topLeft: Point; | ||
readonly bottomRight: Point; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly fillColor: Color.Color; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly fillColor: Color; | ||
readonly id: string | undefined; | ||
@@ -81,9 +81,9 @@ } | ||
export function createEllipse( | ||
topLeft: Point.Point, | ||
bottomRight: Point.Point, | ||
strokeColor: Color.Color, | ||
topLeft: Point, | ||
bottomRight: Point, | ||
strokeColor: Color, | ||
strokeThickness: number, | ||
fillColor: Color.Color, | ||
fillColor: Color, | ||
id?: string, | ||
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine | ||
strokeDashStyle: DashStyle = solidLine | ||
): Ellipse { | ||
@@ -104,7 +104,7 @@ return { | ||
readonly type: "line"; | ||
readonly start: Point.Point; | ||
readonly end: Point.Point; | ||
readonly strokeColor: Color.Color; | ||
readonly start: Point; | ||
readonly end: Point; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly id: string | undefined; | ||
@@ -114,8 +114,8 @@ } | ||
export function createLine( | ||
start: Point.Point, | ||
end: Point.Point, | ||
strokeColor: Color.Color, | ||
start: Point, | ||
end: Point, | ||
strokeColor: Color, | ||
strokeThickness: number, | ||
id?: string, | ||
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine | ||
strokeDashStyle: DashStyle = solidLine | ||
): Line { | ||
@@ -135,6 +135,6 @@ return { | ||
readonly type: "polyline"; | ||
readonly points: Array<Point.Point>; | ||
readonly strokeColor: Color.Color; | ||
readonly points: Array<Point>; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly id: string | undefined; | ||
@@ -144,7 +144,7 @@ } | ||
export function createPolyLine( | ||
points: Array<Point.Point>, | ||
strokeColor: Color.Color, | ||
points: Array<Point>, | ||
strokeColor: Color, | ||
strokeThickness: number, | ||
id?: string, | ||
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine | ||
strokeDashStyle: DashStyle = solidLine | ||
): PolyLine { | ||
@@ -163,7 +163,7 @@ return { | ||
readonly type: "polygon"; | ||
readonly points: Array<Point.Point>; | ||
readonly strokeColor: Color.Color; | ||
readonly points: Array<Point>; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly fillColor: Color.Color; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly fillColor: Color; | ||
readonly id: string | undefined; | ||
@@ -173,8 +173,8 @@ } | ||
export function createPolygon( | ||
points: Array<Point.Point>, | ||
strokeColor: Color.Color, | ||
points: Array<Point>, | ||
strokeColor: Color, | ||
strokeThickness: number, | ||
fillColor: Color.Color, | ||
fillColor: Color, | ||
id?: string, | ||
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine | ||
strokeDashStyle: DashStyle = solidLine | ||
): Polygon { | ||
@@ -194,21 +194,21 @@ return { | ||
readonly type: "rectangle"; | ||
readonly topLeft: Point.Point; | ||
readonly bottomRight: Point.Point; | ||
readonly strokeColor: Color.Color; | ||
readonly topLeft: Point; | ||
readonly bottomRight: Point; | ||
readonly strokeColor: Color; | ||
readonly strokeThickness: number; | ||
readonly strokeDashStyle: DashStyle.DashStyle; | ||
readonly fillColor: Color.Color; | ||
readonly strokeDashStyle: DashStyle; | ||
readonly fillColor: Color; | ||
readonly id: string | undefined; | ||
readonly radius?: Point.Point; | ||
readonly radius?: Point; | ||
} | ||
export function createRectangle( | ||
topLeft: Point.Point, | ||
bottomRight: Point.Point, | ||
strokeColor: Color.Color, | ||
topLeft: Point, | ||
bottomRight: Point, | ||
strokeColor: Color, | ||
strokeThickness: number, | ||
fillColor: Color.Color, | ||
fillColor: Color, | ||
id?: string, | ||
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine, | ||
radius?: Point.Point | ||
strokeDashStyle: DashStyle = solidLine, | ||
radius?: Point | ||
): Rectangle { | ||
@@ -228,8 +228,8 @@ return { | ||
export function corners(rectangle: Rectangle): Array<Point.Point> { | ||
export function corners(rectangle: Rectangle): Array<Point> { | ||
return [ | ||
rectangle.topLeft, | ||
Point.createPoint(rectangle.bottomRight.x, rectangle.topLeft.y), | ||
createPoint(rectangle.bottomRight.x, rectangle.topLeft.y), | ||
rectangle.bottomRight, | ||
Point.createPoint(rectangle.topLeft.x, rectangle.bottomRight.y), | ||
createPoint(rectangle.topLeft.x, rectangle.bottomRight.y), | ||
]; | ||
@@ -246,7 +246,7 @@ } | ||
readonly type: "text"; | ||
readonly position: Point.Point; | ||
readonly position: Point; | ||
readonly text: string; | ||
readonly fontFamily: string; | ||
readonly fontSize: number; | ||
readonly textColor: Color.Color; | ||
readonly textColor: Color; | ||
readonly fontWeight: AbstractFontWeight; | ||
@@ -258,3 +258,3 @@ readonly clockwiseRotationDegrees: number; | ||
readonly strokeThickness: number; | ||
readonly strokeColor: Color.Color; | ||
readonly strokeColor: Color; | ||
readonly italic: boolean; | ||
@@ -265,7 +265,7 @@ readonly id: string | undefined; | ||
export function createText( | ||
position: Point.Point, | ||
position: Point, | ||
text: string, | ||
fontFamily: string, | ||
fontSize: number, | ||
textColor: Color.Color, | ||
textColor: Color, | ||
fontWeight: AbstractFontWeight, | ||
@@ -277,3 +277,3 @@ clockwiseRotationDegrees: number, | ||
strokeThickness: number, | ||
strokeColor: Color.Color, | ||
strokeColor: Color, | ||
italic: boolean, | ||
@@ -303,12 +303,12 @@ id?: string | ||
readonly type: "subimage"; | ||
readonly topLeft: Point.Point; | ||
readonly topLeft: Point; | ||
readonly image: Component; | ||
} | ||
export function createSubImage(topLeft: Point.Point, image: Component): SubImage { | ||
export function createSubImage(topLeft: Point, image: Component): SubImage { | ||
return { type: "subimage", topLeft, image }; | ||
} | ||
export function embedAbstractImage(topLeft: Point.Point, name: string, image: AbstractImage.AbstractImage): Component { | ||
export function embedAbstractImage(topLeft: Point, name: string, image: AbstractImage): Component { | ||
return createSubImage(topLeft, createGroup(name, image.components)); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176469
2922