import { LazyResizableTypedArray } from './LazyResizableTypedArray';
import { RgbaComponent } from './loader/rgba';
import { Writeable } from './Types';
/**
 * Represents the bits that can be modified/read by {@link Uint32Bits} operations.
 */
export type BitIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
/**
 * Provides methods to manipulate and read individual and bytes in the uint3.
 * of a typed array `Uint32Array`.
 */
export declare class Uint32Bytes {
    private _uint32;
    /**
     * Points to the current number to manipulate/read bytes in/from in the {@link Uint32Bits} instance passed in the `constructor`.
     * For internal use only.
     * @hidden
     * @internal
     */
    _dataOffsetInBytes: number;
    /**
     * constructor
     * @param _uint32 Instance to read/manipulate bytes in.
     */
    constructor(_uint32: Uint32Bits);
    /**
     * Get the current uint32 number that this instance is currently working with.
     */
    get value(): number;
    /**
     * Replace the current uint32 number that this instance is currently working with.
     */
    set value(v: number);
    /**
     * Whether the number this instance is working with has changed
     * started working with it.
     */
    get isChanged(): boolean;
    /**
     * Get the value at the byte offset specified by `offset`.
     * @param offset byte offset in the current uint32 number. 0 .. 3
     * @returns Byte value at `offset`
     */
    get(offset: number | RgbaComponent): number;
    /**
     * Set the value at the byte offset specified by `offset`.
     * @param offset byte offset in the current uint32 number. 0 .. 3
     * @param v byte value to set. Should be 0..255
     */
    set(offset: number | RgbaComponent, v: number): void;
    /**
     * Copies the bytes values of the current uint32 number into `dst`. If `dst`
     * cannot accomodate all the numbers only so many numbers are copied that can fit in `dst`.
     * @param dst Destination array to write numbers to
     * @param dstOffset offset `dst` to write numbers to
     * @returns `dst`.
     */
    copyTo(dst: Writeable<ArrayLike<number>>, dstOffset?: number): ArrayLike<number>;
    /**
     * Copies the bytes in `src` into the current uint32 number starting at byte position 0 and ending at
     * 3. If `src` cannot provide 4 bytes of data only as much as possible with be copied.
     * @param src Src array to copy from
     * @param srcOffset Offset in `src` to copy from
     * @returns {@link Uint32Bytes} instance.
     */
    copyFrom(src: ArrayLike<number>, srcOffset?: number): Uint32Bytes;
}
/**
 * A handler function for events triggered when a 32-bit unsigned integer value changes.
 *
 * @param offset - The offset at which the change occurred.
 * @param current - The current value after the change.
 * @param prev - The previous value before the change.
 */
export interface Uint32BitsOnChangedEventHandler {
    (offset: number, current: number, prev: number): void;
}
/**
 * Provides methods to manipulate and read individual and bits in the numbers held by a
 * a typed array `Uint32Array`.
 */
export declare class Uint32Bits {
    readonly data: Pick<LazyResizableTypedArray<number, Uint32Array>, 'buffer' | 'uint8'>;
    private readonly _onValueChanged;
    private static readonly _uint32BitMasks;
    private static readonly _pow2;
    private _dataOffset;
    private _bytes;
    private _isChanged;
    /**
     * constructor
     * @param data uint32 numbers to read/manipulate
     * @param _onValueChanged Callback which is invoked when a {@link value} has changed.
     */
    constructor(data: Pick<LazyResizableTypedArray<number, Uint32Array>, 'buffer' | 'uint8'>, _onValueChanged?: Uint32BitsOnChangedEventHandler);
    /**
     * Get a {@link Uint32Bytes} instance that can be used to manipulate the number that the bytes in {@link data}.`buffer` represents.
     * The number is specified by setting {@link dataOffset}. Calling mutating methods in the {@link Uint32Bytes} will trigger the {@link _onValueChanged}
     * callback.
     * and {@link isChanged} will also be changed accordingly.
     */
    get bytes(): Uint32Bytes;
    /**
     * The `uint32` number that the {@link Uint32Bits} instance is currently working with (specified by {@link dataOffset}).
     */
    get value(): number;
    /**
     * Replace the `uint32` number in {@link data} that {@link dataOffset} points to.
     * Will trigger {@link _onValueChanged} callback and {@link isChanged} will also be changed accordingly.
     */
    set value(v: number);
    /**
     * Gets the offset of the number in {@link data} the {@link Uint32Bits} instance is working with
     */
    get dataOffset(): number;
    /**
     * Sets the offset of the number in {@link data} the {@link Uint32Bits} instance is working with,
     * Also resets the {@link isChanged} property to false.
     */
    set dataOffset(o: number);
    /**
     * Whether the number in {@link data} that {@link dataOffset} currently points to has changed since {@link dataOffset}
     * was last called. Can only be changed by calling methods and properties on this {@link Uint32Bits} instance.
     */
    get isChanged(): boolean;
    /**
     * Check if a bit is on or off in {@link data} [{@link dataOffset}].
     * @param bit The bit to check-
     * @returns `true` if bit is on. Otherwise `false`.
     */
    has(bit: BitIndex): boolean;
    /**
     * Set a bit to on/off in {@link data}[{@link dataOffset}].
     * @param bit Bit to set on/off.
     * @param truthy `truthy` sets the bit 1. `falsy` sets it to 0.
     * @returns The current {@link Uint32Bits} instance.
     */
    set(bit: BitIndex, truthy: unknown): Uint32Bits;
    /**
     * Sets a bit to 1 in {@link data} [{@link dataOffset}].
     * @param bit Bit to set to on/off
     * @returns The current {@link Uint32Bits} instance.
     */
    on(bit: BitIndex): Uint32Bits;
    /**
     * Sets a bit to 0 in {@link data} [{@link dataOffset}].
     * @param bit Bit to set to on/off
     * @returns The current {@link Uint32Bits} instance.
     */
    off(bit: BitIndex): Uint32Bits;
    /**
     * Store a number at bits defined by `bit` and `bit + size`. Only the first size bits of `val`
     * will be used.
     * @param bit bit to start storing `val` at.
     * @param size number of bits to store `val` at.
     * @param val Value to store
     * @returns The {@link Uint32Bits} instance. Useful for chaining.
     */
    setNumber(bit: BitIndex, size: number, val: number): Uint32Bits;
    /**
     * Returns the number stored at a `bit` up to the bit specified by `bit` + `size`.
     * @param bit bit
     * @param size number of bits starting at `bit`.
     * @returns The number stored at `[bit, bit + size]`.
     */
    getNumber(bit: BitIndex, size: number): number;
    /**
     * Converts {@link data}[{@link dataOffset}] to a binary string
     * @returns Binary string representation (32 positions.)
     */
    toBinaryString(): string;
    /**
     * converts `n` to a binary string
     * @returns Binary string representation (32 positions.)
     * @param n Number to convert to a binary string.
     * @returns Binary string representation (32 positions.)
     */
    static toBinaryString(n: number): string;
    /**
     * Creates a mask with bits specified by `bit` to `bit + size` set to 1. All other bits are 0
     * @param bit bit
     * @param size number of bits to set
     * @returns mask
     */
    static mask(bit: BitIndex, size: number): number;
    /**
     * Returns the number stored at a specified bit up to the bit specified by `bit + size`.
     * @param value The value to extract the number from.
     * @param bit The starting bit position.
     * @param size The number of bits to extract.
     * @returns The number stored at [bit, bit + size].
     */
    static getNumber(value: number, bit: BitIndex, size: number): number;
    /**
     * Stores a number at bits defined by `bit` and `bit + size`. Only the first size bits of `val` will be used.
     * @param value The original value.
     * @param bit The starting bit position.
     * @param size The number of bits to store.
     * @param val The value to store.
     * @returns The modified value with the number stored at the specified bits.
     */
    static setNumber(value: number, bit: BitIndex, size: number, val: number): number;
    /**
     * Checks if a bit is on or off in the given value.
     * @param value The value to check.
     * @param bit The bit to check.
     * @returns `true` if the bit is on, otherwise `false`.
     */
    static has(value: number, bit: BitIndex): boolean;
    /**
     * Sets a bit to on/off in the given value.
     * @param value The original value.
     * @param bit The bit to set on/off.
     * @param truthy `truthy` sets the bit to 1, `falsy` sets it to 0.
     * @returns The modified value with the bit set.
     */
    static set(value: number, bit: BitIndex, truthy: unknown): number;
    /**
     * Sets a bit to 1 in the given value.
     * @param value The original value.
     * @param bit The bit to set to 1.
     * @returns The modified value with the bit set to 1.
     */
    static on(value: number, bit: BitIndex): number;
    /**
     * Sets a bit to 0 in the given value.
     * @param value The original value.
     * @param bit The bit to set to 0.
     * @returns The modified value with the bit set to 0.
     */
    static off(value: number, bit: BitIndex): number;
    /**
     * @hidden
     * @internal
     */
    _onChanged(prev: number, current: number): void;
}
//# sourceMappingURL=Uint32Bits.d.ts.map