@maxgraph/core
Version:
maxGraph is a fully client side JavaScript diagramming library that uses SVG and HTML for rendering.
46 lines (45 loc) • 1.8 kB
TypeScript
import RectangleShape from './RectangleShape.js';
import type Rectangle from '../../geometry/Rectangle.js';
import CellState from '../../cell/CellState.js';
import type AbstractCanvas2D from '../../canvas/AbstractCanvas2D.js';
import { ColorValue } from '../../../types.js';
/**
* Extends {@link RectangleShape} to implement an image shape.
*
* This shape is registered under `image` in {@link CellRenderer} when using {@link Graph} or calling {@link registerDefaultShapes}.
*
* @category Vertex Shapes
*/
declare class ImageShape extends RectangleShape {
constructor(bounds: Rectangle, imageSrc: string, fill?: ColorValue, stroke?: ColorValue, strokeWidth?: number);
shadow: boolean;
/**
* Disables offset in IE9 for crisper image output.
*/
getSvgScreenOffset(): number;
/**
* Overrides to replace the fill and stroke colors with the respective values from {@link imageBackground} and {@link imageBorder}.
*
* Applies the style of the given {@link CellState} to the shape. This implementation assigns the following styles to local fields:
*
* - {@link imageBackground} => fill
* - {@link imageBorder} => stroke
*
* @param {CellState} state {@link CellState} of the corresponding cell.
*/
apply(state: CellState): void;
/**
* Returns true if HTML is allowed for this shape. This implementation always
* returns false.
*/
isHtmlAllowed(): boolean;
/**
* Disables inherited roundable support.
*/
isRoundable(c: AbstractCanvas2D, x: number, y: number, w: number, h: number): boolean;
/**
* Generic background painting implementation.
*/
paintVertexShape(c: AbstractCanvas2D, x: number, y: number, w: number, h: number): void;
}
export default ImageShape;