#pragma once
#include "render/texture_sampler.h"
#include "widget/mleaf_widget.h"

class texture;

class mimage : public mleaf_widget {
public:
	void on_paint(mirage_paint_context& in_context) override;
	Eigen::Vector2f compute_desired_size(float in_layout_scale_multiplier) const override;

	const auto& get_image() const { return image_; }
	void set_image(const std::shared_ptr<texture>& in_image);

	const auto& get_color() const { return color_; }
	void set_color(const linear_color& in_color) { color_ = in_color; }

	void set_sampler(const std::shared_ptr<texture_sampler>& in_sampler) { sampler_ = in_sampler; }
	void set_sampler(sampler_type in_type);
private:
	std::shared_ptr<texture> image_;
	std::shared_ptr<texture_sampler> sampler_ = texture_sampler_builder::get_sampler(sampler_type::default_);
	linear_color color_ = { 1, 1, 1, 1 };
};
