import { Vec2 } from "../math/Vec2"; import { Vec4 } from "../math/Vec4"; import type { Renderer } from "./Renderer"; import type { Lookups } from "../font/types"; import type { TextAlign } from "../layout/styling"; export declare class WebGLRenderer implements Renderer { private readonly canvas; private readonly context; private readonly fontLookups; readonly gl: WebGL2RenderingContext; private readonly program; /** * Buffer using strides. * * - **Position** - In pixels `[0, width], [0, height]`. * - **UV** - In range `[0, 1]`. * - **Color** - In range `[0, 1]`. * - **Corner** - Bottom left corner. `new Vec2(-1, -1)` for non-rectangles. * - **Rectangle** size - In pixels. `new Vec2(-1, -1)` for non-rectangles. * - **Radius** - In pixels. Top, right, bottom, left. `new Vec4(-1, -1, -1, -1)` for * non-rectangles. - **Border width** - In pixels. Top, right, bottom, left. `new Vec4(-1, -1, * -1, -1)` for non-rectangles. - **Border color** - In range `[0, 1]`. */ private vertexAttributes; private readonly fontAtlasTexture; private readonly vao; private readonly interleavedBuffer; /** * Updated in `clear()`. */ private contextHeight; /** * Creates new context. */ constructor(canvas: HTMLCanvasElement, context: WebGL2RenderingContext, fontLookups: Lookups, fontAtlasTexture: ImageBitmap); line(points: Array, thickness: number, color: Vec4): void; polygon(points: Array, color: Vec4): void; triangles(points: Array, color: Vec4): void; rectangle(color: Vec4, position: Vec2, size: Vec2, corners: Vec4, borderWidth: Vec4, borderColor: Vec4, clipStart: Vec2, clipSize: Vec2, clipCorners: Vec4): void; clear(): void; private setProjection; text(text: string, position: Vec2, fontName: string, fontSize: number, color: Vec4, textAlign: TextAlign, clipStart: Vec2, clipSize: Vec2, options?: { lineHeight?: number; maxWidth?: number; noWrap?: boolean; }): void; render(): void; private loadTexture; private setAttribute; private pushVertexData; }