stuff-from-scratch/src/graphics/DrawingManager.h

37 lines
881 B
C
Raw Normal View History

2021-04-17 12:57:14 +00:00
#pragma once
#include <memory>
2021-09-26 20:42:35 +00:00
#include <string>
2021-04-17 12:57:14 +00:00
#include "INativeDrawingContext.h"
#include "INativeDrawingSurface.h"
2021-09-26 20:42:35 +00:00
#ifdef __linux__
2021-04-17 12:57:14 +00:00
#include "CairoInterface.h"
2021-09-26 20:42:35 +00:00
#endif
2021-04-17 12:57:14 +00:00
class TextElement;
class DrawingSurface;
using DrawingSurfacePtr = std::unique_ptr<DrawingSurface>;
class DrawingContext;
using DrawingContextPtr = std::unique_ptr<DrawingContext>;
class DrawingManager
{
public:
DrawingManager();
static std::unique_ptr<DrawingManager> Create();
void InitalizeSurface(unsigned width, unsigned height);
void InitializeContext();
void AddText(TextElement* text);
void RenderToFile(const std::string& path);
private:
DrawingSurfacePtr mDrawingSurface {nullptr};
DrawingContextPtr mDrawingContext {nullptr};
2021-09-26 20:42:35 +00:00
#ifdef __linux__
2021-04-17 12:57:14 +00:00
CairoInterfacePtr mCairoInterface {nullptr};
2021-09-26 20:42:35 +00:00
#endif
2021-04-17 12:57:14 +00:00
};
using DrawingManagerPtr = std::unique_ptr<DrawingManager>;