goban-engine
Version:
This contains the built Go engine that is used by the Goban package. There are no display components in this package, only the logic for playing the game of Go, making it suitable for usage in node.js or other server-side environments.
75 lines (74 loc) • 3.25 kB
TypeScript
import { GobanBase } from "../../GobanBase";
export interface GobanThemeBackgroundCSS {
"background-color"?: string;
"background-image"?: string;
"background-size"?: string;
}
export interface GobanThemeBackgroundReactStyles {
backgroundColor?: string;
backgroundImage?: string;
backgroundSize?: string;
}
export interface SVGStop {
offset: number;
color: string;
}
export interface SVGStoneParameters {
id: string;
fill?: string;
stroke?: string;
stroke_scale?: number;
gradient?: {
stops: SVGStop[];
type?: "radial" | "linear";
x1?: number;
x2?: number;
y1?: number;
y2?: number;
cx?: number;
cy?: number;
r?: number;
fx?: number;
fy?: number;
};
url?: string;
}
export declare class GobanTheme {
name: string;
styles: {
[style_name: string]: string;
};
protected parent?: GobanTheme;
constructor(parent?: GobanTheme);
get theme_name(): string;
sort(): number;
preRenderBlack(_radius: number, _seed: number, _deferredRenderCallback: () => void): any;
preRenderWhite(_radius: number, _seed: number, _deferredRenderCallback: () => void): any;
preRenderBlackSVG(defs: SVGDefsElement, radius: number, _seed: number, _deferredRenderCallback: () => void): string[];
preRenderWhiteSVG(defs: SVGDefsElement, radius: number, _seed: number, _deferredRenderCallback: () => void): string[];
preRenderShadowSVG(defs: SVGDefsElement, color: string): void;
placeWhiteStone(ctx: CanvasRenderingContext2D, _shadow_ctx: CanvasRenderingContext2D | null, _stone: any, cx: number, cy: number, radius: number): void;
placeBlackStone(ctx: CanvasRenderingContext2D, _shadow_ctx: CanvasRenderingContext2D | null, _stone: any, cx: number, cy: number, radius: number): void;
placeStoneShadowSVG(shadow_cell: SVGGraphicsElement | undefined, cx: number, cy: number, radius: number, color: string): SVGElement | undefined;
private placeStoneSVG;
placeWhiteStoneSVG(cell: SVGGraphicsElement, shadow_cell: SVGGraphicsElement | undefined, stone: string, cx: number, cy: number, radius: number): [SVGElement, SVGElement | undefined];
placeBlackStoneSVG(cell: SVGGraphicsElement, shadow_cell: SVGGraphicsElement | undefined, stone: string, cx: number, cy: number, radius: number): [SVGElement, SVGElement | undefined];
getStone(x: number, y: number, stones: any, _goban: GobanBase): any;
getStoneHash(x: number, y: number, stones: any, _goban: GobanBase): string;
stoneCastsShadow(_radius: number): boolean;
getWhiteStoneColor(): string;
getBlackStoneColor(): string;
getWhiteTextColor(_color?: string): string;
getBlackTextColor(_color?: string): string;
getBackgroundCSS(): GobanThemeBackgroundCSS;
getReactStyles(): GobanThemeBackgroundReactStyles;
getLineColor(): string;
getFadedLineColor(): string;
getStarColor(): string;
getFadedStarColor(): string;
getBlankTextColor(): string;
/** Returns the color that should be used for labels */
getLabelTextColor(): string;
renderSVG(params: SVGStoneParameters, radius: number): SVGGraphicsElement;
def_uid(base: string): string;
}