import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * A single Canvas/texture with multiple different images (sprites) drawn internally. During rendering, this texture
 * can be used in one draw call to render multiple different images by providing UV coordinates to each quad for each
 * image to be drawn.
 *
 * Note that the WebGL texture part is not required to be run - the Canvas-only part can be used functionally without
 * any WebGL dependencies.
 *
 * TODO: How to use custom mipmap levels? https://github.com/phetsims/scenery/issues/1581
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 * @author Sam Reid (PhET Interactive Simulations)
 */
import { Bin } from '../../../dot/js/BinPacker.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Dimension2 from '../../../dot/js/Dimension2.js';
export default class SpriteSheet {
    private useMipmaps;
    private gl;
    texture: WebGLTexture | null;
    private bounds;
    private width;
    private height;
    private canvas;
    private context;
    private binPacker;
    private dirty;
    private usedSprites;
    private unusedSprites;
    /**
     * @param useMipmaps - Whether built-in WebGL mipmapping should be used. Higher quality, but may be slower
     *                     to add images (since mipmaps need to be updated).
     */
    constructor(useMipmaps: boolean);
    /**
     * Initialize (or reinitialize) ourself with a new GL context. Should be called at least once before updateTexture()
     *
     * NOTE: Should be safe to call with a different context (will recreate a different texture) should this be needed
     *       for things like context loss.
     */
    initializeContext(gl: WebGLRenderingContext): void;
    /**
     * Allocates and creates a GL texture, configures it, and initializes it with our current Canvas.
     */
    private createTexture;
    /**
     * Updates a pre-existing texture with our current Canvas.
     */
    updateTexture(): void;
    /**
     * Adds an image (if possible) to our sprite sheet. If successful, will return a {Sprite}, otherwise null.
     *
     * @param image
     * @param width - Passed in, since it may not be fully loaded yet?
     * @param height - Passed in, since it may not be fully loaded yet?
     */
    addImage(image: HTMLCanvasElement | HTMLImageElement, width: number, height: number): Sprite | null;
    /**
     * Removes an image from our spritesheet. (Removes one from the amount it is used, and if it is 0, gets actually
     * removed).
     */
    removeImage(image: HTMLCanvasElement | HTMLImageElement): void;
    /**
     * Whether the sprite for the specified image is handled by this spritesheet. It can be either used or unused, but
     * addImage() calls with the specified image should be extremely fast (no need to modify the Canvas or texture).
     */
    containsImage(image: HTMLCanvasElement | HTMLImageElement): boolean;
    /**
     * Copes the image (width x height) centered into a bin (width+2 x height+2) at (binX,binY), where the padding
     * along the edges is filled with the next closest pixel in the actual image.
     */
    private copyImageWithGutter;
    /**
     * Helper for drawing gutters.
     */
    private copyImageRegion;
    static Sprite: typeof Sprite;
    static readonly MAX_DIMENSION: Dimension2;
}
declare class Sprite {
    readonly spriteSheet: SpriteSheet;
    readonly bin: Bin;
    readonly uvBounds: Bounds2;
    readonly image: HTMLCanvasElement | HTMLImageElement;
    count: number;
    /**
     * A reference to a specific part of the texture that can be used.
     */
    constructor(spriteSheet: SpriteSheet, bin: Bin, uvBounds: Bounds2, image: HTMLCanvasElement | HTMLImageElement, initialCount: number);
}
export {};
//# sourceMappingURL=SpriteSheet.d.ts.map