#pragma once

#include "legacy_canvas_stroke_execution_services.h"
#include "paint_renderer/compositor.h"
#include "shape.h"
#include "texture.h"
#include "util.h"

#include <array>
#include <functional>
#include <span>

namespace pp::panopainter {

struct LegacyNodeStrokePreviewSamplePassRequest {
    glm::vec2 target_size {};
    std::array<vertex_t, 4>& vertices;
    DynamicShape& brush_shape;
    bool copy_stroke_destination = false;
    std::function<void()> bind_destination_texture;
    std::function<void(int, int, int, int, int, int)> copy_framebuffer_to_destination_texture;
    std::function<void()> unbind_destination_texture;
};

[[nodiscard]] glm::vec4 execute_legacy_node_stroke_preview_sample_pass(
    const LegacyNodeStrokePreviewSamplePassRequest& request);

[[nodiscard]] glm::vec4 execute_legacy_node_stroke_preview_sample_pass(
    RTT& preview_rtt,
    std::array<vertex_t, 4>& vertices,
    DynamicShape& brush_shape,
    Texture2D& blend_tex,
    bool copy_stroke_destination);

} // namespace pp::panopainter
