2022-08-25 00:47:49 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Jelle Raaijmakers <jelle@gmta.nl>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Error.h>
|
2022-08-26 16:59:51 +03:00
|
|
|
#include <AK/Function.h>
|
2022-08-25 00:47:49 +03:00
|
|
|
#include <LibGPU/ImageDataLayout.h>
|
|
|
|
#include <LibGfx/Vector4.h>
|
|
|
|
|
|
|
|
namespace SoftGPU {
|
|
|
|
|
|
|
|
class PixelConverter {
|
|
|
|
public:
|
|
|
|
PixelConverter(GPU::ImageDataLayout input_specification, GPU::ImageDataLayout output_specification)
|
|
|
|
: m_input_specification { input_specification }
|
|
|
|
, m_output_specification { output_specification }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-08-26 16:59:51 +03:00
|
|
|
ErrorOr<void> convert(void const* input_data, void* output_data, Function<void(FloatVector4&)> transform);
|
2022-08-25 00:47:49 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
FloatVector4 read_pixel(u8 const**);
|
|
|
|
void write_pixel(u8**, FloatVector4 const&);
|
|
|
|
|
|
|
|
GPU::ImageDataLayout m_input_specification;
|
|
|
|
GPU::ImageDataLayout m_output_specification;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|