cpp_drawing/renderers/pgm_renderer.hpp

33 lines
746 B
C++

#pragma once
#include <cstddef>
#include <filesystem>
#include "bitmap.hpp"
#include "renderer.hpp"
/**
* @brief PGM Renderer
*
* Draws shapes to a PGM format.
*/
class PgmRenderer final : public Renderer
{
public:
PgmRenderer(size_t width, size_t height);
void DrawLine(const math::Vector& p0, const math::Vector& p1) override;
void DrawRectangle(const math::Vector& pos, const math::Vector& size, float angle) override;
void DrawCircle(const math::Vector& center, float radius) override;
void Save(const std::filesystem::path& path);
~PgmRenderer() override = default;
private:
Bitmap m_bitmap;
void RasterizeLine(int x0, int y0, int x1, int y1);
void RasterizeCircle(int xm, int ym, int r);
};