//

/**
 * Copy single channel from one sampler to another
 * @param {Sampler2D} source
 * @param {number} source_channel
 * @param {Sampler2D} destination
 * @param {number} destination_channel
 */
export function sampler2d_copy_channel_data(source, source_channel, destination, destination_channel) {
    const pixel_count = source.height * source.width;

    const source_item_size = source.itemSize;
    const destination_item_size = destination.itemSize;

    const source_data = source.data;
    const destination_data = destination.data;

    for (let i = 0; i < pixel_count; i++) {
        const address_source = i * source_item_size + source_channel;
        const address_destination = i * destination_item_size + destination_channel;

        destination_data[address_destination] = source_data[address_source];
    }
}
