import { Callable, RoBitmap, RoFont } from "..";
import { BrsComponent } from "../components/BrsComponent";
import { RoCompositor } from "../components/RoCompositor";
import { Canvas, CanvasRenderingContext2D, ImageData as NodeImageData } from "canvas";
export type BrsCanvas = OffscreenCanvas | Canvas;
export type BrsCanvasContext2D = OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D;
export type BrsImageData = ImageData | NodeImageData;
export type Rect = {
    x: number;
    y: number;
    width: number;
    height: number;
};
export type Circle = {
    x: number;
    y: number;
    r: number;
};
export type MeasuredText = {
    text: string;
    width: number;
    height: number;
    ellipsized: boolean;
};
/**
 * BrightScript Interface ifDraw2D
 * https://developer.roku.com/docs/references/brightscript/interfaces/ifdraw2d.md
 */
export declare class IfDraw2D {
    private readonly component;
    constructor(component: BrsDraw2D);
    doClearCanvas(rgba: number): void;
    doDrawScaledObject(x: number, y: number, scaleX: number, scaleY: number, object: RoBitmap, rgba?: number, opacity?: number): boolean;
    doDrawCroppedBitmap(object: RoBitmap, sourceRect: Rect, destRect: Rect, rgba?: number, opacity?: number): boolean;
    doDrawRotatedBitmap(x: number, y: number, scaleX: number, scaleY: number, rotation: number, object: RoBitmap, centerX?: number, centerY?: number, rgba?: number, opacity?: number): void;
    doDrawRotatedRect(rect: Rect, rgba: number, rotation: number, center?: number[], opacity?: number): void;
    doDrawClearedRect(rect: Rect): void;
    doDrawText(text: string, x: number, y: number, rgba: number, opacity: number, font: RoFont): void;
    doDrawRotatedText(text: string, x: number, y: number, rgba: number, opacity: number, font: RoFont, rotation: number): void;
    /**
     * Saves the current drawing context state and applies a rectangular clipping region.
     * Subsequent drawing operations will be limited to this rectangle.
     * Must be paired with a call to popClip().
     * @param rect The clipping rectangle in the current coordinate system.
     */
    pushClip(rect: Rect): void;
    /**
     * Restores the drawing context state that was saved by the corresponding pushClip() call,
     * effectively removing the last applied clipping region.
     */
    popClip(): void;
    drawNinePatch(bitmap: RoBitmap, rect: Rect, rgba?: number, opacity?: number): void;
    /** Clear the bitmap, and fill with the specified RGBA color */
    readonly clear: Callable;
    /** Draw the source object, where src is an roBitmap or an roRegion object, at position x,y */
    readonly drawObject: Callable;
    /** Draw the source object at position x,y rotated by angle theta degrees. */
    readonly drawRotatedObject: Callable;
    /** Draw the source object, at position x,y, scaled horizontally by scaleX and vertically by scaleY. */
    readonly drawScaledObject: Callable;
    /** Draw the source object, at position x,y, rotated by theta and scaled horizontally by scaleX and vertically by scaleY. */
    readonly drawTransformedObject: Callable;
    /** Draw a line from (xStart, yStart) to (xEnd, yEnd) with RGBA color */
    readonly drawLine: Callable;
    /** Draws a point at (x,y) with the given size and RGBA color */
    readonly drawPoint: Callable;
    /** Fill the specified rectangle from left (x), top (y) to right (x + width), bottom (y + height) with the RGBA color */
    readonly drawRect: Callable;
    /** Draws the text at position (x,y) using the specified RGBA color and roFont font object. */
    readonly drawText: Callable;
    /** Realize the bitmap by finishing all queued draw calls. */
    readonly finish: Callable;
    /** Returns true if alpha blending is enabled */
    readonly getAlphaEnable: Callable;
    /** If enable is true, do alpha blending when this bitmap is the destination */
    readonly setAlphaEnable: Callable;
    /** Return the width of the screen/bitmap/region. */
    readonly getWidth: Callable;
    /** Return the height of the screen/bitmap/region. */
    readonly getHeight: Callable;
    /** Returns an roByteArray representing the RGBA pixel values for the rectangle described by the parameters. */
    readonly getByteArray: Callable;
    /** Returns an roByteArray object containing PNG image data for the specified area of the bitmap. */
    readonly getPng: Callable;
}
export interface BrsDraw2D {
    readonly x: number;
    readonly y: number;
    readonly width: number;
    readonly height: number;
    scaleMode: number;
    clearCanvas(rgba: number): void;
    getContext(): BrsCanvasContext2D;
    getCanvas(): BrsCanvas;
    getRgbaCanvas(rgba: number): BrsCanvas;
    setCanvasAlpha(alphaEnable: boolean): void;
    getCanvasAlpha(): boolean;
    drawImage(object: BrsComponent, x: number, y: number, scaleX?: number, scaleY?: number, rgba?: number): boolean;
    makeDirty(): void;
    finishDraw(): void;
}
export declare class DrawOffset {
    x: number;
    y: number;
}
export declare function getDrawOffset(object: BrsDraw2D | RoCompositor): DrawOffset;
export declare class Dimensions {
    width: number;
    height: number;
    constructor(width: number, height: number);
}
export declare function getDimensions(object: BrsDraw2D | RoCompositor | BrsCanvas): Dimensions;
export declare function drawObjectToComponent(component: BrsDraw2D | RoCompositor, object: BrsComponent, x: number, y: number, scaleX?: number, scaleY?: number, rgba?: number, scaleMode?: number): boolean;
export declare function drawBitmapOnBitmap(source: RoBitmap, destiny: RoBitmap, scaleMode?: number): void;
export declare function drawImageToContext(ctx: BrsCanvasContext2D, image: BrsCanvas, alphaEnable: boolean, x: number, y: number): boolean;
export declare function drawRotatedObject(component: BrsDraw2D, object: BrsComponent, x: number, y: number, angle: number, rgba?: number): boolean;
export declare function createNewCanvas(width: number, height: number): Canvas | OffscreenCanvas;
export declare function releaseCanvas(canvas: BrsCanvas): void;
export declare function drawImageAtPos(image: BrsCanvas, ctx: BrsCanvasContext2D, x: number, y: number): void;
export declare function putImageAtPos(imageData: BrsImageData, ctx: BrsCanvasContext2D, x: number, y: number): void;
export declare function rgbaIntToHex(rgba: number, alpha?: boolean): string;
export declare function rgbaToTransparent(rgba: number): number;
export declare function rgbaToOpaque(rgba: number): number;
export declare function RectRect(rect1: Rect, rect2: Rect): boolean;
export declare function RectCircle(rect: Rect, circle: Circle): boolean;
export declare function CircleCircle(circle1: Circle, circle2: Circle): boolean;
